diff --git a/.pipelines/deploy-azure-env.yml b/.pipelines/deploy-azure-env.yml index 996c34818..ffd8fce00 100644 --- a/.pipelines/deploy-azure-env.yml +++ b/.pipelines/deploy-azure-env.yml @@ -3,17 +3,19 @@ trigger: none pr: none parameters: -- name: location -- name: vsoConfigBuildID -- name: vsoDeployerBuildID - name: fullDeploy type: boolean default: false +- name: location +- name: vsoConfigBuildID +- name: vsoDeployerBuildID jobs: - template: ./templates/template-job-deploy-azure-env.yml parameters: environment: RP-Prod + rpMode: '' + aroVersionStorageAccount: $(aro-version-storage-account) locations: - ${{ parameters.location }} configFileName: $(config-file-name) diff --git a/.pipelines/e2e-with-billing.yml b/.pipelines/e2e-with-billing.yml index 776c535b9..ae209ac4b 100644 --- a/.pipelines/e2e-with-billing.yml +++ b/.pipelines/e2e-with-billing.yml @@ -16,6 +16,8 @@ stages: location: $(LOCATION) subscription: $(e2e-subscription) azureDevOpsE2EJSONSPN: $(aro-v4-e2e-devops-spn) + aroVersionStorageAccount: $(aro-version-storage-account) + rpMode: int - stage: Delay_For_Billing_Table displayName: Wait 6 hours for billing table ready jobs: diff --git a/.pipelines/e2e.yml b/.pipelines/e2e.yml index 19e2e4e67..1f05085a0 100644 --- a/.pipelines/e2e.yml +++ b/.pipelines/e2e.yml @@ -21,8 +21,27 @@ jobs: - template: ./templates/template-push-images-to-acr.yml parameters: rpImageACR: $(RP_IMAGE_ACR) - - template: ./templates/template-az-cli-set-context.yml - - template: ./templates/template-deploy-e2e-db.yml - - template: ./templates/template-run-rp-and-e2e.yml - - template: ./templates/template-clean-e2e-db.yml + - script: | + set -e + set -o pipefail + + . secrets/env + + az account set -s $AZURE_SUBSCRIPTION_ID + + set -x + . ./hack/e2e/run-rp-and-e2e.sh + trap 'set +e; kill_rp; clean_e2e_db' EXIT + + deploy_e2e_db + + run_rp + validate_rp_running + register_sub + + export CI=true + + # Don't override RESOURCEGROUP more widely because clean_e2e_db depends + # on the original value + RESOURCEGROUP=$ARO_RESOURCEGROUP make test-e2e - template: ./templates/template-az-cli-logout.yml diff --git a/.pipelines/int-release.yml b/.pipelines/int-release.yml index 3b7b58486..1d50ea6b1 100644 --- a/.pipelines/int-release.yml +++ b/.pipelines/int-release.yml @@ -11,7 +11,7 @@ parameters: default: latest - name: fullDeploy type: boolean - default: false + default: true stages: - stage: Deploy_INT @@ -21,6 +21,8 @@ stages: - template: ./templates/template-job-deploy-azure-env.yml parameters: environment: RP-INT + rpMode: int + aroVersionStorageAccount: $(aro-version-storage-account) locations: - eastus configFileName: int-config.yaml diff --git a/.pipelines/prod-release.yml b/.pipelines/prod-release.yml index 9e411106e..f32d717b2 100644 --- a/.pipelines/prod-release.yml +++ b/.pipelines/prod-release.yml @@ -3,11 +3,11 @@ pr: none trigger: none parameters: -- name: vsoConfigBuildID -- name: vsoDeployerBuildID - name: fullDeploy type: boolean default: false +- name: vsoConfigBuildID +- name: vsoDeployerBuildID stages: - stage: Deploy_CanarySector @@ -17,6 +17,8 @@ stages: - template: ./templates/template-job-deploy-azure-env.yml parameters: environment: RP-Prod-CanarySector + rpMode: '' + aroVersionStorageAccount: $(aro-version-storage-account) locations: - westcentralus - eastus2euap @@ -40,6 +42,8 @@ stages: - template: ./templates/template-job-deploy-azure-env.yml parameters: environment: RP-Prod-LowTrafficSector + rpMode: '' + aroVersionStorageAccount: $(aro-version-storage-account) locations: - australiaeast - australiasoutheast @@ -68,6 +72,8 @@ stages: - template: ./templates/template-job-deploy-azure-env.yml parameters: environment: RP-Prod-USSector + rpMode: '' + aroVersionStorageAccount: $(aro-version-storage-account) locations: - centralus - eastus @@ -96,6 +102,8 @@ stages: - template: ./templates/template-job-deploy-azure-env.yml parameters: environment: RP-Prod-EuropeSector + rpMode: '' + aroVersionStorageAccount: $(aro-version-storage-account) locations: - canadacentral - canadaeast @@ -126,6 +134,8 @@ stages: - template: ./templates/template-job-deploy-azure-env.yml parameters: environment: RP-Prod-ROWSector + rpMode: '' + aroVersionStorageAccount: $(aro-version-storage-account) locations: - brazilsouth - southeastasia diff --git a/.pipelines/templates/template-az-cli-set-context.yml b/.pipelines/templates/template-az-cli-set-context.yml deleted file mode 100644 index 5ef3acee0..000000000 --- a/.pipelines/templates/template-az-cli-set-context.yml +++ /dev/null @@ -1,9 +0,0 @@ -parameters: - azureDevOpsJSONSPN: '' -steps: -- script: | - . secrets/env - set -x - . ./hack/e2e/run-rp-and-e2e.sh - set_cli_context - displayName: โš™๏ธ AZ Context Setup diff --git a/.pipelines/templates/template-clean-e2e-db.yml b/.pipelines/templates/template-clean-e2e-db.yml deleted file mode 100644 index f3be60260..000000000 --- a/.pipelines/templates/template-clean-e2e-db.yml +++ /dev/null @@ -1,10 +0,0 @@ -steps: -- script: | - . secrets/env - - set -x - . ./hack/e2e/run-rp-and-e2e.sh - - clean_e2e_db - displayName: ๐Ÿงน Clean cluster DB - condition: and(always(), eq(variables['RP_MODE'], 'development')) diff --git a/.pipelines/templates/template-clean-subscription.yml b/.pipelines/templates/template-clean-subscription.yml index 92181caa8..6f23c2241 100644 --- a/.pipelines/templates/template-clean-subscription.yml +++ b/.pipelines/templates/template-clean-subscription.yml @@ -1,10 +1,10 @@ parameters: + dryRun: '' purgeTTL: '' purgeCreatedTag: '' + resourceGroupDeletePrefixes: '' subscriptionCredentialsJSON: '' subscriptionId: '' - dryRun: '' - resourceGroupDeletePrefixes: '' steps: - script: | diff --git a/.pipelines/templates/template-deploy-azure-env.yml b/.pipelines/templates/template-deploy-azure-env.yml index f84aa961b..f78893b7f 100644 --- a/.pipelines/templates/template-deploy-azure-env.yml +++ b/.pipelines/templates/template-deploy-azure-env.yml @@ -1,10 +1,11 @@ parameters: - location: '' - configDirectory: '' - deployerDirectory: '' - configFileName: '' azureDevOpsJSONSPN: '' + configDirectory: '' + configFileName: '' + deployerDirectory: '' fullDeploy: '' + location: '' + steps: - script: | set -eu diff --git a/.pipelines/templates/template-deploy-e2e-db.yml b/.pipelines/templates/template-deploy-e2e-db.yml deleted file mode 100644 index 97ac05a02..000000000 --- a/.pipelines/templates/template-deploy-e2e-db.yml +++ /dev/null @@ -1,10 +0,0 @@ -steps: -- script: | - . secrets/env - - set -x - . ./hack/e2e/run-rp-and-e2e.sh - - deploy_e2e_db - displayName: ๐Ÿš€ Deploy custom RP DB - condition: eq(variables['RP_MODE'], 'development') diff --git a/.pipelines/templates/template-deploy-shared-env.yml b/.pipelines/templates/template-deploy-shared-env.yml index 842b1b58e..ab9afb111 100644 --- a/.pipelines/templates/template-deploy-shared-env.yml +++ b/.pipelines/templates/template-deploy-shared-env.yml @@ -1,6 +1,7 @@ parameters: - subscriptionID: '' azureDevOpsJSONSPN: '' + subscriptionID: '' + steps: - script: | set -e diff --git a/.pipelines/templates/template-job-deploy-azure-env.yml b/.pipelines/templates/template-job-deploy-azure-env.yml index a4635dd5e..b681bf093 100644 --- a/.pipelines/templates/template-job-deploy-azure-env.yml +++ b/.pipelines/templates/template-job-deploy-azure-env.yml @@ -1,19 +1,21 @@ # Azure DevOps Job deploying rp parameters: - environment: '' - locations: [] - configFileName: '' + aroVersionStorageAccount: '' + azureDevOpsE2EJSONSPN: '' azureDevOpsJSONSPN: '' + billingE2EPipelineName: '' + billingE2EBranchName: '' + configFileName: '' + e2eSubscription: '' + environment: '' + fullDeploy: '' + locations: [] + rpMode: '' vsoProjectID: '' vsoConfigPipelineID: '' vsoConfigBuildID: '' vsoDeployerPipelineID: '' vsoDeployerBuildID: '' - azureDevOpsE2EJSONSPN: '' - e2eSubscription: '' - billingE2EPipelineName: '' - billingE2EBranchName: '' - fullDeploy: '' jobs: - ${{ each location in parameters.locations }}: @@ -76,6 +78,8 @@ jobs: 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 diff --git a/.pipelines/templates/template-prod-e2e-steps.yml b/.pipelines/templates/template-prod-e2e-steps.yml index 3406ae4b0..f9104bc06 100644 --- a/.pipelines/templates/template-prod-e2e-steps.yml +++ b/.pipelines/templates/template-prod-e2e-steps.yml @@ -1,29 +1,56 @@ parameters: - location: '' - subscription: '' + aroVersionStorageAccount: '' azureDevOpsE2EJSONSPN: '' + location: '' + rpMode: '' + subscription: '' steps: -# TODO(mj) we need to checkout code to run tooling like kubeconfig. This should go away once we refactor everything into golang. -- template: ./template-checkout.yml -- template: ./template-az-cli-login.yml - parameters: - azureDevOpsJSONSPN: ${{ parameters.azureDevOpsE2EJSONSPN }} - script: | set -e export LOCATION=${{ parameters.location }} export AZURE_SUBSCRIPTION_ID=${{ parameters.subscription }} - trap 'rm -f devops-spn.json' EXIT + trap 'set +e; rm -f devops-spn.json ; for c in $(docker ps -aq); do docker rm -f $c; done; docker image prune -af; rm -rf ~/.docker/config.json' EXIT base64 -d >devops-spn.json <<<${{ parameters.azureDevOpsE2EJSONSPN }} export AZURE_CLIENT_ID=$(jq -r .clientId