Skip to content

Commit 4eea72b

Browse files
committed
Merge remote-tracking branch 'origin/main' into cdk_construct
2 parents a907676 + 80d1145 commit 4eea72b

File tree

6 files changed

+52
-42
lines changed

6 files changed

+52
-42
lines changed

.devcontainer/Dockerfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
FROM mcr.microsoft.com/devcontainers/base:ubuntu
22

3-
43
ARG TARGETARCH
54
ENV TARGETARCH=${TARGETARCH}
65

.github/workflows/docker_image_build.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,19 @@ jobs:
1919
packages: read
2020
steps:
2121
- name: Checkout code
22-
uses: actions/checkout@v5
22+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
2323
with:
2424
ref: ${{ env.BRANCH_NAME }}
2525

2626
- name: Build cdk-utils-build Docker image
2727
id: build-cdk-utils-build-image
28+
env:
29+
VERSION_NUMBER: ${{ inputs.VERSION_NUMBER }}
2830
run: |
29-
docker build -t "cdk-utils-build:${{ inputs.VERSION_NUMBER }}" -f docker/Dockerfile --build-arg VERSION=${{ inputs.VERSION_NUMBER }} .
30-
docker save "cdk-utils-build:${{ inputs.VERSION_NUMBER }}" -o cdk-utils-build.img
31+
docker build -t "cdk-utils-build:${VERSION_NUMBER}" -f docker/Dockerfile --build-arg VERSION="${VERSION_NUMBER}" .
32+
docker save "cdk-utils-build:${VERSION_NUMBER}" -o cdk-utils-build.img
3133
32-
- uses: actions/upload-artifact@v4
34+
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
3335
name: Upload docker images
3436
with:
3537
name: docker_artifact

.github/workflows/docker_image_upload.yml

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ on:
2121
secrets:
2222
CDK_PUSH_IMAGE_ROLE:
2323
required: true
24-
24+
2525
jobs:
2626
upload_docker_image:
2727
runs-on: ubuntu-22.04
@@ -32,22 +32,22 @@ jobs:
3232

3333
steps:
3434
- name: Checkout local github actions
35-
uses: actions/checkout@v5
35+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
3636
with:
3737
ref: ${{ env.BRANCH_NAME }}
3838
fetch-depth: 0
3939
sparse-checkout: |
4040
.github
4141
4242
- name: Configure AWS Credentials
43-
uses: aws-actions/configure-aws-credentials@v5
43+
uses: aws-actions/configure-aws-credentials@00943011d9042930efac3dcd3a170e4273319bc8
4444
with:
4545
aws-region: eu-west-2
4646
role-to-assume: ${{ secrets.CDK_PUSH_IMAGE_ROLE }}
4747
role-session-name: upload-cdk-utils-build
4848

4949
- name: docker_artifact download
50-
uses: actions/download-artifact@v5
50+
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0
5151
with:
5252
name: docker_artifact
5353
path: .
@@ -60,23 +60,28 @@ jobs:
6060
- name: Retrieve AWS Account ID
6161
id: retrieve-account-id
6262
run: echo "ACCOUNT_ID=$(aws sts get-caller-identity --query Account --output text)" >> "$GITHUB_ENV"
63-
63+
6464
- name: Login to Amazon ECR
6565
id: login-ecr
6666
run: |
6767
aws ecr get-login-password --region eu-west-2 | docker login --username AWS --password-stdin ${{ env.ACCOUNT_ID }}.dkr.ecr.eu-west-2.amazonaws.com
6868
6969
- name: Push tagged version cdk-utils-build to Amazon ECR
70+
env:
71+
VERSION_NUMBER: ${{ inputs.VERSION_NUMBER }}
72+
DOCKER_IMAGE_TAG: ${{ inputs.DOCKER_IMAGE_TAG }}
7073
run: |
71-
docker tag "cdk-utils-build:${{ inputs.VERSION_NUMBER }}" "${{ env.ACCOUNT_ID }}.dkr.ecr.eu-west-2.amazonaws.com/cdk-utils-build-repo:${{ inputs.DOCKER_IMAGE_TAG }}"
72-
docker push "${{ env.ACCOUNT_ID }}.dkr.ecr.eu-west-2.amazonaws.com/cdk-utils-build-repo:${{ inputs.DOCKER_IMAGE_TAG }}"
74+
docker tag "cdk-utils-build:${VERSION_NUMBER}" "${ACCOUNT_ID}.dkr.ecr.eu-west-2.amazonaws.com/cdk-utils-build-repo:${DOCKER_IMAGE_TAG}"
75+
docker push "${ACCOUNT_ID}.dkr.ecr.eu-west-2.amazonaws.com/cdk-utils-build-repo:${DOCKER_IMAGE_TAG}"
7376
7477
- name: Push latest cdk-utils-build to Amazon ECR
7578
if: ${{ inputs.TAG_LATEST == true }}
79+
env:
80+
VERSION_NUMBER: ${{ inputs.VERSION_NUMBER }}
7681
run: |
77-
docker tag "cdk-utils-build:${{ inputs.VERSION_NUMBER }}" "${{ env.ACCOUNT_ID }}.dkr.ecr.eu-west-2.amazonaws.com/cdk-utils-build-repo:latest"
78-
docker push "${{ env.ACCOUNT_ID }}.dkr.ecr.eu-west-2.amazonaws.com/cdk-utils-build-repo:latest"
79-
82+
docker tag "cdk-utils-build:${VERSION_NUMBER}" "${ACCOUNT_ID}.dkr.ecr.eu-west-2.amazonaws.com/cdk-utils-build-repo:latest"
83+
docker push "${ACCOUNT_ID}.dkr.ecr.eu-west-2.amazonaws.com/cdk-utils-build-repo:latest"
84+
8085
- name: Check cdk-utils-build scan results
8186
env:
8287
REPOSITORY_NAME: cdk-utils-build-repo

.github/workflows/pull_request.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
issue_number: ${{steps.get_issue_number.outputs.result}}
4242

4343
steps:
44-
- uses: actions/github-script@v8
44+
- uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd
4545
name: get issue number
4646
id: get_issue_number
4747
with:

docker/Dockerfile

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,51 @@
11
FROM ubuntu:24.04
22

3+
ARG TARGETARCH
4+
ENV TARGETARCH=${TARGETARCH}
5+
6+
ARG ASDF_VERSION
7+
COPY .tool-versions.asdf /tmp/.tool-versions.asdf
8+
39
ARG VERSION
410

511
RUN apt-get update \
612
&& export DEBIAN_FRONTEND=noninteractive \
7-
&& apt-get -y upgrade
8-
9-
RUN export DEBIAN_FRONTEND=noninteractive \
13+
&& apt-get -y upgrade \
1014
&& apt-get -y install --no-install-recommends ca-certificates curl git jq make unzip wget \
1115
&& apt-get clean
1216

1317
# install aws stuff
14-
ADD https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip /tmp/awscliv2.zip
15-
RUN unzip /tmp/awscliv2.zip -d /tmp/aws-cli && \
18+
# Download correct AWS CLI for arch
19+
RUN if [ "$TARGETARCH" = "arm64" ] || [ "$TARGETARCH" == "aarch64" ]; then \
20+
wget -O /tmp/awscliv2.zip "https://awscli.amazonaws.com/awscli-exe-linux-aarch64.zip"; \
21+
else \
22+
wget -O /tmp/awscliv2.zip "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip"; \
23+
fi && \
24+
unzip /tmp/awscliv2.zip -d /tmp/aws-cli && \
1625
/tmp/aws-cli/aws/install && \
17-
rm tmp/awscliv2.zip && \
18-
rm -rf /tmp/aws-cli
26+
rm /tmp/awscliv2.zip && rm -rf /tmp/aws-cli
27+
28+
# Install ASDF
29+
RUN ASDF_VERSION=$(awk '!/^#/ && NF {print $1; exit}' /tmp/.tool-versions.asdf) && \
30+
if [ "$TARGETARCH" = "arm64" ] || [ "$TARGETARCH" = "aarch64" ]; then \
31+
wget -O /tmp/asdf.tar.gz https://github.com/asdf-vm/asdf/releases/download/v${ASDF_VERSION}/asdf-v${ASDF_VERSION}-linux-arm64.tar.gz; \
32+
else \
33+
wget -O /tmp/asdf.tar.gz https://github.com/asdf-vm/asdf/releases/download/v${ASDF_VERSION}/asdf-v${ASDF_VERSION}-linux-amd64.tar.gz; \
34+
fi && \
35+
tar -xvzf /tmp/asdf.tar.gz && \
36+
mv asdf /usr/bin
1937

2038
RUN useradd -ms /bin/bash cdkuser
2139
RUN chown -R cdkuser /home/cdkuser
2240
WORKDIR /home/cdkuser
2341
USER cdkuser
24-
# Install ASDF
25-
RUN git clone https://github.com/asdf-vm/asdf.git /home/cdkuser/.asdf --branch v0.14.1; \
26-
echo '. /home/cdkuser/.asdf/asdf.sh' >> ~/.bashrc; \
27-
echo '. /home/cdkuser/.asdf/completions/asdf.bash' >> ~/.bashrc; \
28-
echo 'PATH="$PATH:/home/cdkuser/.asdf/bin/"' >> ~/.bashrc;
2942

30-
ENV PATH="$PATH:/home/cdkuser/.asdf/bin/:/home/cdkuser/node_modules/.bin"
43+
ENV PATH="$PATH:/home/cdkuser/.asdf/shims/:/home/cdkuser/node_modules/.bin"
3144

3245
# Install ASDF plugins
3346
RUN asdf plugin add nodejs https://github.com/asdf-vm/asdf-nodejs.git
3447
# install some common node versions that are used in builds to speed things up
35-
RUN asdf install nodejs 20.19.1; \
36-
asdf install nodejs 23.9.0
37-
# update npm
38-
RUN export ASDF_DIR=/home/cdkuser/.asdf && \
39-
. /home/cdkuser/.asdf/asdf.sh && \
40-
asdf shell nodejs 20.19.1 && \
41-
cd ~/.asdf/installs/nodejs/20.19.1/lib && npm update npm
48+
RUN asdf install nodejs 22.20.0;
4249

4350
# copy files needed for deployment
4451
COPY --chown=cdkuser docker/entrypoint.sh /home/cdkuser/

docker/entrypoint.sh

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,27 +9,24 @@ echo "**************************************"
99
echo
1010
echo
1111

12-
if [ -z "${CDK_APP_PATH}" ]; then
12+
if [[ -z "${CDK_APP_PATH}" ]]; then
1313
echo "CDK_APP_PATH is unset or set to the empty string"
1414
exit 1
1515
fi
1616

17-
# shellcheck source=/dev/null
18-
source /home/cdkuser/.asdf/asdf.sh
19-
2017
sed -i -n '/nodejs/p' /home/cdkuser/workspace/.tool-versions
2118
cd /home/cdkuser/workspace/ || exit
2219

2320
asdf install
2421
asdf reshim nodejs
2522

26-
if [ "${SHOW_DIFF}" = "true" ]
23+
if [[ "${SHOW_DIFF}" = "true" ]]
2724
then
2825
echo "Running diff"
2926
npx cdk diff \
3027
--app "npx ts-node --prefer-ts-exts ${CDK_APP_PATH}"
3128
fi
32-
if [ "${DEPLOY_CODE}" = "true" ]
29+
if [[ "${DEPLOY_CODE}" = "true" ]]
3330
then
3431
echo "Running deploy"
3532
npx cdk deploy \

0 commit comments

Comments
 (0)