Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add nightly and PR validation pipelines in Azure DevOps #437

Merged
merged 136 commits into from
Nov 8, 2021
Merged
Show file tree
Hide file tree
Changes from 61 commits
Commits
Show all changes
136 commits
Select commit Hold shift + click to select a range
647158b
Set up CI with Azure Pipelines
vidyambala Oct 4, 2021
06e035a
Update azure-pipelines.yml for Azure Pipelines
vidyambala Oct 5, 2021
69f534f
Update azure-pipelines.yml for Azure Pipelines
vidyambala Oct 5, 2021
9d64906
Update azure-pipelines.yml for Azure Pipelines
vidyambala Oct 6, 2021
4228369
Update azure-pipelines.yml for Azure Pipelines
vidyambala Oct 6, 2021
75b76d8
Update azure-pipelines.yml for Azure Pipelines
vidyambala Oct 6, 2021
aad6f37
Update azure-pipelines.yml for Azure Pipelines
vidyambala Oct 6, 2021
e311e61
Update azure-pipelines.yml for Azure Pipelines
vidyambala Oct 6, 2021
c9b2279
Update azure-pipelines.yml for Azure Pipelines
vidyambala Oct 6, 2021
88fdd5b
Update azure-pipelines.yml for Azure Pipelines
vidyambala Oct 6, 2021
c9a9cc4
Update azure-pipelines.yml for Azure Pipelines
vidyambala Oct 6, 2021
1258e39
Update azure-pipelines.yml for Azure Pipelines
vidyambala Oct 7, 2021
be5c7f7
Update azure-pipelines.yml for Azure Pipelines
vidyambala Oct 7, 2021
2780f32
Update azure-pipelines.yml for Azure Pipelines
vidyambala Oct 7, 2021
2aae9cc
Update azure-pipelines.yml for Azure Pipelines
vidyambala Oct 7, 2021
ec033bb
Update azure-pipelines.yml for Azure Pipelines
vidyambala Oct 7, 2021
20f2e94
Update azure-pipelines.yml for Azure Pipelines
vidyambala Oct 7, 2021
ad6820a
Update azure-pipelines.yml for Azure Pipelines
vidyambala Oct 7, 2021
4cf7d69
Update azure-pipelines.yml for Azure Pipelines
vidyambala Oct 7, 2021
1f1ea00
Update azure-pipelines.yml for Azure Pipelines
vidyambala Oct 7, 2021
07b6703
Update azure-pipelines.yml for Azure Pipelines
vidyambala Oct 7, 2021
b2f0c39
Update azure-pipelines.yml for Azure Pipelines
vidyambala Oct 7, 2021
c864f04
Update azure-pipelines.yml for Azure Pipelines
vidyambala Oct 8, 2021
c7b356e
Update azure-pipelines.yml for Azure Pipelines
vidyambala Oct 12, 2021
0774ae0
Update azure-pipelines.yml for Azure Pipelines
vidyambala Oct 12, 2021
3aaed43
Update azure-pipelines.yml for Azure Pipelines
vidyambala Oct 12, 2021
1a15d06
Update azure-pipelines.yml for Azure Pipelines
vidyambala Oct 12, 2021
9f9ea25
Update azure-pipelines.yml for Azure Pipelines
vidyambala Oct 12, 2021
dae982d
Update azure-pipelines.yml for Azure Pipelines
vidyambala Oct 12, 2021
746c630
Update azure-pipelines.yml for Azure Pipelines
vidyambala Oct 12, 2021
fd29cec
Update azure-pipelines.yml for Azure Pipelines
vidyambala Oct 12, 2021
8d697d4
Update azure-pipelines.yml for Azure Pipelines
vidyambala Oct 12, 2021
4aa66b9
Update azure-pipelines.yml for Azure Pipelines
vidyambala Oct 12, 2021
78d3223
Update azure-pipelines.yml for Azure Pipelines
vidyambala Oct 12, 2021
f156fab
Update azure-pipelines.yml for Azure Pipelines
vidyambala Oct 12, 2021
367162f
Update azure-pipelines.yml for Azure Pipelines
vidyambala Oct 12, 2021
2aea8b3
Update azure-pipelines.yml for Azure Pipelines
vidyambala Oct 12, 2021
7148088
Update azure-pipelines.yml for Azure Pipelines
vidyambala Oct 13, 2021
bb9d75f
Update azure-pipelines.yml for Azure Pipelines
vidyambala Oct 13, 2021
95117e8
Update azure-pipelines.yml for Azure Pipelines
vidyambala Oct 14, 2021
f7f4172
Update azure-pipelines.yml for Azure Pipelines
vidyambala Oct 14, 2021
1296072
Update azure-pipelines.yml for Azure Pipelines
vidyambala Oct 14, 2021
ec68421
Update azure-pipelines.yml for Azure Pipelines
vidyambala Oct 14, 2021
47d2fc4
Update azure-pipelines.yml for Azure Pipelines
vidyambala Oct 15, 2021
5dc010e
Update azure-pipelines.yml for Azure Pipelines
vidyambala Oct 15, 2021
22bb745
Update azure-pipelines.yml for Azure Pipelines
vidyambala Oct 15, 2021
a0820a8
Update azure-pipelines.yml for Azure Pipelines
vidyambala Oct 15, 2021
20da94c
Update azure-pipelines.yml for Azure Pipelines
vidyambala Oct 15, 2021
04b637a
Mlz azure pipelines naming changes (#463)
shawngib Oct 18, 2021
4c4e615
PR & Nightly Build pipelines
vidyambala Oct 25, 2021
474d47d
Merge branch 'mlz-azure-pipelines' of https://github.com/Azure/missio…
vidyambala Oct 25, 2021
84aeb76
Update azure-pipelines.yml for Azure Pipelines
vidyambala Oct 25, 2021
8649723
Update azure-pipelines.yml for Azure Pipelines
vidyambala Oct 25, 2021
7e4dea8
Update azure-pipelines.yml for Azure Pipelines
vidyambala Oct 25, 2021
c545c14
Update azure-pipelines.yml for Azure Pipelines
vidyambala Oct 25, 2021
33987b6
Rename azure-pipelines.yml to mlz-pr-azure-pipelines.yml
vidyambala Oct 25, 2021
30203d5
Update azure-pipelines.yml for Azure Pipelines
vidyambala Oct 25, 2021
49f4704
Update azure-pipelines.yml for Azure Pipelines
vidyambala Oct 25, 2021
0dc6625
Update azure-pipelines.yml for Azure Pipelines
vidyambala Oct 26, 2021
5745d3e
Update azure-pipelines.yml for Azure Pipelines
vidyambala Oct 26, 2021
7e2dac7
Merge branch 'main' into mlz-azure-pipelines
vidyambala Oct 26, 2021
770d53d
Nightly deployments of /main to AzureCloud and AzureUsGovernment #49
vidyambala Oct 28, 2021
80b70f5
Update bicepAzureCloud
vidyambala Oct 28, 2021
e642406
Update mlz-bicep-azurecloud-pipelines.yml for Azure Pipelines
vidyambala Oct 28, 2021
25f253d
Set up CI with Azure Pipelines
vidyambala Oct 28, 2021
f5a3f7b
Update mlz-tf-azurecloud-pipelines.yml for Azure Pipelines
vidyambala Oct 28, 2021
40f9326
Update mlz-pr-tf-azuregov-pipelines.yml for Azure Pipelines
vidyambala Oct 28, 2021
d139e29
Update mlz-bicep-azuregov-pipelines.yml for Azure Pipelines
vidyambala Oct 28, 2021
b7baa2c
Update mlz-pr-tf-azuregov-pipelines.yml for Azure Pipelines
vidyambala Oct 28, 2021
1802e3c
Update mlz-bicep-azuregov-pipelines.yml for Azure Pipelines
vidyambala Oct 28, 2021
df3588b
Update mlz-tf-azuregov-pipelines.yml for Azure Pipelines
vidyambala Oct 28, 2021
b5a67ea
Update mlz-tf-azuregov-pipelines.yml for Azure Pipelines
vidyambala Oct 28, 2021
767ff65
Update mlz-tf-azuregov-pipelines.yml for Azure Pipelines
vidyambala Oct 28, 2021
8ed27bb
Update mlz-tf-azuregov-pipelines.yml for Azure Pipelines
vidyambala Oct 28, 2021
81ad76a
Update mlz-tf-azuregov-pipelines.yml for Azure Pipelines
vidyambala Oct 28, 2021
d9d5d80
Update mlz-tf-azurecloud-pipelines.yml for Azure Pipelines
vidyambala Oct 29, 2021
6d4be1c
Update mlz-tf-azurecloud-pipelines.yml for Azure Pipelines
vidyambala Oct 29, 2021
bbb30c7
Set up CI with Azure Pipelines
vidyambala Oct 29, 2021
1654b9d
Update mlz-pr-tf-azuregov-pipelines.yml for Azure Pipelines
vidyambala Oct 29, 2021
935d284
Update mlz-pr-tf-azurecloud-pipelines.yml for Azure Pipelines
vidyambala Oct 29, 2021
b9a3a3b
Update mlz-pr-bicep-azurecloud-pipelines.yml for Azure Pipelines
vidyambala Oct 29, 2021
86780d8
Update mlz-pr-bicep-azuregov-pipelines.yml for Azure Pipelines
vidyambala Oct 29, 2021
caa2aa5
Update mlz-pr-tf-azuregov-pipelines.yml for Azure Pipelines
vidyambala Oct 29, 2021
3f8b2c7
Update mlz-pr-tf-azuregov-pipelines.yml for Azure Pipelines
vidyambala Oct 29, 2021
f30a52d
Update README.md
vidyambala Oct 29, 2021
aa592b1
Update mlz-bicep-azurecloud-pipelines.yml for Azure Pipelines
vidyambala Nov 1, 2021
4335041
Update mlz-bicep-azuregov-pipelines.yml for Azure Pipelines
vidyambala Nov 1, 2021
ad297b5
Update mlz-bicep-azurecloud-pipelines.yml for Azure Pipelines
vidyambala Nov 1, 2021
348428d
Update mlz-bicep-azuregov-pipelines.yml for Azure Pipelines
vidyambala Nov 1, 2021
6f68d42
Update mlz-tf-azurecloud-pipelines.yml for Azure Pipelines
vidyambala Nov 1, 2021
00aef56
Update mlz-tf-azuregov-pipelines.yml for Azure Pipelines
vidyambala Nov 1, 2021
8f79c54
Update mlz-tf-azuregov-pipelines.yml for Azure Pipelines
vidyambala Nov 1, 2021
2c9a810
Update mlz-pr-tf-azurecloud-pipelines.yml for Azure Pipelines
vidyambala Nov 1, 2021
877d5d5
Update mlz-pr-tf-azurecloud-pipelines.yml for Azure Pipelines
vidyambala Nov 1, 2021
96f9dba
Update mlz-pr-tf-azurecloud-pipelines.yml for Azure Pipelines
vidyambala Nov 1, 2021
ecac5b2
Update mlz-tf-azurecloud-pipelines.yml for Azure Pipelines
vidyambala Nov 1, 2021
43eaa07
Update mlz-tf-azuregov-pipelines.yml for Azure Pipelines
vidyambala Nov 1, 2021
d3d3d94
Update mlz-tf-azurecloud-pipelines.yml for Azure Pipelines
vidyambala Nov 1, 2021
1039794
Update mlz-tf-azuregov-pipelines.yml for Azure Pipelines
vidyambala Nov 1, 2021
0a8bdc8
Update mlz-tf-azuregov-pipelines.yml for Azure Pipelines
vidyambala Nov 1, 2021
5fda9a4
Update mlz-tf-azuregov-pipelines.yml for Azure Pipelines
vidyambala Nov 1, 2021
3d9b8a7
Update mlz-bicep-azurecloud-pipelines.yml for Azure Pipelines
vidyambala Nov 2, 2021
4390572
Update mlz-bicep-azurecloud-pipelines.yml for Azure Pipelines
vidyambala Nov 2, 2021
89e51b0
Update mlz-bicep-azuregov-pipelines.yml for Azure Pipelines
vidyambala Nov 2, 2021
ec4bff6
Update mlz-tf-azurecloud-pipelines.yml for Azure Pipelines
vidyambala Nov 2, 2021
362508d
Update mlz-tf-azuregov-pipelines.yml for Azure Pipelines
vidyambala Nov 2, 2021
51d4a74
Execute `export` commands individually on Terraform plan and apply pi…
glennmusa Nov 2, 2021
f9f4b8f
Update mlz-bicep-azurecloud-pipelines.yml for Azure Pipelines
vidyambala Nov 3, 2021
543a2e2
Update mlz-bicep-azuregov-pipelines.yml for Azure Pipelines
vidyambala Nov 3, 2021
2b665ad
Update mlz-tf-azurecloud-pipelines.yml for Azure Pipelines
vidyambala Nov 3, 2021
6df8966
Update mlz-tf-azuregov-pipelines.yml for Azure Pipelines
vidyambala Nov 3, 2021
5660ecc
Update mlz-tf-azuregov-pipelines.yml for Azure Pipelines
vidyambala Nov 4, 2021
86cf9ae
Update mlz-tf-azuregov-pipelines.yml for Azure Pipelines
vidyambala Nov 4, 2021
e070f4a
Update mlz-tf-azuregov-pipelines.yml for Azure Pipelines
vidyambala Nov 4, 2021
ce68bde
Update mlz-tf-azuregov-pipelines.yml for Azure Pipelines
vidyambala Nov 4, 2021
fc7c9c0
Update mlz-tf-azuregov-pipelines.yml for Azure Pipelines
vidyambala Nov 4, 2021
06ca20b
Update mlz-tf-azuregov-pipelines.yml for Azure Pipelines
vidyambala Nov 4, 2021
a9aa663
Update mlz-tf-azurecloud-pipelines.yml for Azure Pipelines
vidyambala Nov 4, 2021
6b0656c
Update mlz-bicep-azuregov-pipelines.yml for Azure Pipelines
vidyambala Nov 4, 2021
2f6127a
Update mlz-bicep-azurecloud-pipelines.yml for Azure Pipelines
vidyambala Nov 4, 2021
008cc5d
Add nightly and PR validation pipelines in Azure DevOps #437
vidyambala Nov 5, 2021
d4272aa
Merge branch 'main' into mlz-azure-pipelines
vidyambala Nov 5, 2021
f91167c
Update README.md
vidyambala Nov 5, 2021
4b80aab
Update README.md
vidyambala Nov 5, 2021
b591368
Update delete.sh
vidyambala Nov 5, 2021
b151142
Update delete.sh
vidyambala Nov 5, 2021
6e4e1ff
Update delete.sh
vidyambala Nov 5, 2021
d976997
Update delete.sh
vidyambala Nov 5, 2021
5c94126
Update delete.sh
vidyambala Nov 5, 2021
ea7f2eb
Update delete.sh
vidyambala Nov 6, 2021
3553256
Merge branch 'main' into mlz-azure-pipelines
glennmusa Nov 8, 2021
4213480
format mlz main.tf
glennmusa Nov 8, 2021
71719ad
add copyright to a shell script
glennmusa Nov 8, 2021
d92d480
yaml linting
glennmusa Nov 8, 2021
9bdf972
correct tab on task
glennmusa Nov 8, 2021
33a0e9b
remove whitespaces in root readme
glennmusa Nov 8, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
103 changes: 103 additions & 0 deletions .github/workflows/PRValidationBuild/mlz-pr-azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
# Starter pipeline
# Start with a minimal pipeline that you can customize to build and deploy your code.
vidyambala marked this conversation as resolved.
Show resolved Hide resolved
# Add steps that build, run tests, deploy, and more:
# https://aka.ms/yaml
vidyambala marked this conversation as resolved.
Show resolved Hide resolved

trigger:
- mlz-azure-pipelines
vidyambala marked this conversation as resolved.
Show resolved Hide resolved

pool:
vmImage: ubuntu-latest

variables:
ServiceConnectionName: $(CAzureConnection)
GServiceConnectionName: $(GAzureConnection)

jobs:
- job: bicepCommercialCloud
steps:
- task: AzureCLI@2
displayName: "Deploy MLZ Bicep"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
displayName: "Deploy MLZ Bicep"
displayName: "Bicep What-if"

inputs:
azureSubscription: $(ServiceConnectionName)
scriptType: 'bash'
scriptLocation: 'inlineScript'
inlineScript: |
az deployment sub what-if \
--name $(bDeploymentName) \
--location $(Location) \
--template-file $(TemplateFile)
enabled: true
- job: bicepGovCloud
steps:
- task: AzureCLI@2
displayName: "Deploy MLZ Bicep"
vidyambala marked this conversation as resolved.
Show resolved Hide resolved
inputs:
azureSubscription: $(GServiceConnectionName)
scriptType: 'bash'
scriptLocation: 'inlineScript'
inlineScript: |
az deployment sub what-if \
--name $(bDeploymentName) \
--location $(GLocation) \
--template-file $(TemplateFile)
enabled: true
- job: CommercialCloud_TF
steps:
- task: TerraformInstaller@0
inputs:
terraformVersion: '1.0.8'
- task: AzureCLI@2
displayName: "Deploy MLZ Terraform"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
displayName: "Deploy MLZ Terraform"
displayName: "Terraform Plan"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will update the script

inputs:
azureSubscription: 'CAzureConnection'
scriptType: 'bash'
scriptLocation: 'inlineScript'
addSpnToEnvironment: true
inlineScript: |
export ARM_CLIENT_ID=$(ClientId) `
echo $ARM_CLIENT_ID `
export ARM_CLIENT_SECRET=$(ClientSecret) `
echo $ARM_CLIENT_SECRET `
export ARM_SUBSCRIPTION_ID=$(subId) `
echo $ARM_SUBSCRIPTION_ID `
export ARM_TENANT_ID=$(tenantId) `
echo $ARM_TENANT_ID `
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's just set the environment variable and not echo them (sure, Pipelines is smart enough to mask the values, but there's no need to do it).

Suggested change
export ARM_CLIENT_ID=$(ClientId) `
echo $ARM_CLIENT_ID `
export ARM_CLIENT_SECRET=$(ClientSecret) `
echo $ARM_CLIENT_SECRET `
export ARM_SUBSCRIPTION_ID=$(subId) `
echo $ARM_SUBSCRIPTION_ID `
export ARM_TENANT_ID=$(tenantId) `
echo $ARM_TENANT_ID `
export ARM_CLIENT_ID=$(ClientId) `
export ARM_CLIENT_SECRET=$(ClientSecret) `
export ARM_SUBSCRIPTION_ID=$(subId) `
export ARM_TENANT_ID=$(tenantId) `

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm...I have removed them before PR. Will check it again as ADO is not showing them

terraform init
terraform plan -var "hub_subid=$(subid)" -input=false
workingDirectory: '$(System.DefaultWorkingDirectory)/src/terraform/mlz'
useGlobalConfig: true
enabled: true


- job: GovCloud_TF
steps:
- task: TerraformInstaller@0
inputs:
terraformVersion: '1.0.8'
- task: AzureCLI@2
name: TerraformApplyGov
vidyambala marked this conversation as resolved.
Show resolved Hide resolved
displayName: "Deploy MLZ Terraform"
vidyambala marked this conversation as resolved.
Show resolved Hide resolved
inputs:
azureSubscription: 'GAzureConnection'
scriptType: 'bash'
addSpnToEnvironment: true
scriptLocation: 'inlineScript'
inlineScript: |
export ARM_CLIENT_ID=$(GClientId) `
echo $ARM_CLIENT_ID `
export ARM_CLIENT_SECRET=$(GClientSecret) `
echo $ARM_CLIENT_SECRET `
export ARM_SUBSCRIPTION_ID=$(GSubId) `
echo $ARM_SUBSCRIPTION_ID `
export ARM_TENANT_ID=$(GTenantId) `
echo $ARM_TENANT_ID `
export ARM_ENVIRONMENT=$(CloudEnv) `
echo $ARM_ENVIRONMENT `
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's just set the environment variable and not echo them (sure, Pipelines is smart enough to mask the values, but there's no need to do it).

Suggested change
export ARM_CLIENT_ID=$(GClientId) `
echo $ARM_CLIENT_ID `
export ARM_CLIENT_SECRET=$(GClientSecret) `
echo $ARM_CLIENT_SECRET `
export ARM_SUBSCRIPTION_ID=$(GSubId) `
echo $ARM_SUBSCRIPTION_ID `
export ARM_TENANT_ID=$(GTenantId) `
echo $ARM_TENANT_ID `
export ARM_ENVIRONMENT=$(CloudEnv) `
echo $ARM_ENVIRONMENT `
export ARM_CLIENT_ID=$(GClientId) `
export ARM_CLIENT_SECRET=$(GClientSecret) `
export ARM_SUBSCRIPTION_ID=$(GSubId) `
export ARM_TENANT_ID=$(GTenantId) `
export ARM_ENVIRONMENT=$(CloudEnv) `

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will check it again

terraform init
terraform plan -var "hub_subid=$(GSubid)" -var metadata_host=$(MetadataHost) -var environment=$(CloudEnv) -var location=$(GLocation) -input=false
workingDirectory: '$(System.DefaultWorkingDirectory)/src/terraform/mlz'
useGlobalConfig: true
enabled: true


162 changes: 162 additions & 0 deletions .github/workflows/nightly/azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
# Starter pipeline
vidyambala marked this conversation as resolved.
Show resolved Hide resolved
# Start with a minimal pipeline that you can customize to build and deploy your code.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These aren't GitHub workflows. Let's move this (and the other nightly deployment pipelines) into an Azure DevOps specific folder at: ./.azure-devops:

./.azure-devops/nightly/bicepAzureCloud.yml
./.azure-devops/nightly/bicepAzureUsGovernment.yml
./.azure-devops/nightly/terraformAzureCloud.yml
./.azure-devops/nightly/terraformAzureUsGovernment.yml

# Add steps that build, run tests, deploy, and more:
# https://aka.ms/yaml
vidyambala marked this conversation as resolved.
Show resolved Hide resolved

trigger:
- mlz-azure-pipelines
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of using a trigger configured in the Pipelines UI, let's describe the cron schedule in source:

https://docs.microsoft.com/en-us/azure/devops/pipelines/process/scheduled-triggers?view=azure-devops&tabs=yaml#running-even-when-there-are-no-code-changes

Copy link
Contributor Author

@vidyambala vidyambala Oct 26, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will check that option. Thanks


pool:
vmImage: ubuntu-latest

variables:
ServiceConnectionName: $(CAzureConnection)
GServiceConnectionName: $(GAzureConnection)

jobs:
- job: bicepCommercialCloud
steps:
- task: AzureCLI@2
displayName: "Deploy MLZ Bicep"
inputs:
azureSubscription: $(ServiceConnectionName)
scriptType: 'bash'
scriptLocation: 'inlineScript'
inlineScript: |
az deployment sub create \
--name $(bDeploymentName) \
--location $(Location) \
--template-file $(TemplateFile)\
--parameters resourcePrefix="cicdbicep"
enabled: true
- task: AzureCLI@2
vidyambala marked this conversation as resolved.
Show resolved Hide resolved
inputs:
azureSubscription: 'CAzureConnection'
scriptType: 'bash'
scriptLocation: 'inlineScript'
inlineScript: 'az monitor diagnostic-settings subscription list --query "value[? contains(@.name, ''$1'')].name" -o table |grep ''cicdbicep''| awk ''{system(" az monitor diagnostic-settings delete --resource ''"/subscriptions/$(subId)"'' --name "$1)}'''
enabled: true
- task: AzureCLI@2
displayName: "Cleanup Resources"
inputs:
azureSubscription: 'CAzureConnection'
scriptType: 'bash'
scriptLocation: 'inlineScript'
inlineScript: 'az group list -o table | grep ''cicdbicep'' | awk ''{system("az group delete -y --no-wait -g "$1)}'''
enabled: true
- job: bicepGovCloud
steps:
- task: AzureCLI@2
displayName: "Deploy MLZ Bicep"
inputs:
azureSubscription: $(GServiceConnectionName)
scriptType: 'bash'
scriptLocation: 'inlineScript'
inlineScript: |
az deployment sub create \
--name $(bDeploymentName) \
--location $(GLocation) \
--template-file $(TemplateFile)\
--parameters resourcePrefix="cicdbicep"
enabled: true
vidyambala marked this conversation as resolved.
Show resolved Hide resolved
- task: AzureCLI@2
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This task could use a friendlier displayName since it's not obvious what this shell script is doing at a glance.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed

inputs:
azureSubscription: 'GAzureConnection'
scriptType: 'bash'
scriptLocation: 'inlineScript'
inlineScript: 'az monitor diagnostic-settings subscription list --query "value[? contains(@.name, ''$1'')].name" -o table |grep ''cicdbicep''| awk ''{system(" az monitor diagnostic-settings delete --resource ''"/subscriptions/$(GSubId)"'' --name "$1)}'''
enabled: true
- task: AzureCLI@2
displayName: "Cleanup Resources"
inputs:
azureSubscription: 'GAzureConnection'
scriptType: 'bash'
scriptLocation: 'inlineScript'
inlineScript: 'az group list -o table | grep ''cicdbicep'' | awk ''{system("az group delete -y --no-wait -g "$1)}'''
enabled: true
- job: CommercialCloud_TF
steps:
- task: TerraformInstaller@0
inputs:
terraformVersion: '1.0.8'
- task: AzureCLI@2
displayName: "Deploy MLZ Terraform"
inputs:
azureSubscription: 'CAzureConnection'
scriptType: 'bash'
scriptLocation: 'inlineScript'
addSpnToEnvironment: true
inlineScript: |
export ARM_CLIENT_ID=$(ClientId) `
export ARM_CLIENT_SECRET=$(ClientSecret) `
export ARM_SUBSCRIPTION_ID=$(subId) `
export ARM_TENANT_ID=$(tenantId) `
terraform init
terraform plan -var "hub_subid=$(subid)" -input=false
terraform apply -var "hub_subid=$(subid)" -auto-approve -input=false
workingDirectory: '$(System.DefaultWorkingDirectory)/src/terraform/mlz'
useGlobalConfig: true
enabled: true
- task: AzureCLI@2
displayName: "Teardown MLZ Terraform"
inputs:
azureSubscription: 'CAzureConnection'
scriptType: 'bash'
scriptLocation: 'inlineScript'
addSpnToEnvironment: true
inlineScript: |
export ARM_CLIENT_ID=$(ClientId) `
export ARM_CLIENT_SECRET=$(ClientSecret) `
export ARM_SUBSCRIPTION_ID=$(subId) `
export ARM_TENANT_ID=$(tenantId) `
terraform init
terraform destroy -var "hub_subid=$(subid)" -auto-approve -input=false
workingDirectory: '$(System.DefaultWorkingDirectory)/src/terraform/mlz'
useGlobalConfig: true
enabled: true
- job: GovCloud_TF
steps:
- task: TerraformInstaller@0
inputs:
terraformVersion: '1.0.8'
- task: AzureCLI@2
name: TerraformApplyGov
displayName: "Deploy MLZ Terraform"
inputs:
azureSubscription: 'GAzureConnection'
scriptType: 'bash'
addSpnToEnvironment: true
scriptLocation: 'inlineScript'
inlineScript: |
export ARM_CLIENT_ID=$(GClientId) `
export ARM_CLIENT_SECRET=$(GClientSecret) `
export ARM_SUBSCRIPTION_ID=$(GSubId) `
export ARM_TENANT_ID=$(GTenantId) `
export ARM_ENVIRONMENT=$(CloudEnv) `
terraform init
terraform plan -var "hub_subid=$(GSubid)" -var metadata_host=$(MetadataHost) -var environment=$(CloudEnv) -var location=$(GLocation) -input=false
terraform apply -var "hub_subid=$(GSubid)" -var metadata_host=$(MetadataHost) -var environment=$(CloudEnv) -var location=$(GLocation) -auto-approve -input=false
workingDirectory: '$(System.DefaultWorkingDirectory)/src/terraform/mlz'
useGlobalConfig: true
enabled: true
continueOnError: true
- task: AzureCLI@2
name: TerraformTeardonwGov
displayName: "Teardown MLZ Terraform"
inputs:
azureSubscription: 'GAzureConnection'
scriptType: 'bash'
addSpnToEnvironment: true
scriptLocation: 'inlineScript'
inlineScript: |
az ad signed-in-user show
export ARM_CLIENT_ID=$(GClientId) `
export ARM_CLIENT_SECRET=$(GClientSecret) `
export ARM_SUBSCRIPTION_ID=$(GSubId) `
export ARM_TENANT_ID=$(GTenantId) `
export ARM_ENVIRONMENT=$(CloudEnv) `
terraform init
terraform destroy -var "hub_subid=$(GSubid)" -var metadata_host=$(MetadataHost) -var environment=$(CloudEnv) -var location=$(GLocation) -auto-approve -input=false
workingDirectory: '$(System.DefaultWorkingDirectory)/src/terraform/mlz'
useGlobalConfig: true
enabled: true
Loading