From eb1aee35c51116e89b497d2533bf46705c66775b Mon Sep 17 00:00:00 2001 From: Ben Vincent Date: Sun, 9 Mar 2025 17:50:37 +1100 Subject: [PATCH] feat: add python and make (#9) - add python and make to the base images - remove make, python and jq from images derived from base Reviewed-on: https://git.query.consul/unkin/packer-images/pulls/9 --- Makefile | 17 ++++++++++++++--- ci/build.sh | 17 ++++++++++++++--- .../8.10/actionsdind/variables.auto.pkrvars.hcl | 2 -- .../8.10/base/variables.auto.pkrvars.hcl | 5 +++++ .../8.10/jupyterlab/variables.auto.pkrvars.hcl | 7 ------- .../8.10/rpmbuilder/variables.auto.pkrvars.hcl | 1 - .../9.5/actionsdind/variables.auto.pkrvars.hcl | 2 -- .../9.5/base/variables.auto.pkrvars.hcl | 5 +++++ .../9.5/jupyterlab/variables.auto.pkrvars.hcl | 7 ------- .../9.5/rpmbuilder/variables.auto.pkrvars.hcl | 1 - 10 files changed, 38 insertions(+), 26 deletions(-) diff --git a/Makefile b/Makefile index a8a987c..fcb0948 100644 --- a/Makefile +++ b/Makefile @@ -20,16 +20,27 @@ DIRS := $(shell find $(IMAGES_PATH) -mindepth 3 -maxdepth 3 -type d | sed 's|$(I default: clean ./ci/build.sh -# Make all images +# Separate base images from others +BASE_IMAGES = $(filter %/base,$(DIRS)) +OTHER_IMAGES = $(filter-out %/base,$(DIRS)) + +# Make all images, ensuring base images build first all: - @for dir in $(DIRS); do \ + @for dir in $(BASE_IMAGES); do \ $(MAKE) $$dir; \ done + @for dir in $(OTHER_IMAGES); do \ + $(MAKE) $$dir; \ + done + # List all directories list: @echo "Images:" - @for dir in $(DIRS); do \ + @for dir in $(BASE_IMAGES); do \ + echo " '$$dir'"; \ + done + @for dir in $(OTHER_IMAGES); do \ echo " '$$dir'"; \ done diff --git a/ci/build.sh b/ci/build.sh index 19b7fe3..c6523a2 100755 --- a/ci/build.sh +++ b/ci/build.sh @@ -20,9 +20,20 @@ if [ -n "$images_changes" ]; then echo "Changes detected in images/. Running specific 'make' commands..." # Extract unique paths for `make` commands - export TARGETS=$(echo "$images_changes" | sed -E 's|images/||; s|/[^/]+$||' | sort -u) - echo $TARGETS - for target in $TARGETS; do + TARGETS=$(echo "$images_changes" | sed -E 's|images/||; s|/[^/]+$||' | sort -u) + + # Prioritize base images first + BASE_TARGETS=$(echo "$TARGETS" | grep '/base$' || true) + OTHER_TARGETS=$(echo "$TARGETS" | grep -v '/base$' || true) + + # Build base images first + for target in $BASE_TARGETS; do + echo "Running 'make $target' (base image first)..." + make "$target" + done + + # Then build other images + for target in $OTHER_TARGETS; do echo "Running 'make $target'..." make "$target" done diff --git a/images/almalinux/8.10/actionsdind/variables.auto.pkrvars.hcl b/images/almalinux/8.10/actionsdind/variables.auto.pkrvars.hcl index 06f2a53..d8a6ed9 100644 --- a/images/almalinux/8.10/actionsdind/variables.auto.pkrvars.hcl +++ b/images/almalinux/8.10/actionsdind/variables.auto.pkrvars.hcl @@ -4,8 +4,6 @@ packages = [ "bash", "consul", "docker-ce-cli", - "jq", - "make", "nodejs", "packer", "terraform", diff --git a/images/almalinux/8.10/base/variables.auto.pkrvars.hcl b/images/almalinux/8.10/base/variables.auto.pkrvars.hcl index aed8309..0ed1359 100644 --- a/images/almalinux/8.10/base/variables.auto.pkrvars.hcl +++ b/images/almalinux/8.10/base/variables.auto.pkrvars.hcl @@ -5,6 +5,11 @@ use_incus = false packages = [ "git", "jq", + "make", + "python3.11", + "python3.11-pip", + "python3.12", + "python3.12-pip", "uv", "wget", ] diff --git a/images/almalinux/8.10/jupyterlab/variables.auto.pkrvars.hcl b/images/almalinux/8.10/jupyterlab/variables.auto.pkrvars.hcl index a27f426..43c181c 100644 --- a/images/almalinux/8.10/jupyterlab/variables.auto.pkrvars.hcl +++ b/images/almalinux/8.10/jupyterlab/variables.auto.pkrvars.hcl @@ -1,13 +1,6 @@ # almalinux/8.10/jupyterlab docker_source = "git.query.consul/unkin/almalinux8-base:latest" deploy_files_from_common = true -packages = [ - "uv", - "python3.11", - "python3.11-pip", - "python3.12", - "python3.12-pip" -] scripts_pre_file_copy = [ "dnf install -y sudo", ] diff --git a/images/almalinux/8.10/rpmbuilder/variables.auto.pkrvars.hcl b/images/almalinux/8.10/rpmbuilder/variables.auto.pkrvars.hcl index 08b3e2e..1952c56 100644 --- a/images/almalinux/8.10/rpmbuilder/variables.auto.pkrvars.hcl +++ b/images/almalinux/8.10/rpmbuilder/variables.auto.pkrvars.hcl @@ -19,7 +19,6 @@ packages = [ "intltool", "jna", "ltrace", - "make", "nfpm", "patchutils", "perl-Fedora-VSP", diff --git a/images/almalinux/9.5/actionsdind/variables.auto.pkrvars.hcl b/images/almalinux/9.5/actionsdind/variables.auto.pkrvars.hcl index 46e693e..9d9ca73 100644 --- a/images/almalinux/9.5/actionsdind/variables.auto.pkrvars.hcl +++ b/images/almalinux/9.5/actionsdind/variables.auto.pkrvars.hcl @@ -4,8 +4,6 @@ packages = [ "bash", "consul", "docker-ce-cli", - "jq", - "make", "nodejs", "packer", "terraform", diff --git a/images/almalinux/9.5/base/variables.auto.pkrvars.hcl b/images/almalinux/9.5/base/variables.auto.pkrvars.hcl index a12f7d6..7178c73 100644 --- a/images/almalinux/9.5/base/variables.auto.pkrvars.hcl +++ b/images/almalinux/9.5/base/variables.auto.pkrvars.hcl @@ -5,6 +5,11 @@ use_incus = false packages = [ "git", "jq", + "make", + "python3.11", + "python3.11-pip", + "python3.12", + "python3.12-pip", "uv", "wget", ] diff --git a/images/almalinux/9.5/jupyterlab/variables.auto.pkrvars.hcl b/images/almalinux/9.5/jupyterlab/variables.auto.pkrvars.hcl index 154471f..04cb7eb 100644 --- a/images/almalinux/9.5/jupyterlab/variables.auto.pkrvars.hcl +++ b/images/almalinux/9.5/jupyterlab/variables.auto.pkrvars.hcl @@ -1,13 +1,6 @@ # almalinux/9.5/jupyterlab deploy_files_from_common = true docker_source = "git.query.consul/unkin/almalinux9-base:latest" -packages = [ - "uv", - "python3.11", - "python3.11-pip", - "python3.12", - "python3.12-pip" -] scripts_pre_file_copy = [ "dnf install -y sudo", ] diff --git a/images/almalinux/9.5/rpmbuilder/variables.auto.pkrvars.hcl b/images/almalinux/9.5/rpmbuilder/variables.auto.pkrvars.hcl index 943b555..10b4dc0 100644 --- a/images/almalinux/9.5/rpmbuilder/variables.auto.pkrvars.hcl +++ b/images/almalinux/9.5/rpmbuilder/variables.auto.pkrvars.hcl @@ -19,7 +19,6 @@ packages = [ "intltool", "jna", "ltrace", - "make", "nfpm", "patchutils", "perl-Fedora-VSP",