Skip to content

Commit

Permalink
Add official build yml files (#759)
Browse files Browse the repository at this point in the history
  • Loading branch information
kamperiadis authored and shreyas-gopalakrishna committed Jul 14, 2024
1 parent 3b43061 commit 0debaa3
Show file tree
Hide file tree
Showing 4 changed files with 336 additions and 0 deletions.
52 changes: 52 additions & 0 deletions eng/ci/official-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
trigger:
batch: true
branches:
include:
- dev
- release/* # azure-functions-java-worker github repo restricts creation of release/* branches, so using a pattern is safe here.

# CI only, does not trigger on PRs.
pr: none

resources:
repositories:
- repository: 1es
type: git
name: 1ESPipelineTemplates/1ESPipelineTemplates
ref: refs/tags/release
- repository: eng
type: git
name: engineering
ref: refs/tags/release

variables:
- template: ci/variables/build.yml@eng
- template: ci/variables/cfs.yml@eng

extends:
template: v1/1ES.Official.PipelineTemplate.yml@1es
parameters:
pool:
name: 1es-pool-azfunc
image: 1es-windows-2022
os: windows

stages:
- stage: Build

jobs:
- template: /eng/ci/templates/official/jobs/build-artifacts.yml@self

- stage: TestWindows
dependsOn: Build

jobs:
- template: /eng/ci/templates/official/jobs/run-e2e-tests-windows.yml@self

- stage: TestLinux
dependsOn:
- Build
- TestWindows

jobs:
- template: /eng/ci/templates/official/jobs/run-e2e-tests-linux.yml@self
64 changes: 64 additions & 0 deletions eng/ci/templates/official/jobs/build-artifacts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
jobs:
- job: "Build"
displayName: 'Build java worker'

templateContext:
outputParentDirectory: $(Build.ArtifactStagingDirectory)
outputs:
- output: pipelineArtifact
targetPath: $(Build.ArtifactStagingDirectory)
artifactName: 'buildDrop'
- output: nuget
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/dev'), eq(variables['UPLOADPACKAGETOPRERELEASEFEED'], true))
useDotNetTask: false
packagesToPush: '$(Build.ArtifactStagingDirectory)/**/*.nupkg;!$(Build.ArtifactStagingDirectory)/**/*.symbols.nupkg'
packageParentPath: '$(Build.ArtifactStagingDirectory)'
publishVstsFeed: 'e6a70c92-4128-439f-8012-382fe78d6396/f37f760c-aebd-443e-9714-ce725cd427df'
nuGetFeedType: 'internal'
allowPackageConflicts: true

pool:
name: 1es-pool-azfunc
image: 1es-windows-2022
os: windows

variables:
${{ if contains(variables['Build.SourceBranch'], '/tags/' ) }}:
isTagTemp: true
isTag: $[variables.isTagTemp]

steps:
- task: NuGetToolInstaller@1
inputs:
checkLatest: true
displayName: 'Install NuGet Tool'
- pwsh: |
Get-Command mvn
displayName: 'Check Maven is installed'
- pwsh: |
java -version
displayName: 'Check default java version'
- pwsh: |
if ("$(isTag)"){
$buildNumber="$(Build.SourceBranchName)"
Write-Host "Found git tag."
}
else {
$buildNumber="$(Build.BuildNumber)-v4"
Write-Host "git tag not found. Setting package suffix to '$buildNumber'"
}
Write-Host "##vso[task.setvariable variable=buildNumber;isOutput=true;]$buildNumber"
.\package-pipeline.ps1 -buildNumber $buildNumber
name: output
displayName: 'Executing build script'
- pwsh: |
mvn dependency-check:check
condition: and(eq(variables['Build.SourceBranch'], 'refs/heads/dev'), eq(variables['SkipMavenDependencyCheck'], 'false'))
displayName: 'Maven dependency check'
- task: CopyFiles@2
inputs:
SourceFolder: '$(Build.Repository.LocalPath)/pkg'
Contents: '*.nupkg'
TargetFolder: '$(Build.ArtifactStagingDirectory)'
CleanTargetFolder: true
displayName: 'Copying files for artifacts'
118 changes: 118 additions & 0 deletions eng/ci/templates/official/jobs/run-e2e-tests-linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
jobs:
- job: "TestLinux"
displayName: 'Test java worker - Linux'

pool:
name: 1es-pool-azfunc
image: 1es-ubuntu-22.04
os: linux

variables:
buildNumber: $[ stageDependencies.Build.Build.outputs['output.buildNumber'] ]
ApplicationInsightAgentVersion: 3.5.1

strategy:
maxParallel: 1
matrix:
open-jdk-8-linux:
JDK_DOWNLOAD_LINK: 'https://github.com/adoptium/temurin8-binaries/releases/download/jdk8u392-b08/OpenJDK8U-jdk_x64_linux_hotspot_8u392b08.tar.gz'
JAVA_VERSION: 'OpenJDK8U-jdk_x64_linux_hotspot_8u392b08'
JDK_PATH: 'jdk8u392-b08'
JAVA_VERSION_SPEC: '8'
microsoft-open-jdk-11-linux:
JDK_DOWNLOAD_LINK: 'https://aka.ms/download-jdk/microsoft-jdk-11.0.21-linux-x64.tar.gz'
JAVA_VERSION: 'microsoft-jdk-11.0.21-linux-x64'
JDK_PATH: 'jdk-11.0.21+9'
JAVA_VERSION_SPEC: '11'
microsoft-open-jdk-17-linux:
JDK_DOWNLOAD_LINK: 'https://aka.ms/download-jdk/microsoft-jdk-17.0.9-linux-x64.tar.gz'
JAVA_VERSION: 'microsoft-jdk-17.0.9-linux-x64'
JDK_PATH: 'jdk-17.0.9+8'
JAVA_VERSION_SPEC: '17'
microsoft-open-jdk-21-linux:
JDK_DOWNLOAD_LINK: 'https://aka.ms/download-jdk/microsoft-jdk-21.0.1-linux-x64.tar.gz'
JAVA_VERSION: 'microsoft-jdk-21.0.1-linux-x64'
JDK_PATH: 'jdk-21.0.1+12'
JAVA_VERSION_SPEC: '21'

steps:
- task: NuGetToolInstaller@1
inputs:
checkLatest: true
displayName: 'Install NuGet Tool'
- pwsh: |
Get-Command mvn
displayName: 'Check Maven is installed'
- task: JavaToolInstaller@0 # This step is necessary as Linux image has Java 11 as default
inputs:
versionSpec: '8'
jdkArchitectureOption: 'x64'
jdkSourceOption: 'PreInstalled'
displayName: 'Setup Java for Linux'
- pwsh: |
java -version
displayName: 'Check default java version'
- pwsh: |
.\package-pipeline.ps1 -buildNumber $(buildNumber)
displayName: 'Executing build script'
- task: UseDotNet@2
displayName: 'Install .NET 6'
inputs:
version: 6.0.x
- pwsh: | # Download JDK for later installation
Invoke-WebRequest $(JDK_DOWNLOAD_LINK) -OutFile "$(JAVA_VERSION).tar.gz"
$current = get-location | select -ExpandProperty Path
Write-Host "##vso[task.setvariable variable=downloadPath;]$current"
displayName: 'Download jdk for Linux'
- task: JavaToolInstaller@0 # Install JDK downloaded from previous task
inputs:
versionSpec: $(JAVA_VERSION_SPEC)
jdkArchitectureOption: 'x64'
jdkSourceOption: LocalDirectory
jdkFile: "$(downloadPath)/$(JAVA_VERSION).tar.gz"
jdkDestinationDirectory: "$(downloadPath)/externals"
cleanDestinationDirectory: true
displayName: 'Setup Java for Linux'
- pwsh: |
.\setup-tests-pipeline.ps1
displayName: 'Setup test environment -- Install the Core Tools'
- bash: |
chmod +x ./Azure.Functions.Cli/func
chmod +x ./Azure.Functions.Cli/gozip
export PATH=$PATH:./Azure.Functions.Cli
func --version
displayName: 'Setup Core Tools - Linux'
- pwsh: |
cd ./endtoendtests
mvn clean package `-Dmaven`.javadoc`.skip=true `-Dmaven`.test`.skip `-Dorg`.slf4j`.simpleLogger`.log`.org`.apache`.maven`.cli`.transfer`.Slf4jMavenTransferListener=warn `-B
Copy-Item "confluent_cloud_cacert.pem" "./target/azure-functions/azure-functions-java-endtoendtests"
displayName: 'Package Java for E2E'
- task: DotNetCoreCLI@2
inputs:
command: 'test'
projects: |
endtoendtests/Azure.Functions.Java.Tests.E2E/Azure.Functions.Java.Tests.E2E/Azure.Functions.Java.Tests.E2E.csproj
env:
JAVA_HOME: $(JavaHome)
AzureWebJobsStorage: $(AzureWebJobsStorage)
AzureWebJobsCosmosDBConnectionString: $(AzureWebJobsCosmosDBConnectionString)
AzureWebJobsSqlConnectionString: $(AzureWebJobsSqlConnectionString)
AzureWebJobsServiceBus: $(AzureWebJobsServiceBus)
AzureWebJobsEventHubReceiver: $(AzureWebJobsEventHubReceiver)
AzureWebJobsEventHubSender_2: $(AzureWebJobsEventHubSender_2)
AzureWebJobsEventHubSender: $(AzureWebJobsEventHubSender)
AzureWebJobsEventHubPath: $(AzureWebJobsEventHubPath)
SBTopicName: $(SBTopicName)
SBTopicSubName: $(SBTopicSubName)
CosmosDBDatabaseName: $(CosmosDBDatabaseName)
SBQueueName: $(SBQueueName)
BrokerList": $(BrokerList)
ConfluentCloudUsername: $(ConfluentCloudUsername)
ConfluentCloudPassword: $(ConfluentCloudPassword)
AzureWebJobsEventGridOutputBindingTopicUriString: $(AzureWebJobsEventGridOutputBindingTopicUriString)
AzureWebJobsEventGridOutputBindingTopicKeyString: $(AzureWebJobsEventGridOutputBindingTopicKeyString)
ApplicationInsightAPIKey: $(ApplicationInsightAPIKey)
ApplicationInsightAPPID: $(ApplicationInsightAPPID)
ApplicationInsightAgentVersion: $(ApplicationInsightAgentVersion)
displayName: 'Build & Run tests'
continueOnError: false
102 changes: 102 additions & 0 deletions eng/ci/templates/official/jobs/run-e2e-tests-windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
jobs:
- job: "TestWindows"
displayName: 'Test java worker - Windows'

pool:
name: 1es-pool-azfunc
image: 1es-windows-2022
os: windows

variables:
buildNumber: $[ stageDependencies.Build.Build.outputs['output.buildNumber'] ]
ApplicationInsightAgentVersion: 3.5.1

strategy:
maxParallel: 1
matrix:
open-jdk-8-windows:
JDK_DOWNLOAD_LINK: 'https://github.com/adoptium/temurin8-binaries/releases/download/jdk8u392-b08/OpenJDK8U-jdk_x64_windows_hotspot_8u392b08.zip'
JAVA_VERSION: 'OpenJDK8U-jdk_x64_windows_hotspot_8u392b08'
JDK_PATH: 'jdk8u392-b08'
microsoft-open-jdk-11-windows:
JDK_DOWNLOAD_LINK: 'https://aka.ms/download-jdk/microsoft-jdk-11.0.21-windows-x64.zip'
JAVA_VERSION: 'microsoft-jdk-11.0.21-windows-x64'
JDK_PATH: 'jdk-11.0.21+9'
microsoft-open-jdk-17-windows:
JDK_DOWNLOAD_LINK: 'https://aka.ms/download-jdk/microsoft-jdk-17.0.9-windows-x64.zip'
JAVA_VERSION: 'microsoft-jdk-17.0.9-windows-x64'
JDK_PATH: 'jdk-17.0.9+8'
microsoft-open-jdk-21-windows:
JDK_DOWNLOAD_LINK: 'https://aka.ms/download-jdk/microsoft-jdk-21.0.1-windows-x64.zip'
JAVA_VERSION: 'microsoft-jdk-21.0.1-windows-x64'
JDK_PATH: 'jdk-21.0.1+12'

steps:
- task: NuGetToolInstaller@1
inputs:
checkLatest: true
displayName: 'Install NuGet Tool'
- pwsh: |
Get-Command mvn
displayName: 'Check Maven is installed'
- pwsh: |
java -version
displayName: 'Check default java version'
- pwsh: |
.\package-pipeline.ps1 -buildNumber $(buildNumber)
displayName: 'Executing build script'
- task: UseDotNet@2
displayName: 'Install .NET 6'
inputs:
version: 6.0.x
- pwsh: |
Invoke-WebRequest $(JDK_DOWNLOAD_LINK) -OutFile "$(JAVA_VERSION).zip"
Expand-Archive -Force "$(JAVA_VERSION).zip" .
cd $(JDK_PATH)
$current = get-location | select -ExpandProperty Path
cd ..
Write-Host "##vso[task.setvariable variable=JavaHome;]$current"
displayName: 'Download and setup Java for Windows'
- pwsh: |
.\setup-tests-pipeline.ps1
displayName: 'Setup test environment -- Install the Core Tools'
- pwsh: |
$currDir = Get-Location
$Env:Path = $Env:Path+";$currDir/Azure.Functions.Cli"
func --version
displayName: 'Setup Core Tools - Windows'
- pwsh: |
cd ./endtoendtests
mvn clean package `-Dmaven`.javadoc`.skip=true `-Dmaven`.test`.skip `-Dorg`.slf4j`.simpleLogger`.log`.org`.apache`.maven`.cli`.transfer`.Slf4jMavenTransferListener=warn `-B
Copy-Item "confluent_cloud_cacert.pem" "./target/azure-functions/azure-functions-java-endtoendtests"
displayName: 'Package Java for E2E'
- task: DotNetCoreCLI@2
inputs:
command: 'test'
projects: |
endtoendtests/Azure.Functions.Java.Tests.E2E/Azure.Functions.Java.Tests.E2E/Azure.Functions.Java.Tests.E2E.csproj
env:
JAVA_HOME: $(JavaHome)
AzureWebJobsStorage: $(AzureWebJobsStorage)
AzureWebJobsCosmosDBConnectionString: $(AzureWebJobsCosmosDBConnectionString)
AzureWebJobsSqlConnectionString: $(AzureWebJobsSqlConnectionString)
AzureWebJobsServiceBus: $(AzureWebJobsServiceBus)
AzureWebJobsEventHubReceiver: $(AzureWebJobsEventHubReceiver)
AzureWebJobsEventHubSender_2: $(AzureWebJobsEventHubSender_2)
AzureWebJobsEventHubSender: $(AzureWebJobsEventHubSender)
AzureWebJobsEventHubPath: $(AzureWebJobsEventHubPath)
SBTopicName: $(SBTopicName)
SBTopicSubName: $(SBTopicSubName)
CosmosDBDatabaseName: $(CosmosDBDatabaseName)
SBQueueName: $(SBQueueName)
BrokerList": $(BrokerList)
ConfluentCloudUsername: $(ConfluentCloudUsername)
ConfluentCloudPassword: $(ConfluentCloudPassword)
AzureWebJobsEventGridOutputBindingTopicUriString: $(AzureWebJobsEventGridOutputBindingTopicUriString)
AzureWebJobsEventGridOutputBindingTopicKeyString: $(AzureWebJobsEventGridOutputBindingTopicKeyString)
ApplicationInsightAPIKey: $(ApplicationInsightAPIKey)
ApplicationInsightAPPID: $(ApplicationInsightAPPID)
ApplicationInsightAgentVersion: $(ApplicationInsightAgentVersion)
displayName: 'Build & Run tests'
continueOnError: false

0 comments on commit 0debaa3

Please sign in to comment.