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 arm/bicep deployment to pipelinewitness ci #8151

Merged
merged 10 commits into from
Apr 23, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ parameters:
- name: Staging
type: object
default: {}
- name: ProductionArmSteps
type: stepList
default: []
- name: StagingArmSteps
type: stepList
default: []

stages:
- stage: Build
Expand Down Expand Up @@ -38,8 +44,21 @@ stages:
- stage: Staging
dependsOn: Build
jobs:
- ${{ if ne(length(parameters.StagingArmSteps), 0) }}:
- deployment: PublishArm
environment: ${{ parameters.Staging.EnvironmentName }}
pool:
name: azsdk-pool-mms-ubuntu-2204-general
vmImage: ubuntu-22.04
hallipr marked this conversation as resolved.
Show resolved Hide resolved
strategy:
runOnce:
deploy:
steps: ${{ parameters.StagingArmSteps }}

- deployment: PublishFunction
environment: ${{ parameters.Staging.EnvironmentName }}
${{ if ne(length(parameters.StagingArmSteps), 0) }}:
dependsOn: PublishArm
pool:
name: azsdk-pool-mms-ubuntu-2204-general
vmImage: ubuntu-22.04
Expand All @@ -65,8 +84,21 @@ stages:
- stage: Production
dependsOn: Staging
jobs:
- ${{ if ne(length(parameters.ProductionArmSteps), 0) }}:
- deployment: PublishArm
environment: ${{ parameters.Production.EnvironmentName }}
pool:
name: azsdk-pool-mms-ubuntu-2204-general
vmImage: ubuntu-22.04
hallipr marked this conversation as resolved.
Show resolved Hide resolved
strategy:
runOnce:
deploy:
steps: ${{ parameters.ProductionArmSteps }}

- deployment: PublishFunction
environment: ${{ parameters.Production.EnvironmentName }}
${{ if ne(length(parameters.ProductionArmSteps), 0) }}:
dependsOn: PublishArm
pool:
name: azsdk-pool-mms-ubuntu-2204-general
vmImage: ubuntu-22.04
Expand Down
18 changes: 18 additions & 0 deletions tools/pipeline-witness/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,26 @@ extends:
ResourceGroupName: pipelinewitnessprod
AzureSubscription: Azure SDK Engineering System
ResourceName: pipelinewitnessprod-app
ProductionArmSteps:
- checkout: self
- task: AzureCLI@2
displayName: 'Deploy ARM Template'
inputs:
azureSubscription: Azure SDK Engineering System
scriptType: pscore
scriptPath: tools/pipeline-witness/infrastructure/deploy.ps1
arguments: '-target production'
Staging:
EnvironmentName: package-publish
ResourceGroupName: pipelinewitnessstaging
AzureSubscription: Azure SDK Engineering System
ResourceName: pipelinewitnessstaging-app
StagingArmSteps:
- checkout: self
- task: AzureCLI@2
displayName: 'Deploy ARM Template'
inputs:
azureSubscription: Azure SDK Engineering System
scriptType: pscore
scriptPath: tools/pipeline-witness/infrastructure/deploy.ps1
arguments: '-target staging'
6 changes: 6 additions & 0 deletions tools/pipeline-witness/infrastructure/deploy.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ try {

Write-Host "> az deployment sub create --template-file './bicep/resourceGroup.bicep' --parameters $parametersFile --location $location --name $deploymentName"
az deployment sub create --template-file './bicep/resourceGroup.bicep' --parameters $parametersFile --location $location --name $deploymentName
if($LASTEXITCODE -eq 0) {
Write-Host "Deployed resource group"
} else {
Write-Error "Failed to deploy resource group"
exit 1
}
} finally {
Pop-Location
}