diff --git a/.pipelines/deploy-azure-env.yml b/.pipelines/deploy-azure-env.yml new file mode 100644 index 000000000..15e9605ac --- /dev/null +++ b/.pipelines/deploy-azure-env.yml @@ -0,0 +1,47 @@ +# Azure DevOps Pipeline deploying the azure hosted environment +trigger: none +pr: none + +variables: + - template: vars.yml + +jobs: + - job: "Deploy" + pool: + vmImage: "ubuntu-latest" + steps: + - template: ./templates/template-setup-golang-env.yml + parameters: + gobin: ${{ variables.GOBIN }} + gopath: ${{ variables.GOPATH }} + goroot: ${{ variables.GOROOT }} + modulePath: ${{ variables.modulePath }} + - task: DownloadBuildArtifacts@0 + inputs: + buildType: 'specific' + project: '5d69ab04-7ded-49dc-84d5-bbbcac4add8d' + pipeline: '129296' + buildVersionToDownload: 'latestFromBranch' + branchName: 'refs/heads/master' + downloadType: 'specific' + downloadPath: '$(System.ArtifactsDirectory)/config' + displayName: "Download Config" + - task: DownloadBuildArtifacts@0 + inputs: + buildType: 'specific' + project: '5d69ab04-7ded-49dc-84d5-bbbcac4add8d' + pipeline: '120903' + buildVersionToDownload: 'latestFromBranch' + branchName: 'refs/heads/master' + downloadType: 'specific' + downloadPath: '$(System.ArtifactsDirectory)/deployer' + displayName: "Download Deployer" + - template: ./templates/template-deploy-prod-env.yml + parameters: + workingDirectory: $(system.defaultWorkingDirectory) + configDirectory: '$(System.ArtifactsDirectory)/config/drop/deploy' + deployerDirectory: '$(System.ArtifactsDirectory)/deployer/drop' + configFileName: $(CONFIG_FILE_NAME) + location: $(LOCATION) + azureDevOpsJSONSPN: $(aro-v4-ci-devops-spn) + diff --git a/.pipelines/deploy-int-env.yml b/.pipelines/deploy-int-env.yml deleted file mode 100644 index 1d693ced6..000000000 --- a/.pipelines/deploy-int-env.yml +++ /dev/null @@ -1,41 +0,0 @@ -# Azure DevOps Pipeline deploying the int environment -trigger: none -pr: none - -variables: - - template: vars.yml - -jobs: - - job: "Deploy_int_env_or_build" - pool: - vmImage: "ubuntu-latest" - steps: - - template: ./templates/template-setup-golang-env.yml - parameters: - gobin: ${{ variables.GOBIN }} - gopath: ${{ variables.GOPATH }} - goroot: ${{ variables.GOROOT }} - modulePath: ${{ variables.modulePath }} - - script: | - make aro - displayName: "⚙️ Building ARO Deployer Golang binary" - workingDirectory: "${{ variables.modulePath }}" - - template: ./templates/template-deploy-int-env.yml - parameters: - workingDirectory: ${{ variables.modulePath }} - domainName: "aro-int.dev.aroapp.io" - azureFpClientId: $(aro-int-rp-object-id) - location: "eastus" - rgPrefix: "aro-int" - mdmFrontendUrl: "https://int2.int.microsoftmetrics.com/" - rpImageACR: $(RP_IMAGE_ACR) - rpImagePullJSONSPN: $(aro-v4-int-image-pull-spn) - mdsdMonitoringEnviroment: "Test" - mdsdConfigVersion: $(MDSD-CONFIG-VERSION) - rpMode: "int" - acrResourceId: "/subscriptions/0cc1cafa-578f-4fa5-8d6b-ddfd8d82e6ea/resourceGroups/global-infra/providers/Microsoft.ContainerRegistry/registries/arointsvc" - sshPublicKey: $(int-ssh-public-key) - subscriptionId: "0cc1cafa-578f-4fa5-8d6b-ddfd8d82e6ea" - azureDevOpsJSONSPN: $(aro-v4-ci-devops-spn) - adminApiCaBundle: $(aro-geneva-action-cert-ca-bundle) - adminApiClientCertCommonName: "actions.int.aro.azure.com" diff --git a/.pipelines/templates/template-deploy-azure-env.yml b/.pipelines/templates/template-deploy-azure-env.yml new file mode 100644 index 000000000..4feaf63ff --- /dev/null +++ b/.pipelines/templates/template-deploy-azure-env.yml @@ -0,0 +1,22 @@ +parameters: + workingDirectory: "" + location: "" + configDirectory: "" + deployerDirectory: "" + configFileName: "" + azureDevOpsJSONSPN: "" +steps: + - script: | + set -eu + cd ${{ parameters.workingDirectory }} + + echo ${{ parameters.azureDevOpsJSONSPN }} | base64 -d -w 0 > devops-spn.json + export AZURE_SUBSCRIPTION_ID="${{ parameters.subscriptionId }}" + export AZURE_CLIENT_ID=$(cat devops-spn.json | jq -r '.clientId') + export AZURE_CLIENT_SECRET=$(cat devops-spn.json | jq -r '.clientSecret') + export AZURE_TENANT_ID=$(cat devops-spn.json | jq -r '.tenantId') + rm devops-spn.json + + chmod +x ${{ parameters.deployerDirectory }}/aro + ${{ parameters.deployerDirectory }}/aro deploy ${{ parameters.configDirectory }}/${{ parameters.configFileName }} ${{ parameters.location }} + displayName: "🚀 Buildout/Deploy env" diff --git a/.pipelines/templates/template-deploy-int-env.yml b/.pipelines/templates/template-deploy-int-env.yml deleted file mode 100644 index 751d423bd..000000000 --- a/.pipelines/templates/template-deploy-int-env.yml +++ /dev/null @@ -1,62 +0,0 @@ -parameters: - domainName: "" - rgPrefix: "" - workingDirectory: "" - location: "" - mdmFrontendUrl: "" - rpImageACR: "" - rpImagePullJSONSPN: "" - azureFpClientId: "" - azureDevOpsJSONSPN: "" - mdsdMonitoringEnviroment: "" - mdsdConfigVersion: "" - rpMode: "" - sshPublicKey: "" - acrResourceId: "" - subscriptionId: "" - adminApiCaBundle: "" - adminApiClientCertCommonName: "" -steps: - - script: | - set -eu - cd ${{ parameters.workingDirectory }} - - COMMIT=$(git rev-parse --short HEAD)$([[ $(git status --porcelain) = "" ]] || echo -dirty) - - echo ${{ parameters.rpImagePullJSONSPN }} | base64 -d -w 0 > pull-spn.json - pull_spn_client_id=$(cat pull-spn.json | jq -r '.clientId') - pull_spn_client_secret=$(cat pull-spn.json | jq -r '.clientSecret') - export RP_IMAGE_AUTH=$(echo "$pull_spn_client_id:$pull_spn_client_secret" | base64 -w 0) - rm pull-spn.json - - export DOMAIN_NAME=${{ parameters.domainName }} - export AZURE_FP_CLIENT_ID=${{ parameters.azureFpClientId }} - export COSMOSDB_ACCOUNT=${{ parameters.databaseAccountName }} - export MDM_FRONTEND=${{ parameters.mdmFrontendUrl }} - export MDSD_ENVIROMENT=${{ parameters.mdsdMonitoringEnviroment }} - export MDSD_CONFIG_VERSION=${{ parameters.mdsdConfigVersion }} - export RP_IMAGE=${{ parameters.rpImageACR }}.azurecr.io/aro:${COMMIT} - RESOURCEGROUP_PREFIX=${{ parameters.rgPrefix }} - export LOCATION=${{ parameters.location }} - export RESOURCEGROUP="$RESOURCEGROUP_PREFIX-$LOCATION" - export COSMOSDB_ACCOUNT="$RESOURCEGROUP" - export KEYVAULT_PREFIX="$RESOURCEGROUP" - export RP_MODE=${{ parameters.rpMode }} - export SSH_PUBLIC_KEY="${{ parameters.sshPublicKey }}" - export ADMIN_API_CA_BUNDLE="${{ parameters.adminApiCaBundle }}" - export ADMIN_API_CLIENT_CERT_COMMON_NAME="${{ parameters.adminApiClientCertCommonName }}" - - echo ${{ parameters.azureDevOpsJSONSPN }} | base64 -d -w 0 > devops-spn.json - export AZURE_SUBSCRIPTION_ID="${{ parameters.subscriptionId }}" - export AZURE_CLIENT_ID=$(cat devops-spn.json | jq -r '.clientId') - export AZURE_CLIENT_SECRET=$(cat devops-spn.json | jq -r '.clientSecret') - export AZURE_TENANT_ID=$(cat devops-spn.json | jq -r '.tenantId') - export ACR_RESOURCE_ID="${{ parameters.acrResourceId }}" - rm devops-spn.json - - ./hack/deploy/prepare-int-parameters.sh - - export RP_PARAMETERS_FILE="secrets/parameters.json" - export RP_VERSION=$(git rev-parse --short HEAD) - ./aro deploy - displayName: "🚀 Buildout INT env" diff --git a/hack/deploy/prepare-int-parameters.sh b/hack/deploy/prepare-int-parameters.sh deleted file mode 100755 index 076b6dcdd..000000000 --- a/hack/deploy/prepare-int-parameters.sh +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/bash -e -mkdir -p secrets -cat >secrets/parameters.json <