From 916f77f5a84777fd4d6724f04e239968bb1de9e5 Mon Sep 17 00:00:00 2001 From: Erika Gressi Date: Tue, 21 Sep 2021 17:33:18 +0200 Subject: [PATCH 1/6] test workflow template --- .../resource.deployment.template.yml | 189 ++++++++++++++++++ 1 file changed, 189 insertions(+) create mode 100644 .github/workflows/resource.deployment.template.yml diff --git a/.github/workflows/resource.deployment.template.yml b/.github/workflows/resource.deployment.template.yml new file mode 100644 index 0000000000..95e1a3a7a8 --- /dev/null +++ b/.github/workflows/resource.deployment.template.yml @@ -0,0 +1,189 @@ +name: "Resources: Test Pipeline Template" + +on: + workflow_dispatch: + inputs: + removeDeployment: + description: 'Remove deployed module' + required: false + default: 'true' + versioningOption: + description: 'The mode to handle the version increments [major|minor|patch|custom]' + required: false + default: 'patch' + customVersion: + description: 'The version to enforce if [versionOption] is set to [custom]' + required: false + default: '0.0.1' + moduleName: + description: 'moduleName' + required: true + # default: '0.0.1' + modulePath: + description: 'modulePath' + required: true + # default: '0.0.1' + +env: + # moduleName: 'resourceGroups' + # modulePath: 'arm/Microsoft.Resources/resourceGroups' + ARM_CLIENT_ID: ${{ secrets.ARM_CLIENT_ID }} + ARM_CLIENT_SECRET: ${{ secrets.ARM_CLIENT_SECRET }} + ARM_TENANT_ID: ${{ secrets.ARM_TENANT_ID }} + ARM_SUBSCRIPTION_ID: ${{ secrets.ARM_SUBSCRIPTION_ID }} + ARM_MGMTGROUP_ID: ${{ secrets.ARM_MGMTGROUP_ID }} + +jobs: + ################## + # UNIT TESTS # + ################## + # Global tests + # ------------ + job_tests_module_global: + runs-on: ubuntu-20.04 + name: "Run global module tests" + steps: + - name: "Checkout" + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: "Test module" + uses: ./.github/actions/templates/validateModuleGeneral + with: + modulePath: '${{ env.modulePath }}' + moduleName: '${{ env.moduleName}}' + + # Global API tests + # ---------------- + job_tests_module_global_api: + runs-on: ubuntu-20.04 + name: "Run global API module tests" + steps: + - name: "Checkout" + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: "Test module" + uses: ./.github/actions/templates/validateModuleApis + with: + modulePath: '${{ env.modulePath }}' + moduleName: '${{ env.moduleName}}' + + # Validate deployment module tests + # -------------------------------- + job_tests_module_deploy_validate: + runs-on: ubuntu-20.04 + name: "Run deployment validation module tests" + strategy: + matrix: + parameterFilePaths: ['parameters.json'] + steps: + - name: "Checkout" + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Set environment variables + uses: deep-mm/set-variables@v1.0 + with: + # Name of variable file + variableFileName: 'variables.module' # Don't write .json here + - name: "Test module" + uses: ./.github/actions/templates/validateModuleDeploy + with: + templateFilePath: '${{ env.modulePath }}/deploy.json' + parameterFilePath: '${{ env.modulePath }}/parameters/${{ matrix.parameterFilePaths }}' + location: '${{ env.defaultLocation }}' + resourceGroupName: '${{ env.resourceGroupName }}' + subscriptionId: '${{ secrets.ARM_SUBSCRIPTION_ID }}' + managementGroupId: '${{ secrets.ARM_MGMTGROUP_ID }}' + + #################### + # DEPLOY TESTS # + #################### + job_deploy_module: + runs-on: ubuntu-20.04 + name: "Deploy module" + needs: + - job_tests_module_global + - job_tests_module_global_api + - job_tests_module_deploy_validate + strategy: + matrix: + parameterFilePaths: ['parameters.json'] + steps: + - name: "Checkout" + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Set environment variables + uses: deep-mm/set-variables@v1.0 + with: + # Name of variable file + variableFileName: 'variables.module' # Don't write .json here + - name: "Deploy module" + uses: ./.github/actions/templates/deployModule + with: + moduleName: '${{ env.moduleName }}' + templateFilePath: '${{ env.modulePath }}/deploy.json' + parameterFilePath: '${{ env.modulePath }}/parameters/${{ matrix.parameterFilePaths }}' + location: '${{ env.defaultLocation }}' + resourceGroupName: '${{ env.resourceGroupName }}' + subscriptionId: '${{ secrets.ARM_SUBSCRIPTION_ID }}' + managementGroupId: '${{ secrets.ARM_MGMTGROUP_ID }}' + removeDeployment: '${{ github.event.inputs.removeDeployment }}' + + ############### + # PUBLISH # + ############### + job_publish_module: + runs-on: ubuntu-20.04 + name: "Publish module" + needs: + - job_deploy_module + steps: + - name: "Checkout" + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Set environment variables + uses: deep-mm/set-variables@v1.0 + with: + # Name of variable file + variableFileName: 'variables.module' # Don't write .json here + - name: "Publish module" + uses: ./.github/actions/templates/publishModule + with: + templateFilePath: '${{ env.modulePath }}/deploy.json' + componentTemplateSpecRGName: '${{ env.componentTemplateSpecRGName }}' + componentTemplateSpecRGLocation: '${{ env.componentTemplateSpecRGLocation }}' + componentTemplateSpecName: '${{ env.moduleName }}' + componentTemplateSpecDescription: '${{ env.componentTemplateSpecDescription }}' + publishToTemplateSpec: '${{ env.publishToTemplateSpec }}' + versioningOption: '${{ github.event.inputs.versioningOption }}' + customVersion: '${{ github.event.inputs.customVersion }}' + + ############## + # REMOVE # + ############## + job_remove_module: + runs-on: ubuntu-20.04 + name: "Remove module" + if: ${{ github.event.inputs.removeDeployment == 'true' }} + needs: + - job_deploy_module + steps: + - name: "Checkout" + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Set environment variables + uses: deep-mm/set-variables@v1.0 + with: + # Name of variable file + variableFileName: 'variables.module' # Don't write .json here + - name: "Remove module" + uses: ./.github/actions/templates/removeModule + with: + moduleName: '${{ env.moduleName }}' + templateFilePath: '${{ env.modulePath }}/deploy.json' + resourceGroupName: '${{ env.resourceGroupName }}' \ No newline at end of file From 1ef466175f2a3eed57d3d5ce6fd094ba1007e669 Mon Sep 17 00:00:00 2001 From: Erika Gressi Date: Sat, 25 Sep 2021 21:15:06 +0200 Subject: [PATCH 2/6] fix policy assignment to accept westeu --- .../resource.deployment.template.yml | 189 ------------------ .../allowedLocations.parameters.json | 2 +- 2 files changed, 1 insertion(+), 190 deletions(-) delete mode 100644 .github/workflows/resource.deployment.template.yml diff --git a/.github/workflows/resource.deployment.template.yml b/.github/workflows/resource.deployment.template.yml deleted file mode 100644 index 95e1a3a7a8..0000000000 --- a/.github/workflows/resource.deployment.template.yml +++ /dev/null @@ -1,189 +0,0 @@ -name: "Resources: Test Pipeline Template" - -on: - workflow_dispatch: - inputs: - removeDeployment: - description: 'Remove deployed module' - required: false - default: 'true' - versioningOption: - description: 'The mode to handle the version increments [major|minor|patch|custom]' - required: false - default: 'patch' - customVersion: - description: 'The version to enforce if [versionOption] is set to [custom]' - required: false - default: '0.0.1' - moduleName: - description: 'moduleName' - required: true - # default: '0.0.1' - modulePath: - description: 'modulePath' - required: true - # default: '0.0.1' - -env: - # moduleName: 'resourceGroups' - # modulePath: 'arm/Microsoft.Resources/resourceGroups' - ARM_CLIENT_ID: ${{ secrets.ARM_CLIENT_ID }} - ARM_CLIENT_SECRET: ${{ secrets.ARM_CLIENT_SECRET }} - ARM_TENANT_ID: ${{ secrets.ARM_TENANT_ID }} - ARM_SUBSCRIPTION_ID: ${{ secrets.ARM_SUBSCRIPTION_ID }} - ARM_MGMTGROUP_ID: ${{ secrets.ARM_MGMTGROUP_ID }} - -jobs: - ################## - # UNIT TESTS # - ################## - # Global tests - # ------------ - job_tests_module_global: - runs-on: ubuntu-20.04 - name: "Run global module tests" - steps: - - name: "Checkout" - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - name: "Test module" - uses: ./.github/actions/templates/validateModuleGeneral - with: - modulePath: '${{ env.modulePath }}' - moduleName: '${{ env.moduleName}}' - - # Global API tests - # ---------------- - job_tests_module_global_api: - runs-on: ubuntu-20.04 - name: "Run global API module tests" - steps: - - name: "Checkout" - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - name: "Test module" - uses: ./.github/actions/templates/validateModuleApis - with: - modulePath: '${{ env.modulePath }}' - moduleName: '${{ env.moduleName}}' - - # Validate deployment module tests - # -------------------------------- - job_tests_module_deploy_validate: - runs-on: ubuntu-20.04 - name: "Run deployment validation module tests" - strategy: - matrix: - parameterFilePaths: ['parameters.json'] - steps: - - name: "Checkout" - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - name: Set environment variables - uses: deep-mm/set-variables@v1.0 - with: - # Name of variable file - variableFileName: 'variables.module' # Don't write .json here - - name: "Test module" - uses: ./.github/actions/templates/validateModuleDeploy - with: - templateFilePath: '${{ env.modulePath }}/deploy.json' - parameterFilePath: '${{ env.modulePath }}/parameters/${{ matrix.parameterFilePaths }}' - location: '${{ env.defaultLocation }}' - resourceGroupName: '${{ env.resourceGroupName }}' - subscriptionId: '${{ secrets.ARM_SUBSCRIPTION_ID }}' - managementGroupId: '${{ secrets.ARM_MGMTGROUP_ID }}' - - #################### - # DEPLOY TESTS # - #################### - job_deploy_module: - runs-on: ubuntu-20.04 - name: "Deploy module" - needs: - - job_tests_module_global - - job_tests_module_global_api - - job_tests_module_deploy_validate - strategy: - matrix: - parameterFilePaths: ['parameters.json'] - steps: - - name: "Checkout" - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - name: Set environment variables - uses: deep-mm/set-variables@v1.0 - with: - # Name of variable file - variableFileName: 'variables.module' # Don't write .json here - - name: "Deploy module" - uses: ./.github/actions/templates/deployModule - with: - moduleName: '${{ env.moduleName }}' - templateFilePath: '${{ env.modulePath }}/deploy.json' - parameterFilePath: '${{ env.modulePath }}/parameters/${{ matrix.parameterFilePaths }}' - location: '${{ env.defaultLocation }}' - resourceGroupName: '${{ env.resourceGroupName }}' - subscriptionId: '${{ secrets.ARM_SUBSCRIPTION_ID }}' - managementGroupId: '${{ secrets.ARM_MGMTGROUP_ID }}' - removeDeployment: '${{ github.event.inputs.removeDeployment }}' - - ############### - # PUBLISH # - ############### - job_publish_module: - runs-on: ubuntu-20.04 - name: "Publish module" - needs: - - job_deploy_module - steps: - - name: "Checkout" - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - name: Set environment variables - uses: deep-mm/set-variables@v1.0 - with: - # Name of variable file - variableFileName: 'variables.module' # Don't write .json here - - name: "Publish module" - uses: ./.github/actions/templates/publishModule - with: - templateFilePath: '${{ env.modulePath }}/deploy.json' - componentTemplateSpecRGName: '${{ env.componentTemplateSpecRGName }}' - componentTemplateSpecRGLocation: '${{ env.componentTemplateSpecRGLocation }}' - componentTemplateSpecName: '${{ env.moduleName }}' - componentTemplateSpecDescription: '${{ env.componentTemplateSpecDescription }}' - publishToTemplateSpec: '${{ env.publishToTemplateSpec }}' - versioningOption: '${{ github.event.inputs.versioningOption }}' - customVersion: '${{ github.event.inputs.customVersion }}' - - ############## - # REMOVE # - ############## - job_remove_module: - runs-on: ubuntu-20.04 - name: "Remove module" - if: ${{ github.event.inputs.removeDeployment == 'true' }} - needs: - - job_deploy_module - steps: - - name: "Checkout" - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - name: Set environment variables - uses: deep-mm/set-variables@v1.0 - with: - # Name of variable file - variableFileName: 'variables.module' # Don't write .json here - - name: "Remove module" - uses: ./.github/actions/templates/removeModule - with: - moduleName: '${{ env.moduleName }}' - templateFilePath: '${{ env.modulePath }}/deploy.json' - resourceGroupName: '${{ env.resourceGroupName }}' \ No newline at end of file diff --git a/arm/Microsoft.Authorization/policyAssignments/parameters/allowedLocations.parameters.json b/arm/Microsoft.Authorization/policyAssignments/parameters/allowedLocations.parameters.json index cf753f50a5..c1146e8da7 100644 --- a/arm/Microsoft.Authorization/policyAssignments/parameters/allowedLocations.parameters.json +++ b/arm/Microsoft.Authorization/policyAssignments/parameters/allowedLocations.parameters.json @@ -11,7 +11,7 @@ "parameters": { "value": { "listOfAllowedLocations": { - "value": ["westus","westus2"] + "value": ["westus","westus2","westeu"] } } }, From 88095b00ed6e357c1dba44122bc926ed967aaf2c Mon Sep 17 00:00:00 2001 From: Erika Gressi Date: Wed, 6 Oct 2021 12:35:44 +0200 Subject: [PATCH 3/6] update msi --- .../applicationGateways/parameters/parameters.json | 2 +- .../deploymentScripts/parameters/parameters.json | 4 ++-- .../imageTemplates/parameters/parameters.json | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/arm/Microsoft.Network/applicationGateways/parameters/parameters.json b/arm/Microsoft.Network/applicationGateways/parameters/parameters.json index 969d7bef8d..d7aa23eedb 100644 --- a/arm/Microsoft.Network/applicationGateways/parameters/parameters.json +++ b/arm/Microsoft.Network/applicationGateways/parameters/parameters.json @@ -24,7 +24,7 @@ "value": "/subscriptions/8629be3b-96bc-482d-a04b-ffff597c65a2/resourceGroups/dependencies-rg/providers/Microsoft.Network/publicIPAddresses/sxx-az-pip-weu-x-003" }, "managedIdentityResourceId": { - "value": "/subscriptions/8629be3b-96bc-482d-a04b-ffff597c65a2/resourceGroups/dependencies-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/sxx-az-msi-weu-x-002" + "value": "/subscriptions/8629be3b-96bc-482d-a04b-ffff597c65a2/resourceGroups/validation-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/adp-sxx-az-msi-weu-x-001" }, "sslCertificateKeyVaultSecretId": { "value": "https://sxx-az-kv-weu-x-004.vault.azure.net/secrets/applicationGatewaySslCertificate/b664f0004c734e838c42091705b001b6" diff --git a/arm/Microsoft.Resources/deploymentScripts/parameters/parameters.json b/arm/Microsoft.Resources/deploymentScripts/parameters/parameters.json index 41deb9f2a4..ffb17e0cc2 100644 --- a/arm/Microsoft.Resources/deploymentScripts/parameters/parameters.json +++ b/arm/Microsoft.Resources/deploymentScripts/parameters/parameters.json @@ -6,10 +6,10 @@ "value": "sxx-az-ds-weu-x-001" }, "userMsiName": { - "value": "sxx-az-msi-weu-x-002" + "value": "adp-sxx-az-msi-weu-x-001" }, "userMsiResourceGroup": { - "value": "dependencies-rg" + "value": "validation-rg" }, "kind": { "value": "AzurePowerShell" diff --git a/arm/Microsoft.VirtualMachineImages/imageTemplates/parameters/parameters.json b/arm/Microsoft.VirtualMachineImages/imageTemplates/parameters/parameters.json index 4a488c58b3..166ea578af 100644 --- a/arm/Microsoft.VirtualMachineImages/imageTemplates/parameters/parameters.json +++ b/arm/Microsoft.VirtualMachineImages/imageTemplates/parameters/parameters.json @@ -9,10 +9,10 @@ "value": "eastus" }, "userMsiName": { - "value": "sxx-az-msi-weu-x-002" + "value": "adp-sxx-az-msi-weu-x-001" }, "userMsiResourceGroup": { - "value": "dependencies-rg" + "value": "validation-rg" }, "buildTimeoutInMinutes": { "value": 0 From 77c25e0b22496b872247f143774b257e9a9781d4 Mon Sep 17 00:00:00 2001 From: Erika Gressi Date: Wed, 6 Oct 2021 12:39:55 +0200 Subject: [PATCH 4/6] update sid --- .../imageTemplates/parameters/parameters.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arm/Microsoft.VirtualMachineImages/imageTemplates/parameters/parameters.json b/arm/Microsoft.VirtualMachineImages/imageTemplates/parameters/parameters.json index 166ea578af..5ff801781f 100644 --- a/arm/Microsoft.VirtualMachineImages/imageTemplates/parameters/parameters.json +++ b/arm/Microsoft.VirtualMachineImages/imageTemplates/parameters/parameters.json @@ -50,7 +50,7 @@ "value": "sxx-az-umi-weu-x-001" }, "sigImageDefinitionId": { - "value": "/subscriptions/8629be3b-96bc-482d-a04b-ffff597c65a2/resourceGroups/dependencies-rg/providers/Microsoft.Compute/galleries/sxxazsigweux001/images/sxx-az-imgd-weu-x-002" + "value": "/subscriptions/8629be3b-96bc-482d-a04b-ffff597c65a2/resourceGroups/validation-rg/providers/Microsoft.Compute/galleries/sxxazsigweux001/images/adp-sxx-az-imgd-weu-x-001" }, "imageReplicationRegions": { "value": [] From ae541496213f0395f12dc655e1837231fb8557ce Mon Sep 17 00:00:00 2001 From: Erika Gressi Date: Wed, 6 Oct 2021 12:40:57 +0200 Subject: [PATCH 5/6] update sig --- .../imageTemplates/parameters/parameters.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arm/Microsoft.VirtualMachineImages/imageTemplates/parameters/parameters.json b/arm/Microsoft.VirtualMachineImages/imageTemplates/parameters/parameters.json index 5ff801781f..1ce9e94343 100644 --- a/arm/Microsoft.VirtualMachineImages/imageTemplates/parameters/parameters.json +++ b/arm/Microsoft.VirtualMachineImages/imageTemplates/parameters/parameters.json @@ -50,7 +50,7 @@ "value": "sxx-az-umi-weu-x-001" }, "sigImageDefinitionId": { - "value": "/subscriptions/8629be3b-96bc-482d-a04b-ffff597c65a2/resourceGroups/validation-rg/providers/Microsoft.Compute/galleries/sxxazsigweux001/images/adp-sxx-az-imgd-weu-x-001" + "value": "/subscriptions/8629be3b-96bc-482d-a04b-ffff597c65a2/resourceGroups/validation-rg/providers/Microsoft.Compute/galleries/adpsxxazsigweux001/images/adp-sxx-az-imgd-weu-x-001" }, "imageReplicationRegions": { "value": [] From 6f1aa3681d74fc5f662bd79da8e22f2f4bc1aadf Mon Sep 17 00:00:00 2001 From: Erika Gressi Date: Wed, 6 Oct 2021 12:45:42 +0200 Subject: [PATCH 6/6] update sig sid --- arm/Microsoft.Compute/galleries/parameters/parameters.json | 2 +- .../galleriesResources/images/parameters/parameters.json | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/arm/Microsoft.Compute/galleries/parameters/parameters.json b/arm/Microsoft.Compute/galleries/parameters/parameters.json index 1a9cdcc8a8..f25470357d 100644 --- a/arm/Microsoft.Compute/galleries/parameters/parameters.json +++ b/arm/Microsoft.Compute/galleries/parameters/parameters.json @@ -3,7 +3,7 @@ "contentVersion": "1.0.0.0", "parameters": { "galleryName": { - "value": "sxxazsigweux003" + "value": "sxxazsigweux001" } } } diff --git a/arm/Microsoft.Compute/galleriesResources/images/parameters/parameters.json b/arm/Microsoft.Compute/galleriesResources/images/parameters/parameters.json index b004bc3052..7c50774095 100644 --- a/arm/Microsoft.Compute/galleriesResources/images/parameters/parameters.json +++ b/arm/Microsoft.Compute/galleriesResources/images/parameters/parameters.json @@ -9,7 +9,7 @@ "value": "westeurope" }, "galleryName": { - "value": "sxxazsigweux003" + "value": "adpsxxazsigweux001" }, "osType": { "value": "Windows" @@ -24,7 +24,7 @@ "value": "WindowsServer" }, "sku": { - "value": "2019-Datacenter" + "value": "2019-Datacenter-Core" }, "minRecommendedvCPUs": { "value": 2