-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yaml
More file actions
143 lines (126 loc) · 4.1 KB
/
action.yaml
File metadata and controls
143 lines (126 loc) · 4.1 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: 'Runtime Rollback Action'
description: 'Action to perform a Self-Hosted Rollback to a previously deployed tag'
inputs:
CLIENT_ID:
description: Account client id
required: true
CLIENT_KEY:
description: Account client secret key
required: true
CLIENT_REALM:
description: Account client realm
required: true
WORKSPACE:
description: Workspace used to deploy
required: true
ENVIRONMENT:
description: Environment used to deploy
required: true
VERSION_TAG:
description: Rollback version version tag
required: true
TF_STATE_BUCKET_NAME:
description: Bucket to save generated tfstate files
required: true
TF_STATE_REGION:
description: Region configuration for tfstate
required: true
IAC_BUCKET_NAME:
description: Bucket to save generated iac files
required: true
IAC_REGION:
description: Region configuration for iac
required: true
VERBOSE:
description: Verbose configuration
required: false
WORKDIR:
description: Path to the directory where the .stk is located.
required: false
default: "./"
BETA_ENVIRONMENT:
description: Environment in which rollback will be executed. (default, stg, dev).
required: false
type: string
default: default
outputs:
tasks:
description: "RUN TASK LIST"
value: ${{ steps.deploy.outputs.tasks }}
run_id:
description: "RUN ID"
value: ${{ steps.deploy.outputs.run_id }}
runs:
using: "composite"
steps:
- name: Check Runner
run: echo 🤖 OS runner is $(uname)
shell: bash
- name: check envs
run: |
echo "${{ inputs.TF_STATE_BUCKET_NAME }}"
echo "${{ inputs.IAC_REGION }}"
shell: bash
- name: Get os version
run: |
cat /etc/os-release
uname -r
shell: bash
- name: Check glibc version
run: |
ldd --version
shell: bash
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v4.7.1
with:
python-version: '3.10'
- name: Install python libraries
run: pip install requests ruamel-yaml==0.17.33
shell: bash
- name: Define Domains
id: stackspot-url
run: |
if [ "${{ inputs.BETA_CLI_ENVIRONMENT }}" == "stg" ]; then
STACKSPOT_IAM_URL="https://iam-auth-ssr.stg.stackspot.com"
STACKSPOT_RUNTIME_MANAGER_URL="https://runtime-manager.stg.stackspot.com"
elif [ "${{ inputs.BETA_CLI_ENVIRONMENT }}" == "dev" ]; then
STACKSPOT_IAM_URL="https://iam-auth-ssr.dev.stackspot.com"
STACKSPOT_RUNTIME_MANAGER_URL="https://runtime-manager.dev.stackspot.com"
else
STACKSPOT_IAM_URL="https://auth.stackspot.com"
STACKSPOT_RUNTIME_MANAGER_URL="https://runtime-manager.stackspot.com"
fi
echo "iam=$STACKSPOT_IAM_URL" >> "$GITHUB_OUTPUT"
echo "runtime_manager=$STACKSPOT_RUNTIME_MANAGER_URL" >> "$GITHUB_OUTPUT"
shell: bash
- name: Start Self-Hosted Rollback run with Runtime
id: deploy
working-directory: ${{ inputs.WORKDIR }}
env:
CLIENT_ID: ${{ inputs.CLIENT_ID }}
CLIENT_KEY: ${{ inputs.CLIENT_KEY }}
CLIENT_REALM: ${{ inputs.CLIENT_REALM }}
TF_STATE_BUCKET_NAME: ${{ inputs.TF_STATE_BUCKET_NAME }}
TF_STATE_REGION: ${{ inputs.TF_STATE_REGION }}
IAC_BUCKET_NAME: ${{ inputs.IAC_BUCKET_NAME }}
IAC_REGION: ${{ inputs.IAC_REGION }}
VERBOSE: ${{ inputs.VERBOSE }}
VERSION_TAG: ${{ inputs.VERSION_TAG }}
ENVIRONMENT: ${{ inputs.ENVIRONMENT }}
STACKSPOT_IAM_URL: ${{ steps.stackspot-url.outputs.iam }}
STACKSPOT_RUNTIME_MANAGER_URL: ${{ steps.stackspot-url.outputs.runtime_manager }}
run: |
if [ ${{runner.os}} != 'Windows' ]; then
python3 ${{ github.action_path }}/runtime.py
elif [ ${{runner.os}} == 'Windows' ]; then
python ${{ github.action_path }}\runtime.py
else
echo "${{runner.os}} not supported"
exit 1
fi
shell: bash
branding:
icon: 'terminal'
color: 'gray-dark'