-
Notifications
You must be signed in to change notification settings - Fork 2
/
action.yml
67 lines (63 loc) · 1.79 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
62
63
64
65
66
67
name: 'Setup Cloud Custodian'
description: 'Set up the latest version of cloud custodian and add the
CLI to the PATH'
branding:
icon: play-circle
color: yellow
inputs:
custodian-version:
description: "Install a particular version of cloud custodian"
include-azure:
description: "Installs the c7n_azure extension if set to true"
default: false
include-gcp:
description: "Installs the c7n_gcp extension if set to true"
default: false
include-c7n-org:
description: "Installs the c7n-org extension if set to true"
default: false
runs:
using: "composite"
steps:
- name: "Install cloud custodian"
shell: "bash"
run: |
python3 -m venv custodian
source custodian/bin/activate
VERSION_ARG=""
if [ "${{ inputs.custodian-version }}" ]; then
VERSION_ARG="== ${{ inputs.custodian-version }}"
fi
pip install --quiet -Iv c7n"${VERSION_ARG}"
dir=$(pwd)
cat << EOF > /usr/local/bin/custodian
#!/bin/bash
source ${dir}/custodian/bin/activate
custodian "\$@"
EOF
chmod +x /usr/local/bin/custodian
- name: "Install azure extension"
if: ${{ inputs.include-azure }}
shell: "bash"
run: |
source custodian/bin/activate
pip install --quiet c7n_azure
- name: "Install gcp extension"
if: ${{ inputs.include-gcp }}
shell: "bash"
run: |
source custodian/bin/activate
pip install --quiet c7n_gcp
- name: "Install c7n-org extension"
if: ${{ inputs.include-c7n-org }}
shell: "bash"
run: |
source custodian/bin/activate
pip install --quiet c7n-org
dir=$(pwd)
cat << EOF > /usr/local/bin/c7n-org
#!/bin/bash
source ${dir}/custodian/bin/activate
c7n-org "\$@"
EOF
chmod +x /usr/local/bin/c7n-org