Bug #14932
jenkins_jobs/pre-receive.hook broken by design during some migrations due to not cleaning up $JENKINS_JOBS_TEST_DIR
100%
Description
It’s not the first time this happens, and once again it took me a while to figure out a workaround, so this time I’m going to report a bug.
E.g. I see:
remote: jenkins_jobs.errors.JenkinsJobsException: Failed to find suitable template named 'reproducibly_build_Tails_ISO_{realname}'
remote: FAIL, rejecting your push. Please fix before pushing again.
To jenkins.sib:jenkins-jobs.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'gitolite@jenkins.sib:jenkins-jobs.git'
… while there is no instance of reproducibly_build_Tails_ISO_{realname}
in my jenkins-jobs.git
. Emptying $JENKINS_JOBS_TEST_DIR
fixes this problem.
The reason for the breakage is that $JENKINS_JOBS_TEST_DIR
still has old files, that got removed since, that reference a template which got renamed. I think this hook should create a temporary directory with mktemp, extract there, test it, and clean it up via trap
. This seems pretty easy to do. Or is there a reason why we should always use the same directory with cruft accumulating?
I’ll let you classify this ticket under the right SponsorX deliverable for, and prioritize it as you wish. As a user of this system, I’d like to see this fixed before the next similar job template migration that would trigger this problem again.
Subtasks
History
#1 Updated by intrigeri 2018-12-02 17:15:12
- Assignee changed from bertagaz to intrigeri
#2 Updated by intrigeri 2018-12-02 17:29:10
- Status changed from Confirmed to In Progress
- Assignee changed from intrigeri to groente
- % Done changed from 0 to 50
- QA Check set to Ready for QA
commit 2f37eb38438522541987d504e32a3c9d774ff607 in puppet-tails.git
#3 Updated by intrigeri 2018-12-02 17:37:23
Forgot to say: deployed already (sorry it did not occur to me earlier that I could ask you to review this). Works fine: I see the mtime of /var/tmp/jenkins_jobs_test
increases, which suggests mktemp does its job, and the temporary directory is correctly removed.
#5 Updated by groente 2018-12-03 12:53:02
- Status changed from In Progress to Resolved
- % Done changed from 50 to 100
- QA Check deleted (
Ready for QA)
TIL about trap, nice :)