Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cleanup #2

Merged
merged 2 commits into from
Mar 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ on:
branches:
- main
workflow_dispatch: {}

env:
IMAGE_REPO: ghcr.io/${{ github.repository }}/wolfi-act-test
APKO_CONFIG: https://raw.githubusercontent.com/chainguard-images/images/main/images/maven/configs/openjdk-17.apko.yaml
APKO_CONFIG: https://raw.githubusercontent.com/chainguard-images/images/main/images/maven/config/template.apko.yaml
GHCR_USER: ${{ github.repository_owner }}
GHCR_PASS: ${{ github.token }}

jobs:
build:
runs-on: ubuntu-latest
Expand All @@ -33,7 +35,7 @@ jobs:
apko publish apko.yaml "${IMAGE_REPO}" \
--repository-append=https://packages.wolfi.dev/os \
--keyring-append=https://packages.wolfi.dev/os/wolfi-signing.rsa.pub \
--package-append=wolfi-baselayout \
--package-append=wolfi-baselayout,maven,openjdk-17,openjdk-17-default-jvm \
--arch=x86_64,aarch64 \
--image-refs=apko.images.txt | tee apko.index.txt
index_digest="$(cat apko.index.txt)"
Expand All @@ -51,4 +53,4 @@ jobs:
- name: Make sure the image runs
run: |
set -x
docker run --rm "${IMAGE_REPO}:latest" --version
docker run --rm -e JAVA_HOME=/usr/lib/jvm/java-17-openjdk "${IMAGE_REPO}:latest" --version
11 changes: 6 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ name: ci

on:
pull_request:

env:
IMAGE_REPO: ttl.sh/test-${{ github.job }}-${{ github.run_id }}
APKO_CONFIG: https://raw.githubusercontent.com/chainguard-images/images/main/images/maven/configs/openjdk-17.apko.yaml
APKO_CONFIG: https://raw.githubusercontent.com/chainguard-images/images/main/images/maven/config/template.apko.yaml

jobs:
ci:
Expand All @@ -27,7 +28,7 @@ jobs:
apko publish apko.yaml "${IMAGE_REPO}" \
--repository-append=https://packages.wolfi.dev/os \
--keyring-append=https://packages.wolfi.dev/os/wolfi-signing.rsa.pub \
--package-append=wolfi-baselayout \
--package-append=wolfi-baselayout,maven,openjdk-17,openjdk-17-default-jvm \
--arch=x86_64,aarch64 \
--image-refs=apko.images.txt | tee apko.index.txt
index_digest="$(cat apko.index.txt)"
Expand All @@ -42,7 +43,7 @@ jobs:
- name: Make sure the image runs
run: |
set -x
docker run --rm "${IMAGE_REPO}:latest" --version
docker run --rm -e JAVA_HOME=/usr/lib/jvm/java-17-openjdk "${IMAGE_REPO}:latest" --version

ci-debug:
runs-on: ubuntu-latest
Expand All @@ -65,7 +66,7 @@ jobs:
apko publish apko.yaml "${IMAGE_REPO}" \
--repository-append=https://packages.wolfi.dev/os \
--keyring-append=https://packages.wolfi.dev/os/wolfi-signing.rsa.pub \
--package-append=wolfi-baselayout \
--package-append=wolfi-baselayout,maven,openjdk-17,openjdk-17-default-jvm \
--arch=x86_64,aarch64 \
--image-refs=apko.images.txt | tee apko.index.txt
index_digest="$(cat apko.index.txt)"
Expand All @@ -80,4 +81,4 @@ jobs:
- name: Make sure the image runs
run: |
set -x
docker run --rm "${IMAGE_REPO}:latest" --version
docker run --rm -e JAVA_HOME=/usr/lib/jvm/java-17-openjdk "${IMAGE_REPO}:latest" --version
65 changes: 22 additions & 43 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,14 @@ runs:
run: |
set -e
debug_args=
debug_args_image="-exc"
debug='${{inputs.debug}}'
if [[ "${debug}" == "true" ]]; then
echo "[🐙] Enabling debug logging."
set -x
debug_args="2>/dev/null"
debug_args_image="-ec"
fi
if [[ '${{inputs.command}}' == '' ]]; then
Expand Down Expand Up @@ -55,56 +59,31 @@ runs:
fi
printf "[🐙] Building ephemeral container image from Wolfi packages... "
if [[ "${debug}" == "true" ]]; then
docker run --rm \
-v ${PWD}:/work \
-w /work \
'${{ inputs.apko-image }}' \
build \
--arch=x86_64 \
--sbom=false \
wolfi-act.apko.config.yaml \
wolfi-act:latest \
wolfi-act.tar
else
docker run --rm \
-v ${PWD}:/work \
-w /work \
'${{ inputs.apko-image }}' \
build \
--arch=x86_64 \
--sbom=false \
wolfi-act.apko.config.yaml \
wolfi-act:latest \
wolfi-act.tar 2>/dev/null
fi
eval docker run --rm \
-v ${PWD}:/work \
-w /work \
'${{ inputs.apko-image }}' \
build \
--arch=x86_64 \
--sbom=false \
wolfi-act.apko.config.yaml \
wolfi-act:latest \
wolfi-act.tar "${debug_args}"
echo "done."
printf "[🐙] Loading ephemeral container image into Docker... "
cpanato marked this conversation as resolved.
Show resolved Hide resolved
if [[ "${debug}" == "true" ]]; then
docker load < wolfi-act.tar
else
docker load < wolfi-act.tar >/dev/null
fi
eval docker load < wolfi-act.tar "${debug_args}"
echo "done."
env > wolfi-act.github.env
echo "[🐙] Running the following command in ephemeral container image:"
echo '${{ inputs.command }}'
echo "[🐙] Output:"
if [[ "${debug}" == "true" ]]; then
docker run -i --rm --platform linux/amd64 \
-v ${PWD}:/work \
-w /work \
--env-file wolfi-act.github.env \
wolfi-act:latest-amd64 \
bash -exc '${{ inputs.command }}'
else
docker run -i --rm --platform linux/amd64 \
-v ${PWD}:/work \
-w /work \
--env-file wolfi-act.github.env \
wolfi-act:latest-amd64 \
bash -ec '${{ inputs.command }}'
fi
docker run -i --rm --platform linux/amd64 \
-v ${PWD}:/work \
-w /work \
--env-file wolfi-act.github.env \
wolfi-act:latest-amd64 \
bash "${debug_args_image}" '${{ inputs.command }}'
Loading