@@ -3,6 +3,30 @@ name: deploy helmfile
3
3
on :
4
4
workflow_call :
5
5
inputs :
6
+ awsRoleArn :
7
+ description : AWS IAM role ARN
8
+ required : false
9
+ type : string
10
+ useOIDC :
11
+ description : Whether to use OIDC for assume role
12
+ required : false
13
+ type : boolean
14
+ default : false
15
+ githubOIDCRoleArn :
16
+ description : Github OIDC role ARN
17
+ required : false
18
+ type : string
19
+ default : " "
20
+ awsRegion :
21
+ description : AWS region
22
+ required : false
23
+ type : string
24
+ default : us-east-1
25
+ awsSessionDuration :
26
+ description : AWS session duration
27
+ required : false
28
+ type : number
29
+ default : 3600
6
30
revision :
7
31
description : Tag given to container image
8
32
required : true
23
47
description : Other helmfile parameters
24
48
required : false
25
49
type : string
26
- awsRoleArn :
27
- description : AWS IAM role ARN
28
- required : false
29
- type : string
30
- awsRegion :
31
- description : AWS region
32
- required : false
33
- type : string
34
- default : us-east-1
35
- awsSessionDuration :
36
- description : AWS session duration
37
- required : false
38
- type : number
39
- default : 3600
40
50
envVariables :
41
51
description : Space separated list of environment variables to be set during helmfile apply
42
52
required : false
63
73
required : false
64
74
default : true
65
75
type : string
76
+ runner :
77
+ description : Runner to use
78
+ required : false
79
+ type : string
80
+ default : ubuntu-22.04
81
+
66
82
67
83
secrets :
68
84
awsAccessKeyId :
69
85
description : AWS access key ID
70
- required : true
86
+ required : false
71
87
awsSecretAccessKey :
72
88
description : AWS secret access key
73
- required : true
89
+ required : false
74
90
slackToken :
75
91
description : Slack API token
76
92
required : false
89
105
90
106
jobs :
91
107
deploy :
92
- runs-on : ubuntu-latest
108
+ runs-on : ${{ inputs.runner }}
93
109
steps :
94
110
- name : clone repository
95
111
uses : actions/checkout@v4
@@ -141,29 +157,32 @@ jobs:
141
157
# NOTE: This will go away with terraform
142
158
- name : setup dependencies
143
159
env :
144
- # TODD: remove eksctl as it is not used anymore
145
- EKSCTL_VERSION : v0.98.0
146
160
# renovate: datasource=github-releases depName=helmfile/helmfile
147
- HELMFILE_VERSION : ' v0.155.1 '
161
+ HELMFILE_VERSION : ' v0.171.0 '
148
162
# renovate: datasource=github-releases depName=databus23/helm-diff
149
163
HELM_DIFF_PLUGIN_VERSION : v3.9.6
150
164
run : |
151
165
HELMFILE_VERSION_WITHOUT_PREFIX=${HELMFILE_VERSION:1}
152
- curl -fsSL -o eksctl.tar.gz https://github.com/weaveworks/eksctl/releases/download/${{ env.EKSCTL_VERSION }}/eksctl_Linux_amd64.tar.gz
153
- curl -fsSL -o helmfile.tar.gz https://github.com/helmfile/helmfile/releases/download/${{ env.HELMFILE_VERSION }}/helmfile_${HELMFILE_VERSION_WITHOUT_PREFIX}_linux_amd64.tar.gz
166
+
167
+ # Determine architecture based on runner
168
+ ARCH="amd64"
169
+ if [[ "${{ inputs.runner }}" == *"arm"* ]]; then
170
+ ARCH="arm64"
171
+ fi
172
+
173
+ curl -fsSL -o helmfile.tar.gz https://github.com/helmfile/helmfile/releases/download/${{ env.HELMFILE_VERSION }}/helmfile_${HELMFILE_VERSION_WITHOUT_PREFIX}_linux_${ARCH}.tar.gz
154
174
155
175
helm plugin install https://github.com/databus23/helm-diff --version ${{ env.HELM_DIFF_PLUGIN_VERSION }}
156
176
157
177
mkdir -p $HOME/.local/bin
158
178
159
- tar -C $HOME/.local/bin/ -xf ./eksctl.tar.gz
160
179
tar -C $HOME/.local/bin/ -xf ./helmfile.tar.gz
161
180
162
181
chmod +x $HOME/.local/bin/*
163
182
echo "$HOME/.local/bin" >> $GITHUB_PATH
164
183
165
184
- name : assume IAM role
166
- if : inputs.awsRoleArn != ''
185
+ if : inputs.useOIDC == false
167
186
uses : aws-actions/configure-aws-credentials@v4
168
187
with :
169
188
aws-access-key-id : ${{ secrets.awsAccessKeyId }}
@@ -176,6 +195,30 @@ jobs:
176
195
# which does not work for cross-account assume
177
196
role-skip-session-tagging : true
178
197
198
+ # First assume GithubOIDCRole role, the trust relationship between GitHub and AWS is defined in IAM GithubOIDCRole in the organization account. This role has permissions to assume Deployer roles only.
199
+ - name : assume GithubOIDCRole
200
+ if : inputs.useOIDC == true
201
+ uses : aws-actions/configure-aws-credentials@v4
202
+ with :
203
+ aws-region : ${{ inputs.awsRegion }}
204
+ role-to-assume : ${{ inputs.githubOIDCRoleArn }}
205
+ role-duration-seconds : ${{ inputs.awsSessionDuration }}
206
+
207
+ # This parameter is needed otherwise this action is trying to tag session
208
+ # which does not work for cross-account assume
209
+ role-skip-session-tagging : true
210
+
211
+ # Then assume Deployer role, which can be assumed by GithubOIDCRole and has all the permissions needed to deploy cloudformation stacks.
212
+ - name : assume Deployer role
213
+ if : inputs.useOIDC == true
214
+ uses : aws-actions/configure-aws-credentials@v4
215
+ with :
216
+ aws-region : ${{ inputs.awsRegion }}
217
+ role-to-assume : ${{ inputs.awsRoleArn }}
218
+ role-duration-seconds : ${{ inputs.awsSessionDuration }}
219
+ role-chaining : true
220
+ role-skip-session-tagging : true
221
+
179
222
- name : setup kubeconfig
180
223
run : aws eks update-kubeconfig --name ${{ inputs.eksClusterName }} $OPTIONAL_PARAMS
181
224
0 commit comments