Skip to content

Commit 61d1271

Browse files
Martin Basticlaude
andcommitted
Fix mktemp --dry-run not creating temp directory in generate-ta-tasks.sh
mktemp --dry-run only prints a candidate path without creating it, causing go install/build to fail. Use mktemp -d to actually create the directory, and move the cleanup trap before usage so it fires on early failures. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Martin Basti <mbasti@redhat.com>
1 parent d28b70d commit 61d1271

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

hack/generate-ta-tasks.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ ROOT_DIR="$(git rev-parse --show-toplevel)"
2020
TASK_DIR="$(realpath "${ROOT_DIR}/task")"
2121
: "${TRUSTED_ARTIFACTS=github.com/konflux-ci/build-definitions/task-generator/trusted-artifacts@latest}"
2222

23-
tashdir="$(mktemp --dry-run)"
23+
tashdir="$(mktemp -d)"
24+
trap 'rm -rf "${tashdir}"' EXIT
2425
if [[ -d "${TRUSTED_ARTIFACTS}" ]]; then
2526
tashbin=${tashdir}/trusted-artifacts
2627
GOTOOLCHAIN=auto GOSUMDB=sum.golang.org go build -C "${TRUSTED_ARTIFACTS}" -o "${tashbin}"
@@ -33,7 +34,6 @@ else
3334
fi
3435
tashbin=${bin[0]}
3536
fi
36-
trap 'rm -r "${tashdir}"' EXIT
3737

3838
tash() {
3939
"${tashbin}" "$@"

{{cookiecutter.repo_root}}/hack/generate-ta-tasks.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ ROOT_DIR="$(git rev-parse --show-toplevel)"
2020
TASK_DIR="$(realpath "${ROOT_DIR}/task")"
2121
: "${TRUSTED_ARTIFACTS=github.com/konflux-ci/build-definitions/task-generator/trusted-artifacts@latest}"
2222

23-
tashdir="$(mktemp --dry-run)"
23+
tashdir="$(mktemp -d)"
24+
trap 'rm -rf "${tashdir}"' EXIT
2425
if [[ -d "${TRUSTED_ARTIFACTS}" ]]; then
2526
tashbin=${tashdir}/trusted-artifacts
2627
GOTOOLCHAIN=auto GOSUMDB=sum.golang.org go build -C "${TRUSTED_ARTIFACTS}" -o "${tashbin}"
@@ -33,7 +34,6 @@ else
3334
fi
3435
tashbin=${bin[0]}
3536
fi
36-
trap 'rm -r "${tashdir}"' EXIT
3737

3838
tash() {
3939
"${tashbin}" "$@"

0 commit comments

Comments
 (0)