Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e80642a71e | |||
| 06fd1a015a | |||
| fa3f894736 | |||
| cb24d45011 | |||
| 78d9ca75f3 |
@@ -5,17 +5,18 @@ inputs:
|
|||||||
image-name:
|
image-name:
|
||||||
description: Repository/image name path, for example noctrl/gitea-runner
|
description: Repository/image name path, for example noctrl/gitea-runner
|
||||||
required: true
|
required: true
|
||||||
tags:
|
|
||||||
description: |
|
|
||||||
Tags to apply and push. Supports newline, comma, or space separated values.
|
|
||||||
Example: "latest\nsha-abc123"
|
|
||||||
required: true
|
|
||||||
registry-username:
|
registry-username:
|
||||||
description: Registry username for login.
|
description: Registry username for login.
|
||||||
required: true
|
required: true
|
||||||
registry-password:
|
registry-password:
|
||||||
description: Registry password for login.
|
description: Registry password for login.
|
||||||
required: true
|
required: true
|
||||||
|
tags:
|
||||||
|
description: |
|
||||||
|
Tags to apply and push. Supports newline, comma, or space separated values.
|
||||||
|
Example: "latest\nsha-abc123"
|
||||||
|
required: false
|
||||||
|
default: latest
|
||||||
context:
|
context:
|
||||||
description: Build context path.
|
description: Build context path.
|
||||||
required: false
|
required: false
|
||||||
@@ -48,6 +49,32 @@ runs:
|
|||||||
rm -rf "${RUNNER_TEMP}/podman-root" "${RUNNER_TEMP}/podman-runroot"
|
rm -rf "${RUNNER_TEMP}/podman-root" "${RUNNER_TEMP}/podman-runroot"
|
||||||
mkdir -p "${RUNNER_TEMP}/podman-root" "${RUNNER_TEMP}/podman-runroot"
|
mkdir -p "${RUNNER_TEMP}/podman-root" "${RUNNER_TEMP}/podman-runroot"
|
||||||
|
|
||||||
|
podman_base_args=(
|
||||||
|
--root "${RUNNER_TEMP}/podman-root"
|
||||||
|
--runroot "${RUNNER_TEMP}/podman-runroot"
|
||||||
|
)
|
||||||
|
|
||||||
|
selected_driver="vfs"
|
||||||
|
selected_storage_opt=""
|
||||||
|
|
||||||
|
# Prefer overlay with fuse-overlayfs when available and functional.
|
||||||
|
if [[ -c /dev/fuse ]] && command -v fuse-overlayfs >/dev/null 2>&1; then
|
||||||
|
fuse_path="$(command -v fuse-overlayfs)"
|
||||||
|
candidate_storage_opt="overlay.mount_program=${fuse_path}"
|
||||||
|
if podman "${podman_base_args[@]}" --storage-driver overlay --storage-opt "${candidate_storage_opt}" info >/dev/null 2>&1; then
|
||||||
|
selected_driver="overlay"
|
||||||
|
selected_storage_opt="${candidate_storage_opt}"
|
||||||
|
echo "Using overlay storage driver with fuse-overlayfs (${fuse_path})."
|
||||||
|
else
|
||||||
|
echo "overlay+fuse-overlayfs probe failed; falling back to vfs."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "overlay+fuse prerequisites missing; using vfs."
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "PODMAN_STORAGE_DRIVER=${selected_driver}" >> "${GITHUB_ENV}"
|
||||||
|
echo "PODMAN_STORAGE_OPT=${selected_storage_opt}" >> "${GITHUB_ENV}"
|
||||||
|
|
||||||
# Validate tags early so failures are caught before build starts
|
# Validate tags early so failures are caught before build starts
|
||||||
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
|
||||||
@@ -56,17 +83,23 @@ runs:
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
- id: login
|
- id: login
|
||||||
if: ${{ inputs.push != 'false' }}
|
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
|
: "${PODMAN_STORAGE_DRIVER:=vfs}"
|
||||||
|
: "${PODMAN_STORAGE_OPT:=}"
|
||||||
|
|
||||||
podman_args=(
|
podman_args=(
|
||||||
--root "${RUNNER_TEMP}/podman-root"
|
--root "${RUNNER_TEMP}/podman-root"
|
||||||
--runroot "${RUNNER_TEMP}/podman-runroot"
|
--runroot "${RUNNER_TEMP}/podman-runroot"
|
||||||
--storage-driver vfs
|
--storage-driver "${PODMAN_STORAGE_DRIVER}"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if [[ -n "${PODMAN_STORAGE_OPT}" ]]; then
|
||||||
|
podman_args+=(--storage-opt "${PODMAN_STORAGE_OPT}")
|
||||||
|
fi
|
||||||
|
|
||||||
echo "Logging in to registry: registry.noctrl.eu"
|
echo "Logging in to registry: registry.noctrl.eu"
|
||||||
echo "${{ inputs.registry-password }}" | podman "${podman_args[@]}" login registry.noctrl.eu -u "${{ inputs.registry-username }}" --password-stdin
|
echo "${{ inputs.registry-password }}" | podman "${podman_args[@]}" login registry.noctrl.eu -u "${{ inputs.registry-username }}" --password-stdin
|
||||||
|
|
||||||
@@ -75,12 +108,19 @@ runs:
|
|||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
|
: "${PODMAN_STORAGE_DRIVER:=vfs}"
|
||||||
|
: "${PODMAN_STORAGE_OPT:=}"
|
||||||
|
|
||||||
podman_args=(
|
podman_args=(
|
||||||
--root "${RUNNER_TEMP}/podman-root"
|
--root "${RUNNER_TEMP}/podman-root"
|
||||||
--runroot "${RUNNER_TEMP}/podman-runroot"
|
--runroot "${RUNNER_TEMP}/podman-runroot"
|
||||||
--storage-driver vfs
|
--storage-driver "${PODMAN_STORAGE_DRIVER}"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if [[ -n "${PODMAN_STORAGE_OPT}" ]]; then
|
||||||
|
podman_args+=(--storage-opt "${PODMAN_STORAGE_OPT}")
|
||||||
|
fi
|
||||||
|
|
||||||
image_base="registry.noctrl.eu/${{ inputs.image-name }}"
|
image_base="registry.noctrl.eu/${{ inputs.image-name }}"
|
||||||
build_cmd=(podman "${podman_args[@]}" build --isolation chroot -f "${{ inputs.containerfile }}")
|
build_cmd=(podman "${podman_args[@]}" build --isolation chroot -f "${{ inputs.containerfile }}")
|
||||||
|
|
||||||
@@ -107,12 +147,19 @@ runs:
|
|||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
|
: "${PODMAN_STORAGE_DRIVER:=vfs}"
|
||||||
|
: "${PODMAN_STORAGE_OPT:=}"
|
||||||
|
|
||||||
podman_args=(
|
podman_args=(
|
||||||
--root "${RUNNER_TEMP}/podman-root"
|
--root "${RUNNER_TEMP}/podman-root"
|
||||||
--runroot "${RUNNER_TEMP}/podman-runroot"
|
--runroot "${RUNNER_TEMP}/podman-runroot"
|
||||||
--storage-driver vfs
|
--storage-driver "${PODMAN_STORAGE_DRIVER}"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if [[ -n "${PODMAN_STORAGE_OPT}" ]]; then
|
||||||
|
podman_args+=(--storage-opt "${PODMAN_STORAGE_OPT}")
|
||||||
|
fi
|
||||||
|
|
||||||
image_base="registry.noctrl.eu/${{ inputs.image-name }}"
|
image_base="registry.noctrl.eu/${{ inputs.image-name }}"
|
||||||
|
|
||||||
echo "Pushing image tags:"
|
echo "Pushing image tags:"
|
||||||
|
|||||||
@@ -32,6 +32,32 @@ runs:
|
|||||||
rm -rf "${RUNNER_TEMP}/podman-root" "${RUNNER_TEMP}/podman-runroot"
|
rm -rf "${RUNNER_TEMP}/podman-root" "${RUNNER_TEMP}/podman-runroot"
|
||||||
mkdir -p "${RUNNER_TEMP}/podman-root" "${RUNNER_TEMP}/podman-runroot"
|
mkdir -p "${RUNNER_TEMP}/podman-root" "${RUNNER_TEMP}/podman-runroot"
|
||||||
|
|
||||||
|
podman_base_args=(
|
||||||
|
--root "${RUNNER_TEMP}/podman-root"
|
||||||
|
--runroot "${RUNNER_TEMP}/podman-runroot"
|
||||||
|
)
|
||||||
|
|
||||||
|
selected_driver="vfs"
|
||||||
|
selected_storage_opt=""
|
||||||
|
|
||||||
|
# Prefer overlay with fuse-overlayfs when available and functional.
|
||||||
|
if [[ -c /dev/fuse ]] && command -v fuse-overlayfs >/dev/null 2>&1; then
|
||||||
|
fuse_path="$(command -v fuse-overlayfs)"
|
||||||
|
candidate_storage_opt="overlay.mount_program=${fuse_path}"
|
||||||
|
if podman "${podman_base_args[@]}" --storage-driver overlay --storage-opt "${candidate_storage_opt}" info >/dev/null 2>&1; then
|
||||||
|
selected_driver="overlay"
|
||||||
|
selected_storage_opt="${candidate_storage_opt}"
|
||||||
|
echo "Using overlay storage driver with fuse-overlayfs (${fuse_path})."
|
||||||
|
else
|
||||||
|
echo "overlay+fuse-overlayfs probe failed; falling back to vfs."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "overlay+fuse prerequisites missing; using vfs."
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "PODMAN_STORAGE_DRIVER=${selected_driver}" >> "${GITHUB_ENV}"
|
||||||
|
echo "PODMAN_STORAGE_OPT=${selected_storage_opt}" >> "${GITHUB_ENV}"
|
||||||
|
|
||||||
mapfile -t source_tags < <(printf '%s\n' "${{ inputs.source-tags }}" | tr ', ' '\n\n' | sed '/^$/d')
|
mapfile -t source_tags < <(printf '%s\n' "${{ inputs.source-tags }}" | tr ', ' '\n\n' | sed '/^$/d')
|
||||||
if [[ ${#source_tags[@]} -eq 0 ]]; then
|
if [[ ${#source_tags[@]} -eq 0 ]]; then
|
||||||
echo "ERROR: no tags resolved from inputs.source-tags" >&2
|
echo "ERROR: no tags resolved from inputs.source-tags" >&2
|
||||||
@@ -43,12 +69,19 @@ runs:
|
|||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
|
: "${PODMAN_STORAGE_DRIVER:=vfs}"
|
||||||
|
: "${PODMAN_STORAGE_OPT:=}"
|
||||||
|
|
||||||
podman_args=(
|
podman_args=(
|
||||||
--root "${RUNNER_TEMP}/podman-root"
|
--root "${RUNNER_TEMP}/podman-root"
|
||||||
--runroot "${RUNNER_TEMP}/podman-runroot"
|
--runroot "${RUNNER_TEMP}/podman-runroot"
|
||||||
--storage-driver vfs
|
--storage-driver "${PODMAN_STORAGE_DRIVER}"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if [[ -n "${PODMAN_STORAGE_OPT}" ]]; then
|
||||||
|
podman_args+=(--storage-opt "${PODMAN_STORAGE_OPT}")
|
||||||
|
fi
|
||||||
|
|
||||||
echo "Logging in to registry: registry.noctrl.eu"
|
echo "Logging in to registry: registry.noctrl.eu"
|
||||||
echo "${{ inputs.registry-password }}" | podman "${podman_args[@]}" login registry.noctrl.eu -u "${{ inputs.registry-username }}" --password-stdin
|
echo "${{ inputs.registry-password }}" | podman "${podman_args[@]}" login registry.noctrl.eu -u "${{ inputs.registry-username }}" --password-stdin
|
||||||
|
|
||||||
@@ -57,12 +90,19 @@ runs:
|
|||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
|
: "${PODMAN_STORAGE_DRIVER:=vfs}"
|
||||||
|
: "${PODMAN_STORAGE_OPT:=}"
|
||||||
|
|
||||||
podman_args=(
|
podman_args=(
|
||||||
--root "${RUNNER_TEMP}/podman-root"
|
--root "${RUNNER_TEMP}/podman-root"
|
||||||
--runroot "${RUNNER_TEMP}/podman-runroot"
|
--runroot "${RUNNER_TEMP}/podman-runroot"
|
||||||
--storage-driver vfs
|
--storage-driver "${PODMAN_STORAGE_DRIVER}"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if [[ -n "${PODMAN_STORAGE_OPT}" ]]; then
|
||||||
|
podman_args+=(--storage-opt "${PODMAN_STORAGE_OPT}")
|
||||||
|
fi
|
||||||
|
|
||||||
image_base="registry.noctrl.eu/${{ inputs.image-name }}"
|
image_base="registry.noctrl.eu/${{ inputs.image-name }}"
|
||||||
target_ref="docker://${image_base}:${{ inputs.manifest-tag }}"
|
target_ref="docker://${image_base}:${{ inputs.manifest-tag }}"
|
||||||
manifest_name="manifest-${{ github.run_id }}-${{ github.job }}"
|
manifest_name="manifest-${{ github.run_id }}-${{ github.job }}"
|
||||||
|
|||||||
Reference in New Issue
Block a user