Skip to content

Commit

Permalink
more gha group logs
Browse files Browse the repository at this point in the history
Signed-off-by: m2 <[email protected]>
  • Loading branch information
m2Giles committed Jan 5, 2025
1 parent 3e183f5 commit 4a9906b
Showing 1 changed file with 20 additions and 7 deletions.
27 changes: 20 additions & 7 deletions Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ clean:
validate $image $tag $flavor:
#!/usr/bin/bash
set -eou pipefail
echo "::group:: Validate"
declare -A images={{ images }}
declare -A tags={{ tags }}
declare -A flavors={{ flavors }}
Expand All @@ -86,22 +87,25 @@ validate $image $tag $flavor:
checkflavor="${flavors[${flavor}]-}"

# Validity Checks
returncode=0
if [[ -z "$checkimage" ]]; then
echo "Invalid Image..."
exit 1
returncode=1
fi
if [[ -z "$checktag" ]]; then
echo "Invalid tag..."
exit 1
returncode=1
fi
if [[ -z "$checkflavor" ]]; then
echo "Invalid flavor..."
exit 1
returncode=1
fi
if [[ ! "$checktag" =~ latest && "$checkflavor" =~ hwe|asus|surface ]]; then
echo "HWE images are only built on latest..."
exit 1
returncode=1
fi
echo "::endgroup::"
exit "$returncode"

# Build Image
[group('Image')]
Expand Down Expand Up @@ -609,7 +613,7 @@ run-iso $image="bluefin" $tag="latest" $flavor="main":
run_args+=(docker.io/qemux/qemu-docker)
${PODMAN} run "${run_args[@]}" &
xdg-open http://localhost:${port}
fg "%podman"
fg "%podman" || fg "%docker"

# Test Changelogs
[group('Changelogs')]
Expand All @@ -624,18 +628,21 @@ verify-container container="" registry="ghcr.io/ublue-os" key="":
#!/usr/bin/bash
set -eoux pipefail

echo "::group:: Verify Container {{ container }}"

# Get Cosign if Needed
if [[ ! $(command -v cosign) ]]; then
COSIGN_CONTAINER_ID=$(${SUDOIF} ${PODMAN} create cgr.dev/chainguard/cosign:latest bash)
${SUDOIF} ${PODMAN} cp "${COSIGN_CONTAINER_ID}":/usr/bin/cosign /usr/local/bin/cosign
${SUDOIF} ${PODMAN} rm -f "${COSIGN_CONTAINER_ID}"
fi

returncode=0
# Verify Cosign Image Signatures if needed
if [[ -n "${COSIGN_CONTAINER_ID:-}" ]]; then
if ! cosign verify --certificate-oidc-issuer=https://token.actions.githubusercontent.com --certificate-identity=https://github.com/chainguard-images/images/.github/workflows/release.yaml@refs/heads/main cgr.dev/chainguard/cosign >/dev/null; then
echo "NOTICE: Failed to verify cosign image signatures."
exit 1
returncode=1
fi
fi

Expand All @@ -648,15 +655,20 @@ verify-container container="" registry="ghcr.io/ublue-os" key="":
# Verify Container using cosign public key
if ! cosign verify --key "${key}" "{{ registry }}"/"{{ container }}" >/dev/null; then
echo "NOTICE: Verification failed. Please ensure your public key is correct."
exit 1
returncode=1
fi

echo "::endgroup::"
exit "$returncode"

# Secureboot Check
[group('Utility')]
secureboot $image="bluefin" $tag="latest" $flavor="main":
#!/usr/bin/bash
set -eoux pipefail

echo "::group:: Secureboot Check"

# Validate
just validate "${image}" "${tag}" "${flavor}"

Expand Down Expand Up @@ -700,6 +712,7 @@ secureboot $image="bluefin" $tag="latest" $flavor="main":
if [[ -n "${temp_name:-}" ]]; then
${PODMAN} rm -f "${temp_name}"
fi
echo "::endgroup::"
exit "$returncode"

# Get Fedora Version of an image
Expand Down

0 comments on commit 4a9906b

Please sign in to comment.