Skip to content

Commit 7bac214

Browse files
authored
Ecrtest 3 (#10)
* update dockerfile for test * make architecture easier to manage * attempt without arch file Also, cleanup and expand the summary output
1 parent ead81c8 commit 7bac214

File tree

3 files changed

+59
-5
lines changed

3 files changed

+59
-5
lines changed

.github/workflows/dev-build.yml

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,41 @@ permissions:
1616
contents: read
1717

1818
jobs:
19+
prep:
20+
runs-on: ubuntu-latest
21+
outputs:
22+
cpuarch: ${{ steps.setarch.outputs.cpuarch }}
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v5
26+
27+
- name: Set CPU Architecture
28+
id: setarch
29+
run: |
30+
echo "### Architecture Selection" >> $GITHUB_STEP_SUMMARY
31+
if [[ -f .aws-architecture ]]; then
32+
ARCH=$(cat .aws-architecture)
33+
echo "\`$ARCH\` was read from \`.aws-architecture\` and passed to the deploy job." >> $GITHUB_STEP_SUMMARY
34+
else
35+
ARCH="linux/amd64"
36+
echo "No \`.aws-architecture\` file, so default \`$ARCH\` was passed to the deploy job." >> $GITHUB_STEP_SUMMARY
37+
fi
38+
if [[ "$ARCH" != "linux/arm64" && "$ARCH" != "linux/amd64" ]]; then
39+
echo "$ARCH is INVALID architecture!"
40+
echo "$ARCH is INVALID architecture!" >> $GITHUB_STEP_SUMMARY
41+
exit 1
42+
fi
43+
echo "cpuarch=$ARCH" >> $GITHUB_OUTPUT
44+
1945
deploy:
46+
needs: prep
2047
name: Dev Container Deploy
2148
uses: mitlibraries/.github/.github/workflows/ecr-multi-arch-deploy-dev.yml@multi-arch-deploy
2249
secrets: inherit
2350
with:
2451
AWS_REGION: "us-east-1"
2552
GHA_ROLE: "ecr-workflow-test-gha-dev"
2653
ECR: "ecr-workflow-test-dev"
27-
CPU_ARCH: "linux/arm64"
54+
CPU_ARCH: ${{ needs.prep.outputs.cpuarch }}
2855
# FUNCTION: ""
2956
# PREBUILD:

.github/workflows/stage-build.yml

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,41 @@ permissions:
1616
contents: read
1717

1818
jobs:
19+
prep:
20+
runs-on: ubuntu-latest
21+
outputs:
22+
cpuarch: ${{ steps.setarch.outputs.cpuarch }}
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v5
26+
27+
- name: Set CPU Architecture
28+
id: setarch
29+
run: |
30+
echo "### Architecture Selection" >> $GITHUB_STEP_SUMMARY
31+
if [[ -f .aws-architecture ]]; then
32+
ARCH=$(cat .aws-architecture)
33+
echo "\`$ARCH\` was read from \`.aws-architecture\` and passed to the deploy job." >> $GITHUB_STEP_SUMMARY
34+
else
35+
ARCH="linux/amd64"
36+
echo "No \`.aws-architecture\` file, so default \`$ARCH\` was passed to the deploy job." >> $GITHUB_STEP_SUMMARY
37+
fi
38+
if [[ "$ARCH" != "linux/arm64" && "$ARCH" != "linux/amd64" ]]; then
39+
echo "$ARCH is INVALID architecture!"
40+
echo "$ARCH is INVALID architecture!" >> $GITHUB_STEP_SUMMARY
41+
exit 1
42+
fi
43+
echo "cpuarch=$ARCH" >> $GITHUB_OUTPUT
44+
1945
deploy:
46+
needs: prep
2047
name: Stage Container Deploy
2148
uses: mitlibraries/.github/.github/workflows/ecr-multi-arch-deploy-stage.yml@multi-arch-deploy
2249
secrets: inherit
2350
with:
2451
AWS_REGION: "us-east-1"
2552
GHA_ROLE: "ecr-workflow-test-gha-stage"
2653
ECR: "ecr-workflow-test-stage"
27-
CPU_ARCH: "linux/arm64"
54+
CPU_ARCH: ${{ needs.prep.outputs.cpuarch }}
2855
# FUNCTION: ""
2956
# PREBUILD:

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ DATETIME:=$(shell date -u +%Y%m%dT%H%M%SZ)
33
### This is the Terraform-generated header for ecr-workflow-test-dev. If ###
44
### this is a Lambda repo, uncomment the FUNCTION line below ###
55
### and review the other commented lines in the document. ###
6-
ECR_NAME_DEV:=ecr-workflow-test-dev
7-
ECR_URL_DEV:=222053980223.dkr.ecr.us-east-1.amazonaws.com/ecr-workflow-test-dev
8-
CPU_ARCH:=linux/arm64
6+
ECR_NAME_DEV := ecr-workflow-test-dev
7+
ECR_URL_DEV := 222053980223.dkr.ecr.us-east-1.amazonaws.com/ecr-workflow-test-dev
8+
CPU_ARCH ?= $(shell cat .aws-architecture)
99
### End of Terraform-generated header ###
1010

1111
help: # Preview Makefile commands

0 commit comments

Comments
 (0)