From afe1e02310de93395e8d6a94d17acb0c60f85b42 Mon Sep 17 00:00:00 2001 From: technofab Date: Thu, 13 Nov 2025 21:39:38 +0100 Subject: [PATCH 1/3] fix(job): use unmodified job for mkJobRun otherwise it tries to run "setup_nix_ci" etc. when running locally, which doesn't make sense here --- lib/impl/modules/job.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/impl/modules/job.nix b/lib/impl/modules/job.nix index 5f7d1ee..295093d 100644 --- a/lib/impl/modules/job.nix +++ b/lib/impl/modules/job.nix @@ -637,12 +637,12 @@ in rec { // gitlabOptions; config = let attrsToKeep = builtins.attrNames gitlabOptions; + job = filterUnset (filterAttrs (n: _v: builtins.elem n attrsToKeep) config); in { finalConfig = cilib.mkJobPatched { key = name; - job = filterUnset (filterAttrs (n: _v: builtins.elem n attrsToKeep) config); nixConfig = config.nix; - inherit pipelineName; + inherit job pipelineName; }; depsDrv = cilib.mkJobDeps { key = name; @@ -651,8 +651,8 @@ in rec { }; runnerDrv = cilib.mkJobRun { key = name; - job = config.finalConfig; jobDeps = config.depsDrv; + inherit job; }; packages = { "gitlab-ci:pipeline:${pipelineName}:job-deps:${name}" = config.depsDrv; From f5181b7b611204353b688cb557ade99426d2b01f Mon Sep 17 00:00:00 2001 From: technofab Date: Thu, 13 Nov 2025 21:40:24 +0100 Subject: [PATCH 2/3] fix(sandbox_helper): fix comparisons, rename TMPDIR variable, add help 1. fixes comparisons with true for flag variables 2. renames TMPDIR to NGCI_TMPDIR so it doesn't interfere with the standardized TMPDIR var (and at some point accidentally deleting /tmp) 3. add small help message when invalid arg/param is passed 4. run `git add .` on copied git repo in /tmp so staged files stay staged there aswell --- lib/impl/sandbox_helper.sh | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/lib/impl/sandbox_helper.sh b/lib/impl/sandbox_helper.sh index 294fc6b..8b76ae1 100644 --- a/lib/impl/sandbox_helper.sh +++ b/lib/impl/sandbox_helper.sh @@ -28,18 +28,19 @@ while [[ $# -gt 0 ]]; do ;; *) echo "Unknown option: $1" >&2 + echo "use --include-dirty, --no-sandbox, --keep-tmp and --keep-env " >&2 exit 1 ;; esac done -if [ "$NO_SANDBOX" = false ]; then +if [ $NO_SANDBOX = false ]; then echo "Running with simple sandboxing" - TMPDIR=$(mktemp -dt "nix-gitlab-ci.XXX") - if [ "$KEEP_TMP" = false ]; then - trap "rm -rf '$TMPDIR'" EXIT + NGCI_TMPDIR=$(mktemp -dt "nix-gitlab-ci.XXX") + if [ $KEEP_TMP = false ]; then + trap "rm -rf '$NGCI_TMPDIR'" EXIT else - echo "Temp dir will be preserved at: $TMPDIR" + echo "Temp dir will be preserved at: $NGCI_TMPDIR" fi # check if dirty @@ -50,14 +51,15 @@ if [ "$NO_SANDBOX" = false ]; then git diff --staged > "$DIRTY_PATCH" trap "rm -f '$DIRTY_PATCH'" EXIT fi - git clone . $TMPDIR - pushd $TMPDIR >/dev/null - if [[ ! -z "$DIRTY_PATCH" && "$INCLUDE_DIRTY" = true ]]; then + git clone . $NGCI_TMPDIR + pushd $NGCI_TMPDIR >/dev/null + if [[ ! -z "$DIRTY_PATCH" && $INCLUDE_DIRTY = true ]]; then echo "Copying dirty changes..." git apply "$DIRTY_PATCH" 2>/dev/null || echo "Failed to copy dirty changes" + git add . # required so the files are staged again fi - echo "Running job in $TMPDIR" + echo "Running job in $NGCI_TMPDIR" env -i $( if [[ -n "$KEEP_ENV" ]]; then IFS=',' read -ra VARS <<< "$KEEP_ENV" From 524bdf9cdcfb8008c08d7e54a95992ebf05331d5 Mon Sep 17 00:00:00 2001 From: technofab Date: Thu, 13 Nov 2025 21:44:28 +0100 Subject: [PATCH 3/3] chore: bump version --- lib/VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/VERSION b/lib/VERSION index 4a36342..cb2b00e 100644 --- a/lib/VERSION +++ b/lib/VERSION @@ -1 +1 @@ -3.0.0 +3.0.1