Download aro deployer from tagged image

Pull aro deployer from tagged container instead of pipeline artifact.

Signed-off-by: Petr Kotas <pkotas@redhat.com>
This commit is contained in:
Petr Kotas 2021-08-19 12:35:11 +02:00
Родитель 558fc5d024
Коммит 3fbcaee47d
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 9A2182A6A306C71D
1 изменённых файлов: 118 добавлений и 0 удалений

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

@ -0,0 +1,118 @@
# Azure DevOps Job deploying rp
parameters:
aroVersionStorageAccount: ''
azureDevOpsE2EJSONSPN: ''
azureDevOpsJSONSPN: ''
billingE2EPipelineName: ''
billingE2EBranchName: ''
configFileName: ''
e2eSubscription: ''
environment: ''
locations: []
rpMode: ''
vsoProjectID: ''
imageTag: ''
rpImageAcr: ''
jobs:
- ${{ each location in parameters.locations }}:
- deployment: Deploy_${{ location }}
variables:
- template: ../vars.yml
pool:
name: ARO-CI
environment: ${{ parameters.environment }}
strategy:
runOnce:
deploy:
steps:
- ${{ if eq(parameters.imageTag, 'latest') }}:
- checkout: git://AzureRedHatOpenShift/RP-Config@refs/heads/master
path: $(Agent.BuildDirectory)/s/config
- ${{ if ne(parameters.imageTag, 'latest') }}:
- checkout: git://AzureRedHatOpenShift/RP-Config@refs/tags/${{parameters.imageTag}}
path: $(Agent.BuildDirectory)/s/config
- template: ./templates/template-az-cli-login.yml
parameters:
azureDevOpsJSONSPN: $(aro-v4-ci-devops-spn)
- script: |
set -e
trap 'set +e; for c in $(docker ps -aq); do docker rm -f $c; done; docker image prune -af ; rm -rf ~/.docker/config.json' EXIT
export TAG=${{ parameters.imageTag }}
export RP_IMAGE_ACR=${{ parameters.rpImageAcr }}
az acr login --name "${RP_IMAGE_ACR}"
docker pull "${RP_IMAGE_ACR}.azurecr.io/aro:${TAG}"
CONTAINER=$(docker create "${RP_IMAGE_ACR}.azurecr.io/aro:${TAG}")
docker cp $CONTAINER:/usr/local/bin/aro $(System.ArtifactsDirectory)/deployer/aro
displayName: Download aro deployer from image
- template: ./templates/template-az-cli-logout.yml
- template: ./template-deploy-azure-env.yml
parameters:
configDirectory: $(Agent.BuildDirectory)/s/config/deploy
deployerDirectory: $(System.ArtifactsDirectory)/deployer/
configFileName: ${{ parameters.configFileName }}
location: ${{ location }}
azureDevOpsJSONSPN: ${{ parameters.azureDevOpsJSONSPN }}
- job: RP_E2E_${{ location }}
dependsOn: Deploy_${{ location }}
variables:
- template: ../vars.yml
timeoutInMinutes: 120
pool:
name: ARO-CI
steps:
- template: ./template-prod-e2e-steps.yml
parameters:
location: ${{ location }}
subscription: ${{ parameters.e2eSubscription }}
azureDevOpsE2EJSONSPN: ${{ parameters.azureDevOpsE2EJSONSPN }}
aroVersionStorageAccount: ${{ parameters.aroVersionStorageAccount }}
rpMode: ${{ parameters.rpMode }}
- job: Billing_E2E_${{ location }}_Wait
dependsOn: RP_E2E_${{ location }}
timeoutInMinutes: 400
pool: server
steps:
- task: Delay@1
inputs:
delayForMinutes: '360'
- job: ${{ location }}_TriggerBillingBuild
displayName: Trigger Billing E2E pipeline
dependsOn: Billing_E2E_${{ location }}_Wait
steps:
- script: |
# Pass variables between tasks: https://medium.com/microsoftazure/how-to-pass-variables-in-azure-pipelines-yaml-tasks-5c81c5d31763
echo "##vso[task.setvariable variable=REGION]${{ location }}"
CLUSTER="v4-e2e-V$BUILD_BUILDID-${{ location }}"
echo "##vso[task.setvariable variable=CLUSTER]$CLUSTER"
CLUSTER_RESOURCEGROUP="v4-e2e-V$BUILD_BUILDID-${{ location }}"
echo "##vso[task.setvariable variable=CLUSTER_RESOURCEGROUP]$CLUSTER_RESOURCEGROUP"
echo "E2E Cluster Resource Group Name:" $CLUSTER_RESOURCEGROUP
echo "E2E Cluster Name:" $CLUSTER
displayName: Pass variables into next Task
- task: TriggerBuild@3
inputs:
definitionIsInCurrentTeamProject: true
buildDefinition: ${{ parameters.billingE2EPipelineName }}
queueBuildForUserThatTriggeredBuild: true
ignoreSslCertificateErrors: false
useSameSourceVersion: false
useCustomSourceVersion: false
useSameBranch: false
branchToUse: ${{ parameters.billingE2EBranchName }}
waitForQueuedBuildsToFinish: true
storeInEnvironmentVariable: false
buildParameters: CLUSTER_RESOURCEGROUP:$(CLUSTER_RESOURCEGROUP), CLUSTER:$(CLUSTER),
REGION:$(REGION)
authenticationMethod: OAuth Token
password: $(System.AccessToken)
enableBuildInQueueCondition: false
dependentOnSuccessfulBuildCondition: true
dependentOnFailedBuildCondition: true
checkbuildsoncurrentbranch: false
failTaskIfConditionsAreNotFulfilled: true