Add Standalone Azure Pipeline
This commit is contained in:
Родитель
80491af01e
Коммит
8cfb69345b
|
@ -82,7 +82,7 @@ jobs:
|
|||
cd enterprise_scale/construction_sets/aks/online/aks_secure_baseline/standalone
|
||||
configuration_folder=configuration
|
||||
parameter_files=$(find $configuration_folder -not -path "*launchpad*" | grep .tfvars | sed 's/.*/-var-file &/' | xargs)
|
||||
eval terraform destroy ${parameter_files} -auto-approve
|
||||
eval terraform destroy ${parameter_files} -var tags='{testing_job_id='"$ENVIRONMENT"'}' -auto-approve
|
||||
|
||||
purge:
|
||||
name: purge
|
||||
|
|
|
@ -14,344 +14,63 @@ stages:
|
|||
displayName: "Deploy Standalone"
|
||||
|
||||
steps:
|
||||
- task: AzureCLI@2
|
||||
displayName: Deploy Standalone
|
||||
name: deploy_launchpad
|
||||
inputs:
|
||||
azureSubscription: $(AZURE_SERVICE_NAME)
|
||||
scriptLocation: inlineScript
|
||||
scriptType: bash
|
||||
inlineScript: |
|
||||
echo "ENVIRONMENT"
|
||||
echo $ENVIRONMENT
|
||||
cp -rs $(Build.SourcesDirectory)/* /tf/caf && cp -r $(Build.SourcesDirectory)/.devcontainer /tf/caf/
|
||||
/tf/caf/enterprise_scale/construction_sets/aks/online/aks_secure_baseline/landingzone/scripts/launchpad.sh
|
||||
env:
|
||||
ARM_CLIENT_SECRET: $(ARM_CLIENT_SECRET)
|
||||
- task: TerraformInstaller@0
|
||||
inputs:
|
||||
terraformVersion: '1.0.0'
|
||||
terraformVersion: '1.0.3'
|
||||
- task: AzureCLI@2
|
||||
displayName: Launchpad Test
|
||||
displayName: Deploy Standalone
|
||||
name: deploy_standalone
|
||||
inputs:
|
||||
azureSubscription: $(AZURE_SERVICE_NAME)
|
||||
scriptLocation: inlineScript
|
||||
scriptType: bash
|
||||
inlineScript: |
|
||||
pwd
|
||||
cd enterprise_scale/construction_sets/aks/online/aks_secure_baseline/standalone/
|
||||
configuration_folder=configuration
|
||||
parameter_files=$(find $configuration_folder -not -path "*launchpad*" | grep .tfvars | sed 's/.*/-var-file &/' | xargs)
|
||||
terraform init -upgrade
|
||||
eval terraform apply ${parameter_files} -var tags='{testing_job_id='"$ENVIRONMENT"'}' -auto-approve
|
||||
env:
|
||||
ARM_CLIENT_SECRET: $(ARM_CLIENT_SECRET)
|
||||
- task: AzureCLI@2
|
||||
displayName: Standalone Test
|
||||
name: test
|
||||
inputs:
|
||||
azureSubscription: $(AZURE_SERVICE_NAME)
|
||||
scriptLocation: inlineScript
|
||||
scriptType: bash
|
||||
inlineScript: |
|
||||
cd /tf/caf/enterprise_scale/construction_sets/aks/online/aks_secure_baseline/test
|
||||
export ACTION="output -json -o /tf/caf/rover.output"
|
||||
/tf/caf/enterprise_scale/construction_sets/aks/online/aks_secure_baseline/landingzone/scripts/launchpad.sh
|
||||
prefix_output=$(cat /tf/caf/rover.output | jq -r .objects.value.launchpad.global_settings.prefixes[0])
|
||||
echo $prefix_output
|
||||
export PREFIX=$prefix_output
|
||||
echo "##vso[task.setvariable variable=PREFIX;isOutput=true]$prefix_output"
|
||||
go test -v launchpad/launchpad_test.go
|
||||
pwd
|
||||
cd enterprise_scale/construction_sets/aks/online/aks_secure_baseline/standalone/
|
||||
ls -lta
|
||||
export ARM_SUBSCRIPTION_ID=$(az account show --query id -o tsv)
|
||||
export PREFIX=$(terraform output -json | jq -r '.global_settings.value.prefixes[0]')
|
||||
echo $(terraform output -json | jq -r .aks_clusters_kubeconfig.value.cluster_re1.aks_kubeconfig_admin_cmd) | bash
|
||||
|
||||
cd ../test
|
||||
go mod tidy
|
||||
go test -v shared_services/shared_services_test.go
|
||||
go test -v aks/aks_test.go
|
||||
go test -v flux/flux_test.go
|
||||
env:
|
||||
ARM_CLIENT_SECRET: $(ARM_CLIENT_SECRET)
|
||||
|
||||
- stage: deploy_level1
|
||||
jobs:
|
||||
- job: deploy_shared_services
|
||||
displayName: "Deploy Shared Services. Level 1"
|
||||
container: rover
|
||||
variables:
|
||||
prefix: $[stageDependencies.deploy_launchpad.deploy_launchpad.outputs['test.PREFIX']]
|
||||
|
||||
steps:
|
||||
- task: AzureCLI@2
|
||||
displayName: Deploy Shared Services
|
||||
name: deploy_shared_services
|
||||
displayName: Destroy Standalone
|
||||
name: destroy_standalone
|
||||
inputs:
|
||||
azureSubscription: $(AZURE_SERVICE_NAME)
|
||||
scriptLocation: inlineScript
|
||||
scriptType: bash
|
||||
inlineScript: |
|
||||
cp -rs $(Build.SourcesDirectory)/* /tf/caf && cp -r $(Build.SourcesDirectory)/.devcontainer /tf/caf/
|
||||
cd /tf/caf/enterprise_scale/construction_sets/aks/online/aks_secure_baseline/landingzone/scripts/
|
||||
./deploy_level_with_rover.sh level1 shared_services
|
||||
ls -lta
|
||||
pwd
|
||||
cd enterprise_scale/construction_sets/aks/online/aks_secure_baseline/standalone
|
||||
configuration_folder=configuration
|
||||
parameter_files=$(find $configuration_folder -not -path "*launchpad*" | grep .tfvars | sed 's/.*/-var-file &/' | xargs)
|
||||
eval terraform destroy ${parameter_files} -var tags='{testing_job_id='"$ENVIRONMENT"'}' -auto-approve
|
||||
env:
|
||||
ARM_CLIENT_SECRET: $(ARM_CLIENT_SECRET)
|
||||
|
||||
- task: AzureCLI@2
|
||||
displayName: Shared Services Test
|
||||
name: test
|
||||
inputs:
|
||||
azureSubscription: $(AZURE_SERVICE_NAME)
|
||||
scriptLocation: inlineScript
|
||||
scriptType: bash
|
||||
inlineScript: |
|
||||
cd /tf/caf/enterprise_scale/construction_sets/aks/online/aks_secure_baseline/test
|
||||
echo "##vso[task.setvariable variable=PREFIX;isOutput=true]$PREFIX"
|
||||
go test -v shared_services/shared_services_test.go
|
||||
env:
|
||||
PREFIX: $(prefix)
|
||||
|
||||
- job: deploy_networking_hub
|
||||
displayName: "Deploy Networking Hub. Level 1"
|
||||
container: rover
|
||||
|
||||
steps:
|
||||
- task: AzureCLI@2
|
||||
displayName: Deploy Networking Hub
|
||||
name: deploy_networking_hub
|
||||
inputs:
|
||||
azureSubscription: $(AZURE_SERVICE_NAME)
|
||||
scriptLocation: inlineScript
|
||||
scriptType: bash
|
||||
inlineScript: |
|
||||
cp -rs $(Build.SourcesDirectory)/* /tf/caf && cp -r $(Build.SourcesDirectory)/.devcontainer /tf/caf/
|
||||
cd /tf/caf/enterprise_scale/construction_sets/aks/online/aks_secure_baseline/landingzone/
|
||||
./scripts/deploy_level_with_rover.sh level1 networking_hub
|
||||
env:
|
||||
ARM_CLIENT_SECRET: $(ARM_CLIENT_SECRET)
|
||||
|
||||
- task: AzureCLI@2
|
||||
displayName: Networking Hub Test
|
||||
inputs:
|
||||
azureSubscription: $(AZURE_SERVICE_NAME)
|
||||
scriptLocation: inlineScript
|
||||
scriptType: bash
|
||||
inlineScript: |
|
||||
echo "Invoke integration test"
|
||||
|
||||
- job: deploy_networking_spoke
|
||||
displayName: "Deploy Networking Spoke. Level 1"
|
||||
dependsOn: deploy_networking_hub
|
||||
container: rover
|
||||
|
||||
steps:
|
||||
- task: AzureCLI@2
|
||||
displayName: Deploy Networking Spoke
|
||||
name: deploy_networking_spoke
|
||||
inputs:
|
||||
azureSubscription: $(AZURE_SERVICE_NAME)
|
||||
scriptLocation: inlineScript
|
||||
scriptType: bash
|
||||
inlineScript: |
|
||||
cp -rs $(Build.SourcesDirectory)/* /tf/caf && cp -r $(Build.SourcesDirectory)/.devcontainer /tf/caf/
|
||||
cd /tf/caf/enterprise_scale/construction_sets/aks/online/aks_secure_baseline/landingzone/
|
||||
./scripts/deploy_level_with_rover.sh level1 networking_spoke
|
||||
env:
|
||||
ARM_CLIENT_SECRET: $(ARM_CLIENT_SECRET)
|
||||
|
||||
- task: AzureCLI@2
|
||||
displayName: Networking Spoke Test
|
||||
inputs:
|
||||
azureSubscription: $(AZURE_SERVICE_NAME)
|
||||
scriptLocation: inlineScript
|
||||
scriptType: bash
|
||||
inlineScript: |
|
||||
echo "Invoke integration test"
|
||||
|
||||
- stage: deploy_aks
|
||||
jobs:
|
||||
- job: deploy_aks
|
||||
displayName: "Deploy AKS. Level 2"
|
||||
container: rover
|
||||
variables:
|
||||
prefix: $[ stageDependencies.deploy_level1.deploy_shared_services.outputs['test.PREFIX'] ]
|
||||
|
||||
steps:
|
||||
- task: AzureCLI@2
|
||||
displayName: Deploy AKS
|
||||
name: deploy_aks
|
||||
inputs:
|
||||
azureSubscription: $(AZURE_SERVICE_NAME)
|
||||
scriptLocation: inlineScript
|
||||
scriptType: bash
|
||||
inlineScript: |
|
||||
cp -rs $(Build.SourcesDirectory)/* /tf/caf && cp -r $(Build.SourcesDirectory)/.devcontainer /tf/caf/
|
||||
cd /tf/caf/enterprise_scale/construction_sets/aks/online/aks_secure_baseline/landingzone/
|
||||
./scripts/deploy_level_with_rover.sh level2 aks
|
||||
env:
|
||||
ARM_CLIENT_SECRET: $(ARM_CLIENT_SECRET)
|
||||
|
||||
- task: AzureCLI@2
|
||||
displayName: AKS Test
|
||||
name: test
|
||||
inputs:
|
||||
azureSubscription: $(AZURE_SERVICE_NAME)
|
||||
scriptLocation: inlineScript
|
||||
scriptType: bash
|
||||
inlineScript: |
|
||||
cd /tf/caf/enterprise_scale/construction_sets/aks/online/aks_secure_baseline/test
|
||||
echo "##vso[task.setvariable variable=PREFIX;isOutput=true]$PREFIX"
|
||||
go test -v aks/aks_test.go
|
||||
env:
|
||||
PREFIX: $(prefix)
|
||||
|
||||
- stage: deploy_addons
|
||||
jobs:
|
||||
- job: deploy_addons
|
||||
displayName: "Deploy Addons. Level 2"
|
||||
container: rover
|
||||
variables:
|
||||
prefix: $[ stageDependencies.deploy_aks.deploy_aks.outputs['test.PREFIX'] ]
|
||||
|
||||
steps:
|
||||
- task: AzureCLI@2
|
||||
displayName: Deploy Addons
|
||||
name: deploy_addons
|
||||
inputs:
|
||||
azureSubscription: $(AZURE_SERVICE_NAME)
|
||||
scriptLocation: inlineScript
|
||||
scriptType: bash
|
||||
inlineScript: |
|
||||
cp -rs $(Build.SourcesDirectory)/* /tf/caf && cp -r $(Build.SourcesDirectory)/.devcontainer /tf/caf/
|
||||
cd /tf/caf/enterprise_scale/construction_sets/aks/online/aks_secure_baseline/landingzone/
|
||||
./scripts/deploy_level_with_rover.sh level2 aks_secure_baseline /add-ons/aks_secure_baseline_v2
|
||||
/tf/rover/rover.sh \
|
||||
-lz /tf/caf/landingzones/caf_solution/add-ons/aks_secure_baseline_v2 \
|
||||
-var-folder /tf/caf/enterprise_scale/construction_sets/aks/online/aks_secure_baseline/landingzone/configuration/${LEVEL_NAME}/${LZ_NAME} \
|
||||
-tfstate aks_secure_baseline.tfstate \
|
||||
-level level2 \
|
||||
-env $ENVIRONMENT \
|
||||
-a output -json -o $(pwd)/rover.output
|
||||
|
||||
echo $(cat rover.output | jq -r .aks_clusters_kubeconfig.value.aks_kubeconfig_admin_cmd) | bash
|
||||
env:
|
||||
ARM_CLIENT_SECRET: $(ARM_CLIENT_SECRET)
|
||||
|
||||
- task: AzureCLI@2
|
||||
displayName: Addons Test
|
||||
inputs:
|
||||
azureSubscription: $(AZURE_SERVICE_NAME)
|
||||
scriptLocation: inlineScript
|
||||
scriptType: bash
|
||||
inlineScript: |
|
||||
cd /tf/caf/enterprise_scale/construction_sets/aks/online/aks_secure_baseline/test
|
||||
go test -v flux/flux_test.go
|
||||
env:
|
||||
PREFIX: $(prefix)
|
||||
KUBECONFIGPATH: /home/vsts_azpcontainer/.kube/config
|
||||
|
||||
- stage: destroy_addons
|
||||
jobs:
|
||||
- job: destroy_addons
|
||||
displayName: "Destroy Addons. Level 2"
|
||||
container: rover
|
||||
|
||||
steps:
|
||||
- task: AzureCLI@2
|
||||
displayName: Destroy Addons
|
||||
name: destroy_addons
|
||||
inputs:
|
||||
azureSubscription: $(AZURE_SERVICE_NAME)
|
||||
scriptLocation: inlineScript
|
||||
scriptType: bash
|
||||
inlineScript: |
|
||||
cp -rs $(Build.SourcesDirectory)/* /tf/caf && cp -r $(Build.SourcesDirectory)/.devcontainer /tf/caf/
|
||||
cd /tf/caf/enterprise_scale/construction_sets/aks/online/aks_secure_baseline/landingzone/
|
||||
./scripts/deploy_level_with_rover.sh level2 aks_secure_baseline /add-ons/aks_secure_baseline_v2
|
||||
env:
|
||||
ARM_CLIENT_SECRET: $(ARM_CLIENT_SECRET)
|
||||
ACTION: "destroy -auto-approve"
|
||||
|
||||
- stage: destroy_aks
|
||||
jobs:
|
||||
- job: destroy_aks
|
||||
displayName: "Destroy AKS. Level 2"
|
||||
container: rover
|
||||
|
||||
steps:
|
||||
- task: AzureCLI@2
|
||||
displayName: Destroy AKS
|
||||
name: deploy_aks
|
||||
inputs:
|
||||
azureSubscription: $(AZURE_SERVICE_NAME)
|
||||
scriptLocation: inlineScript
|
||||
scriptType: bash
|
||||
inlineScript: |
|
||||
cp -rs $(Build.SourcesDirectory)/* /tf/caf && cp -r $(Build.SourcesDirectory)/.devcontainer /tf/caf/
|
||||
cd /tf/caf/enterprise_scale/construction_sets/aks/online/aks_secure_baseline/landingzone/
|
||||
./scripts/deploy_level_with_rover.sh level2 aks
|
||||
env:
|
||||
ARM_CLIENT_SECRET: $(ARM_CLIENT_SECRET)
|
||||
ACTION: "destroy -auto-approve"
|
||||
|
||||
- stage: destroy_level1
|
||||
jobs:
|
||||
- job: destroy_networking_spoke
|
||||
displayName: "Destroy Networking Spoke. Level 1"
|
||||
container: rover
|
||||
|
||||
steps:
|
||||
- task: AzureCLI@2
|
||||
displayName: Destroy Networking Spoke
|
||||
name: destroy_networking_spoke
|
||||
inputs:
|
||||
azureSubscription: $(AZURE_SERVICE_NAME)
|
||||
scriptLocation: inlineScript
|
||||
scriptType: bash
|
||||
inlineScript: |
|
||||
cp -rs $(Build.SourcesDirectory)/* /tf/caf && cp -r $(Build.SourcesDirectory)/.devcontainer /tf/caf/
|
||||
cd /tf/caf/enterprise_scale/construction_sets/aks/online/aks_secure_baseline/landingzone/
|
||||
./scripts/deploy_level_with_rover.sh level1 networking_spoke
|
||||
env:
|
||||
ARM_CLIENT_SECRET: $(ARM_CLIENT_SECRET)
|
||||
ACTION: "destroy -auto-approve"
|
||||
|
||||
- job: destroy_networking_hub
|
||||
displayName: "Destroy Networking Hub. Level 1"
|
||||
dependsOn: destroy_networking_spoke
|
||||
container: rover
|
||||
|
||||
steps:
|
||||
- task: AzureCLI@2
|
||||
displayName: Destroy Networking Hub
|
||||
name: destroy_networking_hub
|
||||
inputs:
|
||||
azureSubscription: $(AZURE_SERVICE_NAME)
|
||||
scriptLocation: inlineScript
|
||||
scriptType: bash
|
||||
inlineScript: |
|
||||
cp -rs $(Build.SourcesDirectory)/* /tf/caf && cp -r $(Build.SourcesDirectory)/.devcontainer /tf/caf/
|
||||
cd /tf/caf/enterprise_scale/construction_sets/aks/online/aks_secure_baseline/landingzone/
|
||||
./scripts/deploy_level_with_rover.sh level1 networking_hub
|
||||
env:
|
||||
ARM_CLIENT_SECRET: $(ARM_CLIENT_SECRET)
|
||||
ACTION: "destroy -auto-approve"
|
||||
|
||||
- job: destroy_shared_services
|
||||
displayName: "Destroy Shared Services. Level 1"
|
||||
container: rover
|
||||
|
||||
steps:
|
||||
- task: AzureCLI@2
|
||||
displayName: Destroy Shared Services
|
||||
name: destroy_shared_services
|
||||
inputs:
|
||||
azureSubscription: $(AZURE_SERVICE_NAME)
|
||||
scriptLocation: inlineScript
|
||||
scriptType: bash
|
||||
inlineScript: |
|
||||
cp -rs $(Build.SourcesDirectory)/* /tf/caf && cp -r $(Build.SourcesDirectory)/.devcontainer /tf/caf/
|
||||
cd /tf/caf/enterprise_scale/construction_sets/aks/online/aks_secure_baseline/landingzone/scripts/
|
||||
./deploy_level_with_rover.sh level1 shared_services
|
||||
env:
|
||||
ARM_CLIENT_SECRET: $(ARM_CLIENT_SECRET)
|
||||
ACTION: "destroy -auto-approve"
|
||||
- stage: destroy_launchpad
|
||||
jobs:
|
||||
- job: destroy_launchpad
|
||||
displayName: "Destroy Launchpad"
|
||||
container: rover
|
||||
|
||||
steps:
|
||||
- task: AzureCLI@2
|
||||
displayName: Destroy Launchpad. Level 0.
|
||||
name: destroy_launchpad
|
||||
inputs:
|
||||
azureSubscription: $(AZURE_SERVICE_NAME)
|
||||
scriptLocation: inlineScript
|
||||
scriptType: bash
|
||||
inlineScript: |
|
||||
cp -rs $(Build.SourcesDirectory)/* /tf/caf && cp -r $(Build.SourcesDirectory)/.devcontainer /tf/caf/
|
||||
/tf/caf/enterprise_scale/construction_sets/aks/online/aks_secure_baseline/landingzone/scripts/launchpad.sh
|
||||
env:
|
||||
ARM_CLIENT_SECRET: $(ARM_CLIENT_SECRET)
|
||||
ACTION: "destroy -auto-approve"
|
||||
- stage: purge
|
||||
condition: always()
|
||||
jobs:
|
||||
|
|
Загрузка…
Ссылка в новой задаче