66 apigee_environment :
77 required : true
88 type : string
9- build_recordprocessor_image :
9+ build_recordprocessor_override :
1010 required : false
1111 type : boolean
12- default : false
12+ default : true
1313 create_mns_subscription :
1414 required : false
1515 type : boolean
4343 - dev
4444 - preprod
4545 - prod
46- build_recordprocessor_image :
46+ build_recordprocessor_override :
4747 description : Build and push a new recordprocessor image for this deployment
4848 required : false
4949 type : boolean
50- default : false
50+ default : true
5151 sub_environment :
5252 type : string
5353 description : Set the sub environment name e.g. pr-xxx, or green/blue in higher environments
@@ -56,12 +56,31 @@ env: # Sonarcloud - do not allow direct usage of untrusted data
5656 APIGEE_ENVIRONMENT : ${{ inputs.apigee_environment }}
5757 ENVIRONMENT : ${{ inputs.environment }}
5858 SUB_ENVIRONMENT : ${{ inputs.sub_environment }}
59+ build_recordprocessor : true
5960
6061run-name : Deploy Backend - ${{ inputs.environment }} ${{ inputs.sub_environment }}
6162
6263jobs :
64+ detect-recordprocessor-changes :
65+ runs-on : ubuntu-latest
66+ if : github.event.action != 'opened' || github.event.action != 'reopened' || !inputs.build_recordprocessor_override
67+ steps :
68+ - name : Checkout
69+ uses : actions/checkout@0c366fd6a839edf440554fa01a7085ccba70ac98
70+ with :
71+ fetch-depth : 0
72+
73+ - name : Detect recordprocessor changes in PR
74+ id : detect
75+ run : |
76+ if git diff --quiet "${{ github.event.before }}" "${{ github.sha }}" -- lambdas/recordprocessor/ lambdas/shared/src/common/; then
77+ echo "build_record_processor=false" >> "$GITHUB_OUTPUT"
78+ else
79+ echo "build_record_processor=true" >> "$GITHUB_OUTPUT"
80+ fi
81+
6382 build-and-push-recordprocessor :
64- if : ${{ inputs.build_recordprocessor_image }}
83+ if : ${{ env.build_record_processor || inputs.build_recordprocessor_override }}
6584 permissions :
6685 id-token : write
6786 contents : read
@@ -104,7 +123,7 @@ jobs:
104123 echo "recordprocessor_image_tag=${IMAGE_TAG}" >> "$GITHUB_OUTPUT"
105124
106125 resolve-recordprocessor-image-tag :
107- if : ${{ !inputs.build_recordprocessor_image }}
126+ if : ${{ !env.build_record_processor || ! inputs.build_recordprocessor_override }}
108127 permissions :
109128 id-token : write
110129 contents : read
@@ -114,8 +133,6 @@ jobs:
114133 runs-on : ubuntu-latest
115134 environment :
116135 name : ${{ inputs.environment }}
117- env :
118- AWS_REGION : eu-west-2
119136 steps :
120137 - name : Connect to AWS
121138 uses : aws-actions/configure-aws-credentials@8df5847569e6427dd6c4fb1cf565c83acfa8afa7
@@ -129,6 +146,7 @@ jobs:
129146 env :
130147 REPOSITORY_NAME : imms-recordprocessor-repo
131148 TAG_PREFIX : ${{ inputs.sub_environment }}-
149+ AWS_REGION : eu-west-2
132150 run : |
133151 IMAGE_TAG=$(
134152 aws ecr describe-images \
@@ -144,7 +162,7 @@ jobs:
144162
145163 if [ -z "${IMAGE_TAG}" ]; then
146164 echo "No existing recordprocessor image found for prefix '${TAG_PREFIX}'."
147- echo "Trigger a run with build_recordprocessor_image =true to build one."
165+ echo "Trigger a run with build_recordprocessor =true to build one."
148166 exit 1
149167 fi
150168
0 commit comments