Commit 1501f638 authored by intrigeri's avatar intrigeri
Browse files

IUK creation: delete temporary directory on success (refs: #15287)

tails-create-iuk previously left temporary files behind. In particular, even on
success, the "squashfs_src" directory would remain on the filesystem.

It's no big deal in general, but our build_IUKs Jenkins job runs
tails-create-iuk as root with sudo, so the leftover temporary files are owned by
root, and then the "workspace-cleanup" step (itself run as the "jenkins" user)
can't delete them, which causes 2 problems:

 - These temporary files would endlessly accumulate on isobuilders,
   without any mechanism to clean them up automatically.

 - Confusing output in the Jenkins console:

      cannot remove path when cwd is /var/lib/jenkins/workspace/build_IUKs/j4gMvgS3wH for /var/lib/jenkins/workspace/build_IUKs/j4gMvgS3wH:  at /usr/share/perl/5.24/File/Temp.pm line 1583.
      Archiving artifacts
      [WS-CLEANUP] Deleting project workspace...
      Cannot delete workspace: null
      Option not to fail the build is turned on, so let's continue
parent a61ffaae
......@@ -462,6 +462,11 @@ method save () {
$self->saveas($self->outfile);
}
method delete_tempdir () {
chdir '/';
run_as_root(qw{rm -rf}, $self->tempdir);
}
method run () {
assert_exists(
\%ENV, 'SOURCE_DATE_EPOCH', q{SOURCE_DATE_EPOCH is in the environment}
......@@ -470,6 +475,7 @@ method run () {
$ENV{SOURCE_DATE_EPOCH}, q{SOURCE_DATE_EPOCH variable is not empty}
);
$self->save;
$self->delete_tempdir;
}
no Moo;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment