forked from globalbao/azure-policy-as-code
-
Notifications
You must be signed in to change notification settings - Fork 0
84 lines (80 loc) · 2.63 KB
/
Bicep-CD-Tests.yml
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
name: Bicep-CD-Tests
on:
push:
branches: [ main ]
paths:
- '**.bicep'
- '**.json'
schedule:
- cron: "0 0 * * *" #at the end of every day
workflow_dispatch:
jobs:
Bicep-ValidationTests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: ARM TTK
uses: docker://ghcr.io/github/super-linter:slim-v4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VALIDATE_ALL_CODEBASE: false
DEFAULT_BRANCH: main
VALIDATE_JSON: true
- name: Bicep Build
uses: aliencube/[email protected]
with:
files: '**/*.bicep'
Bicep-CD-Tests-Sub-Scope:
needs: Bicep-ValidationTests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Azure Login
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS_PROD }}
- name: Bicep CD
id: bicepCD
continue-on-error: true
uses: azure/CLI@v1
with:
inlineScript: |
az deployment sub create -f ./Bicep/modules/sub_main.bicep -l australiaeast -p ./Bicep/modules/sub_main_params.json -o none
- name: Sleep for 30s
if: ${{ steps.bicepCD.outcome == 'failure' && steps.bicepCD.conclusion == 'success' }}
uses: juliangruber/sleep-action@v1
with:
time: 30s
- name: Bicep CD Retry
if: ${{ steps.bicepCD.outcome == 'failure' && steps.bicepCD.conclusion == 'success' }}
uses: azure/CLI@v1
with:
inlineScript: |
az deployment sub create -f ./Bicep/modules/sub_main.bicep -l australiaeast -p ./Bicep/modules/sub_main_params.json -o none
Bicep-CD-Tests-MG-Scope:
needs: Bicep-CD-Tests-Sub-Scope
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Azure Login
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS_PROD }}
- name: Bicep CD
id: bicepCD
continue-on-error: true
uses: azure/CLI@v1
with:
inlineScript: |
az deployment mg create -f ./Bicep/modules/mg_main.bicep -l australiaeast -m PRODUCTION -p ./Bicep/modules/mg_main_params.json -o none
- name: Sleep for 30s
if: ${{ steps.bicepCD.outcome == 'failure' && steps.bicepCD.conclusion == 'success' }}
uses: juliangruber/sleep-action@v1
with:
time: 30s
- name: Bicep CD Retry
if: ${{ steps.bicepCD.outcome == 'failure' && steps.bicepCD.conclusion == 'success' }}
uses: azure/CLI@v1
with:
inlineScript: |
az deployment mg create -f ./Bicep/modules/mg_main.bicep -l australiaeast -m PRODUCTION -p ./Bicep/modules/mg_main_params.json -o none