2020-06-12 16:59:51 -04:00
|
|
|
trigger:
|
|
|
|
- release
|
|
|
|
|
|
|
|
pr: none
|
|
|
|
|
|
|
|
pool:
|
2021-10-08 13:24:33 -04:00
|
|
|
vmImage: "ubuntu-latest"
|
2020-06-12 16:59:51 -04:00
|
|
|
|
|
|
|
variables:
|
|
|
|
VERSION:
|
|
|
|
|
2023-02-01 11:00:18 -05:00
|
|
|
jobs:
|
|
|
|
- job: check_release_notes
|
|
|
|
timeoutInMinutes: 5
|
|
|
|
steps:
|
|
|
|
- task: Bash@3
|
|
|
|
# Checks if the release notes file is populated. Exits if it is not.
|
|
|
|
inputs:
|
|
|
|
targetType: 'inline'
|
|
|
|
script: |
|
|
|
|
if [ -n "$(cmp RELEASE_NOTES.md RELEASE_NOTES.template.md)" ]
|
|
|
|
then
|
|
|
|
echo "RELEASE_NOTES.md has changed, proceeding to next step"
|
|
|
|
else
|
|
|
|
echo "Your RELEASE_NOTES.md file is unchanged. Please provide release notes before creating a release."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
displayName: Checks if the release notes file is populated.
|
|
|
|
- job: get_release_version
|
|
|
|
timeoutInMinutes: 5
|
|
|
|
steps:
|
2023-02-01 11:09:11 -05:00
|
|
|
- task: PowerShell@2
|
|
|
|
# This task pulls the <version> value from the hapi-fhir project pom.xml file. All modules are released as
|
|
|
|
# the same version, at the same time, as defined in the root level pom.xml.
|
|
|
|
inputs:
|
|
|
|
targetType: 'inline'
|
|
|
|
script: |
|
|
|
|
[xml]$pomXml = Get-Content -Path .\pom.xml
|
|
|
|
# version
|
|
|
|
Write-Host $pomXml.project.version
|
2023-02-01 13:16:26 -05:00
|
|
|
$VERSION=$pomXml.project.version
|
2023-02-01 13:40:03 -05:00
|
|
|
Write-Host "##vso[task.setvariable variable=version_from_pom;isOutput=true;]$VERSION"
|
2023-02-01 11:09:11 -05:00
|
|
|
displayName: Save pom file version to local variable.
|
2023-02-01 13:49:34 -05:00
|
|
|
name: setOutput
|
2023-02-01 11:00:18 -05:00
|
|
|
- task: Bash@3
|
|
|
|
# Prints out the build version, for debugging purposes
|
|
|
|
inputs:
|
|
|
|
targetType: 'inline'
|
|
|
|
script: |
|
2023-02-01 13:40:03 -05:00
|
|
|
echo Pulled version from pom.xml => $(setOutput.version_from_pom)
|
2023-02-01 11:00:18 -05:00
|
|
|
displayName: Debug print release version
|
|
|
|
- task: Bash@3
|
|
|
|
# Azure pipelines cannot pass variables between pipelines, but it can pass files, so we
|
|
|
|
# pass the build id (ex: 1.1.13-SNAPSHOT) as a string in a file.
|
|
|
|
# This is used in the release pipeline, so we create it here.
|
|
|
|
inputs:
|
|
|
|
targetType: 'inline'
|
|
|
|
script: |
|
2023-02-01 13:44:27 -05:00
|
|
|
echo $(setOutput.version_from_pom)
|
|
|
|
VERSION=$(setOutput.version_from_pom)
|
2023-02-01 13:53:49 -05:00
|
|
|
echo "$VERSION" > $(System.DefaultWorkingDirectory)/VERSION
|
2023-02-01 13:16:26 -05:00
|
|
|
displayName: Save Release Version to File
|
2023-02-01 11:00:18 -05:00
|
|
|
- task: CopyFiles@2
|
|
|
|
# Copies the VERSION file containing the build id (ex: 1.1.13-SNAPSHOT) to the staging directory
|
|
|
|
# This is done for release versions only.
|
|
|
|
inputs:
|
|
|
|
SourceFolder: '$(System.Defaultworkingdirectory)'
|
|
|
|
Contents: "$(System.DefaultWorkingDirectory)/VERSION"
|
|
|
|
TargetFolder: '$(build.artifactstagingdirectory)'
|
|
|
|
displayName: 'Copy Files to: $(build.artifactstagingdirectory)'
|
2023-02-01 16:45:41 -05:00
|
|
|
- task: PublishBuildArtifacts@1
|
|
|
|
displayName: 'Publish Build Artifacts'
|
|
|
|
inputs:
|
|
|
|
PathtoPublish: '$(build.artifactstagingdirectory)'
|
2023-02-01 11:00:18 -05:00
|
|
|
- job: get_branch_id
|
|
|
|
timeoutInMinutes: 5
|
|
|
|
steps:
|
|
|
|
- task: PowerShell@2
|
|
|
|
# This task pulls the branch name from the azure build environment and sets as a job-level variable.
|
|
|
|
inputs:
|
|
|
|
targetType: 'inline'
|
|
|
|
script: |
|
2023-02-01 13:26:31 -05:00
|
|
|
$BRANCH = '$(Build.SourceBranchName)'
|
|
|
|
Write-Host "##vso[task.setvariable variable=branch_name]$BRANCH"
|
2023-02-01 11:00:18 -05:00
|
|
|
displayName: Save branch name to local variable.
|
|
|
|
- task: Bash@3
|
|
|
|
# Prints out the branch name, for debugging purposes
|
|
|
|
inputs:
|
|
|
|
targetType: 'inline'
|
|
|
|
script: echo Current branch name => $(branch_name)
|
|
|
|
displayName: Print out the branch name.
|
|
|
|
- task: Bash@3
|
|
|
|
# Azure pipelines cannot pass variables between pipelines, but it can pass files, so we
|
|
|
|
# pass the branch name (ex: rel_2022_05) as a string in a file.
|
|
|
|
# This is used in the release pipeline, so we create it here.
|
|
|
|
inputs:
|
|
|
|
targetType: 'inline'
|
|
|
|
script: |
|
|
|
|
echo $(branch_name)
|
|
|
|
BRANCH=$(branch_name)
|
|
|
|
echo "$BRANCH" > $(System.DefaultWorkingDirectory)/BRANCH
|
|
|
|
displayName: Save branch name to file.
|
|
|
|
- task: CopyFiles@2
|
|
|
|
# Copies the BRANCH file containing the pom version to the staging directory
|
|
|
|
inputs:
|
|
|
|
SourceFolder: '$(System.Defaultworkingdirectory)'
|
|
|
|
Contents: "$(System.DefaultWorkingDirectory)/BRANCH"
|
|
|
|
TargetFolder: '$(build.artifactstagingdirectory)'
|
|
|
|
displayName: Copy the branch name file to the artifact staging directory.
|
2023-02-01 16:45:41 -05:00
|
|
|
# Publishes the files we've moved into the staging directory, so they can be accessed by the
|
|
|
|
# release pipeline.
|
|
|
|
- task: PublishBuildArtifacts@1
|
|
|
|
displayName: 'Publish Build Artifacts'
|
|
|
|
inputs:
|
|
|
|
PathtoPublish: '$(build.artifactstagingdirectory)'
|
2023-02-01 15:32:48 -05:00
|
|
|
- job: build_and_publish_artifacts
|
2023-02-01 11:00:18 -05:00
|
|
|
# We're going to do a full build, including all unit and intergration tests. We do this here, before any
|
2023-02-01 15:31:10 -05:00
|
|
|
# actual release pipeline kicks off, and we don't do it again at any point in the release pipeline. The assumption here
|
2023-02-01 11:00:18 -05:00
|
|
|
# is that once we pull the code, it won't change again on this branch until the release is complete. We
|
|
|
|
# want to fail fast if there is an issue, and avoid running the tests more than once so it doesn't take all day.
|
|
|
|
timeoutInMinutes: 360
|
2023-02-01 11:11:48 -05:00
|
|
|
dependsOn: ['get_release_version', 'get_branch_id', 'check_release_notes']
|
2023-02-01 15:31:10 -05:00
|
|
|
variables:
|
|
|
|
version_from_pom: $[ dependencies.get_release_version.outputs['setOutput.version_from_pom'] ]
|
2023-02-01 11:00:18 -05:00
|
|
|
steps:
|
|
|
|
# Runs 'mvn clean package'
|
|
|
|
- task: Maven@3
|
|
|
|
inputs:
|
|
|
|
mavenPomFile: 'pom.xml'
|
2023-04-04 21:09:48 -04:00
|
|
|
mavenOptions: '-Xmx768m -Dmaven.resolver.transport=wagon'
|
2023-02-01 11:00:18 -05:00
|
|
|
javaHomeOption: 'JDKVersion'
|
|
|
|
jdkVersionOption: '1.11'
|
|
|
|
jdkArchitectureOption: 'x64'
|
|
|
|
publishJUnitResults: true
|
|
|
|
testResultsFiles: '**/surefire-reports/TEST-*.xml'
|
|
|
|
goals: 'package'
|
2023-02-01 15:31:10 -05:00
|
|
|
# Publishes the built Validator jar to build artifacts. Primarily for testing and debugging builds.
|
2023-02-01 11:00:18 -05:00
|
|
|
- task: PublishPipelineArtifact@1
|
|
|
|
displayName: 'Publish Validator jar'
|
|
|
|
inputs:
|
2023-02-01 11:56:18 -05:00
|
|
|
targetPath: "$(System.DefaultWorkingDirectory)/org.hl7.fhir.validation/target/org.hl7.fhir.validation-$(version_from_pom).jar"
|
2023-02-01 11:00:18 -05:00
|
|
|
artifactName: Validator
|
2023-02-01 15:31:10 -05:00
|
|
|
# Publishes the files we've moved into the staging directory, so they can be accessed by the
|
|
|
|
# release pipeline.
|
2023-02-01 11:00:18 -05:00
|
|
|
- task: PublishBuildArtifacts@1
|
|
|
|
displayName: 'Publish Build Artifacts'
|
|
|
|
inputs:
|
|
|
|
PathtoPublish: '$(build.artifactstagingdirectory)'
|