-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yml
61 lines (57 loc) · 1.71 KB
/
action.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
name: "Monte Carlo Apply Monitors"
description: "Apply montecarlo monitors"
branding:
icon: 'arrow-up-circle'
color: 'green'
inputs:
MCD_DEFAULT_API_ID:
description: '[Secret] MonteCarlo token ID'
required: true
MCD_DEFAULT_API_TOKEN:
description: '[Secret] MonteCarlo API token'
required: true
MONITORS_FOLDER:
description: 'Top level folder containing monitors, within which is folders for each namespace'
default: 'monitors'
DRY_RUN:
description: '(true / false) Whether to run as dry run or deploy the monitors (normally on main branch only)'
default: 'false'
runs:
using: "composite"
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: MonteCarlo install
shell: bash
run: pip install -U -q montecarlodata
- name: MonteCarlo configure
shell: bash
env:
MCD_DEFAULT_API_ID: ${{ inputs.MCD_DEFAULT_API_ID }}
MCD_DEFAULT_API_TOKEN: ${{ inputs.MCD_DEFAULT_API_TOKEN }}
run: montecarlo configure --mcd-id $MCD_DEFAULT_API_ID --mcd-token $MCD_DEFAULT_API_TOKEN
- name: MonteCarlo deploy
shell: bash
env:
MONITORS_FOLDER: ${{ inputs.MONITORS_FOLDER }}
DRY_RUN: ${{ inputs.DRY_RUN }}
run: |
for dir in $MONITORS_FOLDER/* ; do
if $DRY_RUN
then
echo "Dry run of monitors in $dir"
pushd ./$dir
montecarlo monitors apply --dry-run
popd
else
echo "Applying monitors in $dir"
pushd ./$dir
montecarlo monitors apply --auto-yes
popd
fi
done || {
echo "Error applying monitors in $dir"
exit 1
}