-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yaml
127 lines (117 loc) · 4.34 KB
/
action.yaml
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
name: "Run Runtime Action Deploy"
description: "Runs Runtime Action Deploy with parameters"
inputs:
FEATURES_LEVEL_LOG:
description: "Log Level"
required: true
CLIENT_ID:
description: "CLIENT ID"
required: true
CLIENT_KEY:
description: "CLIENT KEY"
required: true
CLIENT_REALM:
description: "CLIENT REALM"
required: true
REPOSITORY_NAME:
description: "Git Repository Name"
required: true
AWS_ACCESS_KEY_ID:
description: "AWS ACCESS KEY ID from console"
required: false
AWS_SECRET_ACCESS_KEY:
description: "AWS SECRET ACCESS KEY from console"
required: false
AWS_SESSION_TOKEN:
description: "AWS SESSION TOKEN from console"
required: false
AWS_REGION:
description: "AWS REGION"
required: true
AWS_ROLE_ARN:
description: "AWS ROLE ARN"
required: false
RUN_TASK_ID:
description: "Runtime Run Task Id"
required: true
CONTAINER_URL:
description: "Deploy Container url"
default: stackspot/runtime-job-deploy:latest
required: false
FEATURES_TERRAFORM_MODULES:
description: "Terraform Modules"
required: false
PATH_TO_MOUNT:
description: "Path to mount inside the docker"
required: true
default: ${{ github.workspace }}
OUTPUT_FILE:
description: "File name to save outputs"
required: false
default: outputs.json
LOCALEXEC_ENABLED:
description: "If Runtimes will allow execution of the local-exec command within terraform"
required: false
default: false
TF_LOG_PROVIDER:
description: "Level tf log provider - info, debug, warn or trace"
required: false
CHECKOUT_BRANCH:
description: "Whether or not checkout is enabled."
required: false
default: 'false'
runs:
using: "composite"
steps:
- name: Checkout
if: inputs.CHECKOUT_BRANCH != 'false'
uses: actions/checkout@v4
- name: Check Runner
run: echo 🤖 OS runner is $(uname)
shell: bash
- name: Configure aws credentials
id: aws-cred
if: ${{ inputs.AWS_ROLE_ARN != 0 }}
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ inputs.AWS_ROLE_ARN }}
aws-region: ${{ inputs.AWS_REGION }}
output-credentials: true
- name: Run Runtime Action Deploy
run: |
FLAGS=$(echo "-v ${{ inputs.PATH_TO_MOUNT }}:/app-volume \
-e FEATURES_LEVEL_LOG=${{ inputs.FEATURES_LEVEL_LOG }} \
-e AUTHENTICATE_CLIENT_ID=${{ inputs.CLIENT_ID }} \
-e AUTHENTICATE_CLIENT_SECRET=${{ inputs.CLIENT_KEY }} \
-e AUTHENTICATE_CLIENT_REALMS=${{ inputs.CLIENT_REALM }} \
-e AUTHENTICATE_URL=https://idm.stackspot.com \
-e REPOSITORY_NAME=${{ inputs.REPOSITORY_NAME }} \
-e FEATURES_API_MANAGER=https://runtime-manager.v1.stackspot.com \
-e FEATURES_BASEPATH_TMP=/tmp/runtime/deploys \
-e FEATURES_BASEPATH_EBS=/opt/runtime \
-e FEATURES_TEMPLATES_FILEPATH=/app/ \
-e FEATURES_BASEPATH_TERRAFORM=/root/.asdf/shims/terraform \
-e AWS_REGION=${{ inputs.AWS_REGION }} \
-e FEATURES_RELEASE_LOCALEXEC=${{ inputs.LOCALEXEC_ENABLED }}")
if [ -z "${{ inputs.AWS_ROLE_ARN }}" ]; then
FLAGS=$(echo "$FLAGS -e AWS_ACCESS_KEY_ID=${{ inputs.AWS_ACCESS_KEY_ID }}")
FLAGS=$(echo "$FLAGS -e AWS_SECRET_ACCESS_KEY=${{ inputs.AWS_SECRET_ACCESS_KEY }}")
FLAGS=$(echo "$FLAGS -e AWS_SESSION_TOKEN=${{ inputs.AWS_SESSION_TOKEN }}")
fi
if [ ! -z "${{ inputs.AWS_ROLE_ARN }}" ]; then
FLAGS=$(echo "$FLAGS -e AWS_ACCESS_KEY_ID=${{ steps.aws-cred.outputs.aws-access-key-id }}")
FLAGS=$(echo "$FLAGS -e AWS_SECRET_ACCESS_KEY=${{ steps.aws-cred.outputs.aws-secret-access-key }}")
FLAGS=$(echo "$FLAGS -e AWS_SESSION_TOKEN=${{ steps.aws-cred.outputs.aws-session-token }}")
fi
if [ ! -z "${{ inputs.TF_LOG_PROVIDER }}" ]; then
FLAGS=$(echo "$FLAGS -e FEATURES_TERRAFORM_LOGPROVIDER=${{ inputs.TF_LOG_PROVIDER }}")
fi
docker run --rm \
$FLAGS \
-e FEATURES_TERRAFORM_MODULES='${{ inputs.FEATURES_TERRAFORM_MODULES }}' \
--entrypoint=/app/stackspot-runtime-job-deploy \
${{ inputs.CONTAINER_URL }} start --run-task-id="${{ inputs.RUN_TASK_ID }}" --output-file="${{ inputs.OUTPUT_FILE }}"
shell: bash
branding:
icon: 'terminal'
color: 'orange'