Skip to content

Commit c7bc05c

Browse files
authored
Merge pull request #2 from wolfi-dev/cleanup
cleanup
2 parents dd6ff7d + 6c503ae commit c7bc05c

File tree

3 files changed

+33
-51
lines changed

3 files changed

+33
-51
lines changed

.github/workflows/build.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@ on:
33
branches:
44
- main
55
workflow_dispatch: {}
6+
67
env:
78
IMAGE_REPO: ghcr.io/${{ github.repository }}/wolfi-act-test
8-
APKO_CONFIG: https://raw.githubusercontent.com/chainguard-images/images/main/images/maven/configs/openjdk-17.apko.yaml
9+
APKO_CONFIG: https://raw.githubusercontent.com/chainguard-images/images/main/images/maven/config/template.apko.yaml
910
GHCR_USER: ${{ github.repository_owner }}
1011
GHCR_PASS: ${{ github.token }}
12+
1113
jobs:
1214
build:
1315
runs-on: ubuntu-latest
@@ -33,7 +35,7 @@ jobs:
3335
apko publish apko.yaml "${IMAGE_REPO}" \
3436
--repository-append=https://packages.wolfi.dev/os \
3537
--keyring-append=https://packages.wolfi.dev/os/wolfi-signing.rsa.pub \
36-
--package-append=wolfi-baselayout \
38+
--package-append=wolfi-baselayout,maven,openjdk-17,openjdk-17-default-jvm \
3739
--arch=x86_64,aarch64 \
3840
--image-refs=apko.images.txt | tee apko.index.txt
3941
index_digest="$(cat apko.index.txt)"
@@ -51,4 +53,4 @@ jobs:
5153
- name: Make sure the image runs
5254
run: |
5355
set -x
54-
docker run --rm "${IMAGE_REPO}:latest" --version
56+
docker run --rm -e JAVA_HOME=/usr/lib/jvm/java-17-openjdk "${IMAGE_REPO}:latest" --version

.github/workflows/ci.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ name: ci
22

33
on:
44
pull_request:
5+
56
env:
67
IMAGE_REPO: ttl.sh/test-${{ github.job }}-${{ github.run_id }}
7-
APKO_CONFIG: https://raw.githubusercontent.com/chainguard-images/images/main/images/maven/configs/openjdk-17.apko.yaml
8+
APKO_CONFIG: https://raw.githubusercontent.com/chainguard-images/images/main/images/maven/config/template.apko.yaml
89

910
jobs:
1011
ci:
@@ -27,7 +28,7 @@ jobs:
2728
apko publish apko.yaml "${IMAGE_REPO}" \
2829
--repository-append=https://packages.wolfi.dev/os \
2930
--keyring-append=https://packages.wolfi.dev/os/wolfi-signing.rsa.pub \
30-
--package-append=wolfi-baselayout \
31+
--package-append=wolfi-baselayout,maven,openjdk-17,openjdk-17-default-jvm \
3132
--arch=x86_64,aarch64 \
3233
--image-refs=apko.images.txt | tee apko.index.txt
3334
index_digest="$(cat apko.index.txt)"
@@ -42,7 +43,7 @@ jobs:
4243
- name: Make sure the image runs
4344
run: |
4445
set -x
45-
docker run --rm "${IMAGE_REPO}:latest" --version
46+
docker run --rm -e JAVA_HOME=/usr/lib/jvm/java-17-openjdk "${IMAGE_REPO}:latest" --version
4647
4748
ci-debug:
4849
runs-on: ubuntu-latest
@@ -65,7 +66,7 @@ jobs:
6566
apko publish apko.yaml "${IMAGE_REPO}" \
6667
--repository-append=https://packages.wolfi.dev/os \
6768
--keyring-append=https://packages.wolfi.dev/os/wolfi-signing.rsa.pub \
68-
--package-append=wolfi-baselayout \
69+
--package-append=wolfi-baselayout,maven,openjdk-17,openjdk-17-default-jvm \
6970
--arch=x86_64,aarch64 \
7071
--image-refs=apko.images.txt | tee apko.index.txt
7172
index_digest="$(cat apko.index.txt)"
@@ -80,4 +81,4 @@ jobs:
8081
- name: Make sure the image runs
8182
run: |
8283
set -x
83-
docker run --rm "${IMAGE_REPO}:latest" --version
84+
docker run --rm -e JAVA_HOME=/usr/lib/jvm/java-17-openjdk "${IMAGE_REPO}:latest" --version

action.yml

Lines changed: 22 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,14 @@ runs:
2323
run: |
2424
set -e
2525
26+
debug_args=
27+
debug_args_image="-exc"
2628
debug='${{inputs.debug}}'
2729
if [[ "${debug}" == "true" ]]; then
2830
echo "[🐙] Enabling debug logging."
2931
set -x
32+
debug_args="2>/dev/null"
33+
debug_args_image="-ec"
3034
fi
3135
3236
if [[ '${{inputs.command}}' == '' ]]; then
@@ -55,56 +59,31 @@ runs:
5559
fi
5660
5761
printf "[🐙] Building ephemeral container image from Wolfi packages... "
58-
if [[ "${debug}" == "true" ]]; then
59-
docker run --rm \
60-
-v ${PWD}:/work \
61-
-w /work \
62-
'${{ inputs.apko-image }}' \
63-
build \
64-
--arch=x86_64 \
65-
--sbom=false \
66-
wolfi-act.apko.config.yaml \
67-
wolfi-act:latest \
68-
wolfi-act.tar
69-
else
70-
docker run --rm \
71-
-v ${PWD}:/work \
72-
-w /work \
73-
'${{ inputs.apko-image }}' \
74-
build \
75-
--arch=x86_64 \
76-
--sbom=false \
77-
wolfi-act.apko.config.yaml \
78-
wolfi-act:latest \
79-
wolfi-act.tar 2>/dev/null
80-
fi
62+
eval docker run --rm \
63+
-v ${PWD}:/work \
64+
-w /work \
65+
'${{ inputs.apko-image }}' \
66+
build \
67+
--arch=x86_64 \
68+
--sbom=false \
69+
wolfi-act.apko.config.yaml \
70+
wolfi-act:latest \
71+
wolfi-act.tar "${debug_args}"
72+
8173
echo "done."
8274
8375
printf "[🐙] Loading ephemeral container image into Docker... "
84-
if [[ "${debug}" == "true" ]]; then
85-
docker load < wolfi-act.tar
86-
else
87-
docker load < wolfi-act.tar >/dev/null
88-
fi
76+
eval docker load < wolfi-act.tar "${debug_args}"
8977
echo "done."
9078
9179
env > wolfi-act.github.env
9280
9381
echo "[🐙] Running the following command in ephemeral container image:"
9482
echo '${{ inputs.command }}'
9583
echo "[🐙] Output:"
96-
if [[ "${debug}" == "true" ]]; then
97-
docker run -i --rm --platform linux/amd64 \
98-
-v ${PWD}:/work \
99-
-w /work \
100-
--env-file wolfi-act.github.env \
101-
wolfi-act:latest-amd64 \
102-
bash -exc '${{ inputs.command }}'
103-
else
104-
docker run -i --rm --platform linux/amd64 \
105-
-v ${PWD}:/work \
106-
-w /work \
107-
--env-file wolfi-act.github.env \
108-
wolfi-act:latest-amd64 \
109-
bash -ec '${{ inputs.command }}'
110-
fi
84+
docker run -i --rm --platform linux/amd64 \
85+
-v ${PWD}:/work \
86+
-w /work \
87+
--env-file wolfi-act.github.env \
88+
wolfi-act:latest-amd64 \
89+
bash "${debug_args_image}" '${{ inputs.command }}'

0 commit comments

Comments
 (0)