Skip to content

Commit c40e50c

Browse files
Merge branch 'main' into vdelev_auto_release_part_2
2 parents a42f0bd + 6077d00 commit c40e50c

File tree

2 files changed

+65
-13
lines changed

2 files changed

+65
-13
lines changed

.github/actions/get-ecr-scan-result/action.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,18 @@ runs:
5353
- name: Get AWS ECR Scan results
5454
id: get-scan-results
5555
run: |
56-
aws ecr wait image-scan-complete --repository-name $ECR_REPOSITORY --image-id imageTag=$IMAGE_TAG
57-
if [ $(echo $?) -eq 0 ]; then
56+
# As the image scan itself may not be started yet, we have to wait (and retry) until it is actually available
57+
max_retries=5
58+
retries=0
59+
scan_complete=1
60+
until [ $retries -eq $max_retries ]; do
61+
aws ecr wait image-scan-complete --repository-name $ECR_REPOSITORY --image-id imageTag=$IMAGE_TAG && scan_complete=0 && break
62+
sleep 5
63+
retries=$((retries + 1))
64+
echo "Retry $retries/$max_retries: Waiting for image scan to start..."
65+
done
66+
67+
if [ $scan_complete -eq 0 ]; then
5868
scan_findings=$(aws ecr describe-image-scan-findings --repository-name $ECR_REPOSITORY --image-id imageTag=$IMAGE_TAG | jq '.imageScanFindings.findingSeverityCounts')
5969
critical=$(echo $scan_findings | jq '.CRITICAL')
6070
high=$(echo $scan_findings | jq '.HIGH')

.github/workflows/build-node-python.yml

Lines changed: 53 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -215,23 +215,43 @@ jobs:
215215
ports:
216216
# will assign a random free host port
217217
- 5432/tcp
218-
218+
redis:
219+
image: redis:6
220+
options: >-
221+
--health-cmd "redis-cli ping"
222+
--health-interval 10s
223+
--health-timeout 5s
224+
--health-retries 5
225+
--name redis_${{ github.job }}_${{ inputs.deduplication_id }}_${{ github.run_id }}_${{ github.run_attempt }}
226+
ports:
227+
- 6379/tcp
228+
219229
steps:
220230
- name: Set self-hosted env variable to github env
221231
run: echo "GH_ACTIONS_SELF_HOSTED_NETWORK_NAME=${GH_ACTIONS_SELF_HOSTED_NETWORK_NAME}" >> "$GITHUB_ENV"
222-
- name: Set github token, hostname, port and docker network for self-hosted runner
232+
- name: Set up custom postgres and redis hostname, port and docker network for self-hosted runner
223233
if: env.GH_ACTIONS_SELF_HOSTED_NETWORK_NAME != ''
224-
run: |
234+
env:
235+
REDIS_HOSTNAME: redis_${{ github.job }}_${{ inputs.deduplication_id }}_${{ github.run_id }}_${{ github.run_attempt }}
236+
REDIS_PORT: 6379
237+
run: |
225238
{
226239
echo "POSTGRES_HOSTNAME=postgres_${{ github.job }}_${{ inputs.deduplication_id }}_${{ github.run_id }}_${{ github.run_attempt }}"
227240
echo "POSTGRES_PORT=5432"
241+
echo "REDIS_HOSTNAME=redis_${{ github.job }}_${{ inputs.deduplication_id }}_${{ github.run_id }}_${{ github.run_attempt }}"
242+
echo "REDIS_PORT=6379"
228243
} >> "$GITHUB_ENV"
229-
docker network connect ${{ env.GH_ACTIONS_SELF_HOSTED_NETWORK_NAME }} "postgres_${{ github.job }}_${{ inputs.deduplication_id }}_${{ github.run_id }}_${{ github.run_attempt }}"
230-
- name: Set postgres connection details to hosted runner
244+
docker network connect ${{ env.GH_ACTIONS_SELF_HOSTED_NETWORK_NAME }} ${{ env.POSTGRES_HOSTNAME }}
245+
docker network connect ${{ env.GH_ACTIONS_SELF_HOSTED_NETWORK_NAME }} ${{ env.REDIS_HOSTNAME }}
246+
- name: Set service connection details to hosted runner
231247
if: env.GH_ACTIONS_SELF_HOSTED_NETWORK_NAME == ''
232248
run: |
233-
echo "POSTGRES_HOSTNAME=localhost" >> "$GITHUB_ENV"
234-
echo "POSTGRES_PORT=${{ job.services.postgres.ports['5432'] }}" >> "$GITHUB_ENV"
249+
{
250+
echo "POSTGRES_HOSTNAME=localhost"
251+
echo "POSTGRES_PORT=${{ job.services.postgres.ports['5432'] }}"
252+
echo "REDIS_HOSTNAME=localhost"
253+
echo "REDIS_PORT=${{ job.services.redis.ports['6379'] }}"
254+
} >> "$GITHUB_ENV"
235255
- name: Checkout source repository
236256
uses: actions/checkout@v4
237257
with:
@@ -334,23 +354,45 @@ jobs:
334354
ports:
335355
# will assign a random free host port
336356
- 5432/tcp
357+
358+
redis:
359+
image: redis:6
360+
options: >-
361+
--health-cmd "redis-cli ping"
362+
--health-interval 10s
363+
--health-timeout 5s
364+
--health-retries 5
365+
--name redis_${{ github.job }}_${{ inputs.deduplication_id }}_${{ github.run_id }}_${{ github.run_attempt }}
366+
ports:
367+
- 6379/tcp
337368

338369
steps:
339370
- name: Set system env variable to github env
340371
run: echo "GH_ACTIONS_SELF_HOSTED_NETWORK_NAME=${GH_ACTIONS_SELF_HOSTED_NETWORK_NAME}" >> "$GITHUB_ENV"
341-
- name: Set github token, hostname, port and docker network for self-hosted runner
372+
- name: Set up custom postgres and redis hostname, port and docker network for self-hosted runner
342373
if: env.GH_ACTIONS_SELF_HOSTED_NETWORK_NAME != ''
374+
env:
375+
REDIS_HOSTNAME: redis_${{ github.job }}_${{ inputs.deduplication_id }}_${{ github.run_id }}_${{ github.run_attempt }}
376+
REDIS_PORT: 6379
343377
run: |
344378
{
345379
echo "POSTGRES_HOSTNAME=postgres_${{ github.job }}_${{ inputs.deduplication_id }}_${{ github.run_id }}_${{ github.run_attempt }}"
346380
echo "POSTGRES_PORT=5432"
381+
echo "REDIS_HOSTNAME=redis_${{ github.job }}_${{ inputs.deduplication_id }}_${{ github.run_id }}_${{ github.run_attempt }}"
382+
echo "REDIS_PORT=6379"
347383
} >> "$GITHUB_ENV"
348384
docker network connect ${{ env.GH_ACTIONS_SELF_HOSTED_NETWORK_NAME }} ${{ env.POSTGRES_HOSTNAME }}
349-
- name: Set postgres connection details to hosted runner
385+
docker network connect ${{ env.GH_ACTIONS_SELF_HOSTED_NETWORK_NAME }} ${{ env.REDIS_HOSTNAME }}
386+
387+
- name: Set service connection details to hosted runner
350388
if: env.GH_ACTIONS_SELF_HOSTED_NETWORK_NAME == ''
351389
run: |
352-
echo "POSTGRES_HOSTNAME=localhost" >> "$GITHUB_ENV"
353-
echo "POSTGRES_PORT=${{ job.services.postgres.ports['5432'] }}" >> "$GITHUB_ENV"
390+
{
391+
echo "POSTGRES_HOSTNAME=localhost"
392+
echo "POSTGRES_PORT=${{ job.services.postgres.ports['5432'] }}"
393+
echo "REDIS_HOSTNAME=localhost"
394+
echo "REDIS_PORT=${{ job.services.redis.ports['6379'] }}"
395+
} >> "$GITHUB_ENV"
354396
- name: Checkout source repository
355397
uses: actions/checkout@v4
356398
with:

0 commit comments

Comments
 (0)