File tree Expand file tree Collapse file tree 5 files changed +29
-10
lines changed Expand file tree Collapse file tree 5 files changed +29
-10
lines changed Original file line number Diff line number Diff line change 7
7
git-sha :
8
8
description : The git commit sha to build the image from.
9
9
type : string
10
- git_ref_to_deploy :
11
- required : false
12
- type : string
13
10
14
11
concurrency :
15
12
group : build-and-push-image-${{ inputs.git-sha || github.sha }}
68
65
uses : actions/checkout@v4
69
66
with :
70
67
ref : ${{ inputs.git-sha || github.sha }}
71
- - name : Write build metadata
72
- run : |
73
- git rev-parse HEAD > public/sha
74
- echo "${{ inputs.git_ref_to_deploy || github.ref_name }}" > public/ref
68
+ - name : Write build SHA
69
+ run : git rev-parse HEAD > public/sha
75
70
- name : Build Docker image
76
71
run : docker build -t "mavis:latest" .
77
72
- name : Save Docker image
Original file line number Diff line number Diff line change 20
20
description : Docker image tag to deploy
21
21
required : false
22
22
type : string
23
+ git_ref_to_deploy :
24
+ required : true
25
+ type : string
26
+
23
27
workflow_call :
24
28
inputs :
25
29
environment :
29
33
image_tag :
30
34
required : false
31
35
type : string
36
+ git_ref_to_deploy :
37
+ required : true
38
+ type : string
32
39
33
40
permissions : {}
34
41
@@ -141,12 +148,15 @@ jobs:
141
148
run : sudo snap install --classic aws-cli
142
149
- name : Check if any deployments are running
143
150
run : ../scripts/check-for-running-deployments.sh ${{ inputs.environment }}
151
+ - name : Set Mavis app version
152
+ run : |
153
+ echo "APP_VERSION=${{ inputs.git_ref_to_deploy }}" >> $GITHUB_ENV
144
154
- name : Terraform Plan
145
155
id : plan
146
156
run : |
147
157
set -e
148
158
terraform init -backend-config="env/${{ inputs.environment }}-backend.hcl" -upgrade
149
- terraform plan -var="image_digest=$DIGEST" -var-file="env/${{ inputs.environment }}.tfvars" \
159
+ terraform plan -var="image_digest=$DIGEST" -var="app_version=$APP_VERSION" -var -file="env/${{ inputs.environment }}.tfvars" \
150
160
-out ${{ runner.temp }}/tfplan | tee ${{ runner.temp }}/tf_stdout
151
161
- name : Validate the changes
152
162
run : |
Original file line number Diff line number Diff line change 85
85
with :
86
86
environment : ${{ inputs.environment }}
87
87
image_tag : ${{ needs.determine-git-sha.outputs.git-sha }}
88
+ git_ref_to_deploy : ${{ inputs.git_ref_to_deploy || github.ref_name }}
88
89
deploy-application :
89
90
permissions :
90
91
id-token : write
Original file line number Diff line number Diff line change 1
1
# frozen_string_literal: true
2
2
3
- path = Rails . root . join ( "public/ref" )
3
+ version = ENV [ "APP_VERSION" ]
4
+ if Rails . env . production? && version . present? &&
5
+ !version . match? ( /\A v\d +(\. \d +)+\z / )
6
+ version = nil
7
+ end
4
8
5
- version = File . read ( path ) . strip if File . exist? ( path )
6
9
APP_VERSION = version . presence
Original file line number Diff line number Diff line change @@ -157,6 +157,12 @@ variable "enable_splunk" {
157
157
nullable = false
158
158
}
159
159
160
+ variable "app_version" {
161
+ type = string
162
+ description = " The version identifier for the MAVIS application deployment"
163
+ nullable = false
164
+ }
165
+
160
166
locals {
161
167
is_production = var. environment == " production"
162
168
parameter_store_variables = tomap ({
@@ -202,6 +208,10 @@ locals {
202
208
{
203
209
name = " MAVIS__SPLUNK__ENABLED"
204
210
value = var.enable_splunk ? " true" : " false"
211
+ },
212
+ {
213
+ name = " APP_VERSION"
214
+ value = var.app_version
205
215
}
206
216
]
207
217
task_secrets = concat ([
You can’t perform that action at this time.
0 commit comments