base-images/Justfile
Joseph Marrero Corchado 52efa394cf Merge branch 'just-renovate' into 'main'
Justfile: add renovate target for on-demand Renovate runs

See merge request fedora/bootc/base-images!1012
2026-11-02 11:06:19 -05:00

126 lines
5.2 KiB
Makefile

# Development entry point for fedora-bootc base images.
# Run `just --list` to see available targets.
# See CONTRIBUTING.md for more information.
# --------------------------------------------------------------------
# Content tier: standard (default), minimal, minimal-plus, iot
tier := env("TIER", "standard")
# Fedora version: rawhide (default), 43, 44, etc.
fedora_version := env("FEDORA_VERSION", "rawhide")
# Container build tool
builder := env("BUILDER", "buildah")
# Extra arguments for the builder
builder_extra := env("BUILDER_EXTRA", "")
# Output image name
image := "localhost/fedora-bootc"
# Renovate image (matches what Konflux MintMaker runs)
renovate_image := env("RENOVATE_IMAGE", "quay.io/konflux-ci/mintmaker-renovate-image:latest")
# MintMaker's global Renovate config (branch prefixes, Tekton migrations, platformCommit, ...)
renovate_global_config := env("RENOVATE_GLOBAL_CONFIG", "https://raw.githubusercontent.com/konflux-ci/mintmaker/main/config/renovate/renovate.json")
# These are required for the nested containerization used by rpm-ostree
# inside the Containerfile.
priv_args := "--security-opt=label=disable --cap-add=all --device /dev/fuse"
# Internal
_build_cmd := builder + " build"
_tag := image + if tier == "standard" { "" } else { ":" + tier }
_base_image := "quay.io/fedora/fedora:" + fedora_version
_version_args := if fedora_version == "rawhide" { "" } else { "--build-arg=REPOS_IMAGE=" + _base_image + " --build-arg=BUILDER_IMAGE=" + _base_image }
_chunkah_args := "--build-arg FINAL=chunked --skip-unused-stages=false -v " + justfile_directory() + ":/run/src"
# ============================================================================
# Core targets
# ============================================================================
# Build the container image
[group('core')]
[arg("chunkah", long, value="true")]
build chunkah="": _check-tier
{{_build_cmd}} -f Containerfile --no-cache \
-t {{_tag}} {{priv_args}} \
{{_version_args}} {{builder_extra}} \
{{if chunkah != "" { _chunkah_args } else { "" }}} \
--build-arg=MANIFEST=fedora-{{tier}} .
# Build and test
[group('core')]
test: build
#!/usr/bin/env bash
set -xeuo pipefail
{{_build_cmd}} -f tests/rootfs/Dockerfile -t localhost/test --from {{_tag}} tests/rootfs
# These tests only apply to the standard tier
if [ "{{tier}}" = "standard" ]; then
{{_build_cmd}} -f tests/Containerfile.test-ca-trust --no-cache \
-t localhost/fedora-bootc-test-ca-trust --from {{_tag}} tests
{{_build_cmd}} -f tests/Containerfile.test-derive --no-cache \
-t localhost/fedora-bootc-derived {{priv_args}} {{builder_extra}} tests
{{_build_cmd}} -f tests/Containerfile.test-sysusers --no-cache \
-t localhost/fedora-bootc-derived {{priv_args}} {{builder_extra}} tests
fi
# Run validation checks (whitespace, shellcheck, YAML)
[group('core')]
validate:
#!/usr/bin/env bash
set -xeuo pipefail
./ci/find-whitespace
./ci/shellcheck
./ci/validate
# Show current configuration
[group('core')]
show-config:
@echo "TIER={{tier}}"
@echo "FEDORA_VERSION={{fedora_version}}"
@echo "BUILDER={{builder}}"
@echo "image tag={{_tag}}"
@echo "base image={{_base_image}}"
# ============================================================================
# CI targets (used by .gitlab-ci.yml)
# ============================================================================
# Run all CI checks: validate + build and test all tiers
[group('ci')]
ci: validate
just tier=minimal test
just tier=minimal-plus test
just tier=standard test
# ============================================================================
# Maintenance
# ============================================================================
# Run Renovate on demand against GitLab (needs RENOVATE_TOKEN; --dry-run to preview)
[group('maintenance')]
[arg("dry_run", long="dry-run", value="true")]
renovate dry_run="" repo="fedora/bootc/base-images":
#!/usr/bin/env bash
set -euo pipefail
test -n "${RENOVATE_TOKEN:-}" || { echo "error: RENOVATE_TOKEN not set (see CONTRIBUTING.md)"; exit 1; }
cfg=$(mktemp)
trap 'rm -f "$cfg"' EXIT
curl -fsSL "{{renovate_global_config}}" -o "$cfg"
chmod 644 "$cfg"
set -x
podman run --rm \
-v "$cfg":/config/global.json:ro,Z \
-e RENOVATE_CONFIG_FILE=/config/global.json \
-e RENOVATE_TOKEN -e RENOVATE_GITHUB_COM_TOKEN \
-e LOG_LEVEL="${LOG_LEVEL:-info}" \
-e RENOVATE_ALLOW_SHELL_EXECUTOR_FOR_POST_UPGRADE_COMMANDS=true \
-e RENOVATE_EXECUTION_TIMEOUT=40 \
-e RENOVATE_IGNORE_PR_AUTHOR=true \
-e RENOVATE_FORCE='{"schedule":[],"updateNotScheduled":true,"dependencyDashboard":false}' \
{{renovate_image}} \
renovate --platform=gitlab --endpoint=https://gitlab.com/api/v4 \
{{if dry_run != "" { "--dry-run=full" } else { "" }}} {{repo}}
# ============================================================================
# Internal
# ============================================================================
[private]
_check-tier:
@test -f fedora-{{tier}}.yaml || { echo "error: unknown tier '{{tier}}' (valid: standard, minimal, minimal-plus, iot)"; exit 1; }