Update OB Build Pipeline to Pass Build Tag as Var (#2011)

* adding release_tag functionality to support releasing by tag or commit
This commit is contained in:
mikeandescavage 2022-03-24 15:05:09 -07:00 коммит произвёл GitHub
Родитель 3466d2a65d
Коммит 93b714bcb3
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
4 изменённых файлов: 42 добавлений и 29 удалений

Просмотреть файл

@ -47,20 +47,6 @@ extends:
suppressionSet: default
stages:
- stage: Build_Docker_Image
jobs:
- job: Build_Docker_Image
pool:
type: docker
os: linux
variables:
ob_git_checkout: true
steps:
- template: .pipelines/onebranch/templates/template-buildrp-builddocker.yml@self
- stage: Build_ARO
jobs:
- job: Build_ARO
@ -72,3 +58,18 @@ extends:
steps:
- template: .pipelines/onebranch/templates/template-buildrp-buildaro.yml@self
- stage: Build_Docker_Image
dependsOn: Build_ARO
jobs:
- job: Build_Docker_Image
pool:
type: docker
os: linux
variables:
ob_git_checkout: true
release_tag: $[stageDependencies.Build_ARO.Build_ARO.outputs['buildaro.releasetag']]
steps:
- template: .pipelines/onebranch/templates/template-buildrp-builddocker.yml@self

Просмотреть файл

@ -47,20 +47,6 @@ extends:
suppressionSet: default
stages:
- stage: Build_Docker_Image
jobs:
- job: Build_Docker_Image
pool:
type: docker
os: linux
variables:
ob_git_checkout: true
steps:
- template: .pipelines/onebranch/templates/template-buildrp-builddocker.yml@self
- stage: Build_ARO
jobs:
- job: Build_ARO
@ -72,3 +58,18 @@ extends:
steps:
- template: .pipelines/onebranch/templates/template-buildrp-buildaro.yml@self
- stage: Build_Docker_Image
dependsOn: Build_ARO
jobs:
- job: Build_Docker_Image
pool:
type: docker
os: linux
variables:
ob_git_checkout: true
release_tag: $[stageDependencies.Build_ARO.Build_ARO.outputs['buildaro.releasetag']]
steps:
- template: .pipelines/onebranch/templates/template-buildrp-builddocker.yml@self

Просмотреть файл

@ -5,6 +5,16 @@ steps:
targetType: inline
script: |
export GOPATH=$(Agent.TempDirectory)
export TAG=$(git describe --exact-match 2>/dev/null)
export COMMIT=$(git rev-parse --short=7 HEAD)$([[ $(git status --porcelain) = "" ]] || echo -dirty)
if [ -z "$TAG" ];
then
export VERSION=${COMMIT}
else
export VERSION=${TAG}
fi
echo "Version: ${VERSION}"
echo "##vso[task.setvariable variable=releasetag;isOutput=true]${VERSION}"
mkdir -p $(Agent.TempDirectory)/src/github.com/Azure/
cp -rd $(Build.SourcesDirectory) $(Agent.TempDirectory)/src/github.com/Azure/ARO-RP
cd $(Agent.TempDirectory)/src/github.com/Azure/ARO-RP
@ -12,6 +22,7 @@ steps:
mkdir -p $(ob_outputDirectory)
cp aro $(ob_outputDirectory)/aro
workingDirectory: $(Build.SourcesDirectory)
name: buildaro
- task: Bash@3
displayName: 🕵️ Validate FIPS
inputs:

Просмотреть файл

@ -9,4 +9,4 @@ steps:
saveImageToPath: aro-rp.tar
buildkit: 1
enable_network: true
build_tag: $(Build.SourceBranchName)
build_tag: $(release_tag)