Update deployment pipeline for config (#342)

* download deployer and config from artifacts from different pipelines. switch to using config for deployment

* removing orphaned file to generate arm template parameters

* marking aro as executable

* setting up workspace

* adding environment variables that deployer requires to be set. even though they aren't used

* renaming from prod to azure.

* removing RP_VERSION assignment. It is no longer needed

* removing enviroment variable exports for location and rg because they are now in config
This commit is contained in:
Jack 2020-03-26 17:17:38 -07:00 коммит произвёл GitHub
Родитель 8b57b7cda9
Коммит 1dbdaeabc2
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
5 изменённых файлов: 69 добавлений и 152 удалений

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

@ -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)

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

@ -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"

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

@ -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"

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

@ -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"

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

@ -1,49 +0,0 @@
#!/bin/bash -e
mkdir -p secrets
cat >secrets/parameters.json <<EOF
{
"\$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"adminApiCaBundle": {
"value": "$ADMIN_API_CA_BUNDLE"
},
"adminApiClientCertCommonName": {
"value": "$ADMIN_API_CLIENT_CERT_COMMON_NAME"
},
"databaseAccountName": {
"value": "$COSMOSDB_ACCOUNT"
},
"domainName": {
"value": "$DOMAIN_NAME"
},
"fpServicePrincipalId": {
"value": "$AZURE_FP_CLIENT_ID"
},
"keyvaultPrefix": {
"value": "$KEYVAULT_PREFIX"
},
"acrResourceId": {
"value": "$ACR_RESOURCE_ID"
},
"rpImage": {
"value": "$RP_IMAGE"
},
"mdmFrontendUrl": {
"value": "$MDM_FRONTEND"
},
"mdsdConfigVersion": {
"value": "$MDSD_CONFIG_VERSION"
},
"mdsdEnvironment": {
"value": "$MDSD_ENVIROMENT"
},
"rpMode": {
"value": "$RP_MODE"
},
"sshPublicKey": {
"value": "$SSH_PUBLIC_KEY"
}
}
}
EOF