ARO-RP/.pipelines/templates/template-job-deploy-azure-e...

118 строки
4.6 KiB
YAML

# 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
demands: go-1.17
environment: ${{ parameters.environment }}
strategy:
runOnce:
deploy:
steps:
- ${{ if eq(parameters.imageTag, 'latest') }}:
- checkout: git://AzureRedHatOpenShift/RP-Config@refs/heads/master
- ${{ if ne(parameters.imageTag, 'latest') }}:
- checkout: git://AzureRedHatOpenShift/RP-Config@refs/tags/${{parameters.imageTag}}
- template: ./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; rm -rf /run/user/$(id -u $USERNAME)/containers/auth.json' EXIT
export TAG=${{ parameters.imageTag }}
export RP_IMAGE_ACR=${{ parameters.rpImageAcr }}
az acr login --name "${RP_IMAGE_ACR}"
mkdir -p $(System.ArtifactsDirectory)/deployer/
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: ./template-az-cli-logout.yml
- template: ./template-deploy-azure-env.yml
parameters:
configDirectory: $(Agent.BuildDirectory)/s/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