Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5ff1f840dc | |||
| 512d32e285 |
@@ -39,43 +39,25 @@ runs:
|
|||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
# Keep Podman defaults aligned with runner build workflows.
|
rm -rf "${RUNNER_TEMP}/podman-root" "${RUNNER_TEMP}/podman-runroot"
|
||||||
podman_root="${RUNNER_TEMP}/podman-root"
|
mkdir -p "${RUNNER_TEMP}/podman-root" "${RUNNER_TEMP}/podman-runroot"
|
||||||
podman_runroot="${RUNNER_TEMP}/podman-runroot"
|
|
||||||
storage_driver="vfs"
|
|
||||||
build_isolation="chroot"
|
|
||||||
|
|
||||||
rm -rf "${podman_root}" "${podman_runroot}"
|
# Validate tags early so failures are caught before build starts
|
||||||
mkdir -p "${podman_root}" "${podman_runroot}"
|
|
||||||
|
|
||||||
# Export for use in subsequent steps
|
|
||||||
{
|
|
||||||
echo "PODMAN_ROOT=${podman_root}"
|
|
||||||
echo "PODMAN_RUNROOT=${podman_runroot}"
|
|
||||||
echo "STORAGE_DRIVER=${storage_driver}"
|
|
||||||
echo "BUILD_ISOLATION=${build_isolation}"
|
|
||||||
echo "IMAGE_BASE=registry.noctrl.eu/${{ inputs.image-name }}"
|
|
||||||
} >> "${GITHUB_ENV}"
|
|
||||||
|
|
||||||
# Parse and validate tags
|
|
||||||
mapfile -t tags < <(printf '%s\n' "${{ inputs.tags }}" | tr ', ' '\n\n' | sed '/^$/d')
|
mapfile -t tags < <(printf '%s\n' "${{ inputs.tags }}" | tr ', ' '\n\n' | sed '/^$/d')
|
||||||
if [[ ${#tags[@]} -eq 0 ]]; then
|
if [[ ${#tags[@]} -eq 0 ]]; then
|
||||||
echo "ERROR: no tags resolved from inputs.tags" >&2
|
echo "ERROR: no tags resolved from inputs.tags" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Export tags as newline-separated string for subsequent steps
|
|
||||||
(IFS=$'\n'; echo "IMAGE_TAGS=${tags[*]}") >> "${GITHUB_ENV}"
|
|
||||||
|
|
||||||
- id: login
|
- id: login
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
podman_args=(
|
podman_args=(
|
||||||
--root "${PODMAN_ROOT}"
|
--root "${RUNNER_TEMP}/podman-root"
|
||||||
--runroot "${PODMAN_RUNROOT}"
|
--runroot "${RUNNER_TEMP}/podman-runroot"
|
||||||
--storage-driver "${STORAGE_DRIVER}"
|
--storage-driver vfs
|
||||||
)
|
)
|
||||||
|
|
||||||
echo "Logging in to registry: registry.noctrl.eu"
|
echo "Logging in to registry: registry.noctrl.eu"
|
||||||
@@ -87,12 +69,13 @@ runs:
|
|||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
podman_args=(
|
podman_args=(
|
||||||
--root "${PODMAN_ROOT}"
|
--root "${RUNNER_TEMP}/podman-root"
|
||||||
--runroot "${PODMAN_RUNROOT}"
|
--runroot "${RUNNER_TEMP}/podman-runroot"
|
||||||
--storage-driver "${STORAGE_DRIVER}"
|
--storage-driver vfs
|
||||||
)
|
)
|
||||||
|
|
||||||
build_cmd=(podman "${podman_args[@]}" build --isolation "${BUILD_ISOLATION}" -f "${{ inputs.containerfile }}")
|
image_base="registry.noctrl.eu/${{ inputs.image-name }}"
|
||||||
|
build_cmd=(podman "${podman_args[@]}" build --isolation chroot -f "${{ inputs.containerfile }}")
|
||||||
|
|
||||||
# Add build args
|
# Add build args
|
||||||
while IFS= read -r build_arg; do
|
while IFS= read -r build_arg; do
|
||||||
@@ -104,9 +87,9 @@ runs:
|
|||||||
echo "Building image with tags:"
|
echo "Building image with tags:"
|
||||||
while IFS= read -r tag; do
|
while IFS= read -r tag; do
|
||||||
[[ -z "${tag}" ]] && continue
|
[[ -z "${tag}" ]] && continue
|
||||||
echo " ${IMAGE_BASE}:${tag}"
|
echo " ${image_base}:${tag}"
|
||||||
build_cmd+=(-t "${IMAGE_BASE}:${tag}")
|
build_cmd+=(-t "${image_base}:${tag}")
|
||||||
done <<< "${IMAGE_TAGS}"
|
done < <(printf '%s\n' "${{ inputs.tags }}" | tr ', ' '\n\n' | sed '/^$/d')
|
||||||
|
|
||||||
build_cmd+=("${{ inputs.context }}")
|
build_cmd+=("${{ inputs.context }}")
|
||||||
"${build_cmd[@]}"
|
"${build_cmd[@]}"
|
||||||
@@ -117,14 +100,16 @@ runs:
|
|||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
podman_args=(
|
podman_args=(
|
||||||
--root "${PODMAN_ROOT}"
|
--root "${RUNNER_TEMP}/podman-root"
|
||||||
--runroot "${PODMAN_RUNROOT}"
|
--runroot "${RUNNER_TEMP}/podman-runroot"
|
||||||
--storage-driver "${STORAGE_DRIVER}"
|
--storage-driver vfs
|
||||||
)
|
)
|
||||||
|
|
||||||
|
image_base="registry.noctrl.eu/${{ inputs.image-name }}"
|
||||||
|
|
||||||
echo "Pushing image tags:"
|
echo "Pushing image tags:"
|
||||||
while IFS= read -r tag; do
|
while IFS= read -r tag; do
|
||||||
[[ -z "${tag}" ]] && continue
|
[[ -z "${tag}" ]] && continue
|
||||||
echo " ${IMAGE_BASE}:${tag}"
|
echo " ${image_base}:${tag}"
|
||||||
podman "${podman_args[@]}" push "${IMAGE_BASE}:${tag}"
|
podman "${podman_args[@]}" push "${image_base}:${tag}"
|
||||||
done <<< "${IMAGE_TAGS}"
|
done < <(printf '%s\n' "${{ inputs.tags }}" | tr ', ' '\n\n' | sed '/^$/d')
|
||||||
|
|||||||
Reference in New Issue
Block a user