Repository navigation
143 lines (137 loc) · 5.73 KB
/
Copy pathtemplate.module.yml
File metadata and controls
143 lines (137 loc) · 5.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
name: '.Template - Module Pipeline'
on:
workflow_call:
inputs:
workflowInput:
type: string
description: 'Input from the workflow caller in JSON format'
required: true
moduleTestFilePaths:
type: string
description: 'List of relative path to the module test files in JSON format'
required: true
modulePath:
type: string
description: 'Relative path to the module folder'
required: true
env:
variablesPath: 'settings.yml'
AZURE_CREDENTIALS: ${{ secrets.AZURE_CREDENTIALS }}
ARM_SUBSCRIPTION_ID: '${{ secrets.ARM_SUBSCRIPTION_ID }}'
ARM_MGMTGROUP_ID: '${{ secrets.ARM_MGMTGROUP_ID }}'
ARM_TENANT_ID: '${{ secrets.ARM_TENANT_ID }}'
TOKEN_NAMEPREFIX: '${{ secrets.TOKEN_NAMEPREFIX }}'
jobs:
#########################
# Static validation #
#########################
job_module_static_validation: # Note: Please don't change this job name. It is used by the setEnvironment action to define which PS modules to install on runners.
name: 'Static validation'
runs-on: ubuntu-latest
if: (fromJson(inputs.workflowInput)).staticValidation == 'true'
steps:
- name: 'Checkout'
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set environment
uses: ./.github/actions/templates/setEnvironment
with:
variablesPath: ${{ env.variablesPath }}
- name: 'Run tests'
uses: ./.github/actions/templates/validateModulePester
with:
modulePath: '${{ inputs.modulePath }}'
moduleTestFilePath: '${{ env.moduleTestFilePath }}'
#########################
# PSRule validation #
#########################
job_psrule_test: # Note: Please don't change this job name. It is used by the setEnvironment action to define which PS modules to install on runners.
name: 'PSRule validation'
runs-on: ubuntu-latest
if: (fromJson(inputs.workflowInput)).staticValidation == 'true'
strategy:
fail-fast: false
matrix:
moduleTestFilePaths: ${{ fromJson(inputs.moduleTestFilePaths) }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set environment
uses: ./.github/actions/templates/setEnvironment
with:
variablesPath: ${{ env.variablesPath }}
- name: Set PSRule validation
uses: ./.github/actions/templates/validateModulePSRule
with:
templateFilePath: '${{ inputs.modulePath }}/${{ matrix.moduleTestFilePaths }}'
subscriptionId: '${{ secrets.ARM_SUBSCRIPTION_ID }}'
managementGroupId: '${{ secrets.ARM_MGMTGROUP_ID }}'
#############################
# Deployment validation #
#############################
job_module_deploy_validation: # Note: Please don't change this job name. It is used by the setEnvironment action to define which PS modules to install on runners.
name: 'Deployment validation'
runs-on: ubuntu-latest
if: |
!cancelled() &&
(fromJson(inputs.workflowInput)).deploymentValidation == 'true' &&
needs.job_module_static_validation.result != 'failure'
needs:
- job_module_static_validation
# - job_psrule_test # Ignoring dependency whilst PSRule gets bedded in, in this project
strategy:
fail-fast: false
matrix:
moduleTestFilePaths: ${{ fromJson(inputs.moduleTestFilePaths) }}
steps:
- name: 'Checkout'
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set environment
uses: ./.github/actions/templates/setEnvironment
with:
variablesPath: ${{ env.variablesPath }}
removeDeployment: '${{ fromJson(inputs.workflowInput).removeDeployment }}'
- name: 'Using test file [${{ matrix.moduleTestFilePaths }}]'
uses: ./.github/actions/templates/validateModuleDeployment
with:
templateFilePath: '${{ inputs.modulePath }}/${{ matrix.moduleTestFilePaths }}'
location: '${{ env.location }}'
subscriptionId: '${{ secrets.ARM_SUBSCRIPTION_ID }}'
managementGroupId: '${{ secrets.ARM_MGMTGROUP_ID }}'
removeDeployment: '${{ fromJson(inputs.workflowInput).removeDeployment }}'
##################
# Publishing #
##################
job_publish_module: # Note: Please don't change this job name. It is used by the setEnvironment action to define which PS modules to install on runners.
name: 'Publishing'
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master' || fromJson(inputs.workflowInput).prerelease == 'true'
needs:
- job_module_deploy_validation
steps:
- name: 'Checkout'
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set environment
uses: ./.github/actions/templates/setEnvironment
with:
variablesPath: ${{ env.variablesPath }}
- name: 'Publishing'
uses: ./.github/actions/templates/publishModule
with:
templateFilePath: '${{ inputs.modulePath }}/main.bicep'
subscriptionId: '${{ secrets.ARM_SUBSCRIPTION_ID }}'
templateSpecsRGName: '${{ env.templateSpecsRGName }}'
templateSpecsRGLocation: '${{ env.templateSpecsRGLocation }}'
templateSpecsDescription: '${{ env.templateSpecsDescription }}'
templateSpecsDoPublish: '${{ env.templateSpecsDoPublish }}'
bicepRegistryName: '${{ env.bicepRegistryName }}'
bicepRegistryRGName: '${{ env.bicepRegistryRGName }}'
bicepRegistryRgLocation: '${{ env.bicepRegistryRgLocation }}'
bicepRegistryDoPublish: '${{ env.bicepRegistryDoPublish }}'
publishLatest: '${{ env.publishLatest }}'
useApiSpecsAlignedName: '${{ env.useApiSpecsAlignedName }}'