Skip to content

Commit 26571e7

Browse files
authored
Github Action for new image version validation (#579)
2 parents 56a2a27 + 12a2e42 commit 26571e7

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed

.github/workflows/validate-image.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: New Image Version Tests and Reports
2+
run-name: Image Validation - ${{ inputs.image-version }}
3+
on:
4+
# Manually call
5+
workflow_dispatch:
6+
inputs:
7+
image-version:
8+
required: true
9+
description: Image version to validate=
10+
# Call from other workflow
11+
workflow_call:
12+
inputs:
13+
image-version:
14+
type: string
15+
required: true
16+
defaults:
17+
run:
18+
shell: bash -l {0}
19+
jobs:
20+
get-pr-number:
21+
runs-on: ubuntu-latest
22+
name: Get PR Number by title
23+
outputs:
24+
pr_id: ${{ steps.get_pr_id.outputs.pr_id }}
25+
steps:
26+
- name: Get PR number
27+
id: get_pr_id
28+
env:
29+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
30+
run: |
31+
PR=$(gh pr list --search "in:title 'release: v${{ inputs.image-version }}'" --json number --jq '.[0].number')
32+
echo "pr_id=$PR" >> $GITHUB_OUTPUT
33+
call-codebuild-project:
34+
runs-on: ubuntu-latest
35+
needs: get-pr-number
36+
permissions:
37+
pull-requests: write
38+
contents: write
39+
id-token: write
40+
steps:
41+
- name: Configure AWS Credentials
42+
uses: aws-actions/configure-aws-credentials@v4
43+
with:
44+
role-to-assume: ${{ secrets.START_CODEBUILD_ROLE }}
45+
aws-region: us-east-1
46+
# CodeBuild timeout of 8 hours
47+
role-duration-seconds: 28800
48+
audience: https://sts.us-east-1.amazonaws.com
49+
- name: Run CodeBuild
50+
uses: dark-mechanicum/aws-codebuild@v1
51+
env:
52+
CODEBUILD__sourceVersion: 'pr/${{ needs.get-pr-number.outputs.pr_id }}'
53+
with:
54+
projectName: ${{ secrets.CODEBUILD_VALIDATION_JOB_NAME }}
55+
buildspec: '{"imageOverride": "aws/codebuild/standard:7.0", "imagePullCredentialsTypeOverride": "CODEBUILD"}'

0 commit comments

Comments
 (0)