Skip to content

Commit b8ecc54

Browse files
committed
cmd-build-with-buildah: add --skip-prune
This is used by the pipeline for some reason. We could probably rip it out of there, but the dev case I think has value, so just add it.
1 parent 74e9b8d commit b8ecc54

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

src/cmd-build-with-buildah

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,17 @@ Usage: coreos-assembler build-with-buildah
2020
--autolock=VERSION If no base lockfile used, create one from any arch build of `VERSION`.
2121
Note this is automatically enabled when adding to an existing multi-arch
2222
non-strict build.
23+
--skip-prune Skip prunning previous builds
2324
EOF
2425
}
2526

2627
VERSION=
2728
VERSIONARY=
2829
DIRECT=
2930
AUTOLOCK_VERSION=
31+
SKIP_PRUNE=
3032
rc=0
31-
options=$(getopt --options h,d --longoptions help,version:,versionary,direct,autolock: -- "$@") || rc=$?
33+
options=$(getopt --options h,d --longoptions help,version:,versionary,direct,autolock:,skip-prune -- "$@") || rc=$?
3234
[ $rc -eq 0 ] || {
3335
print_help
3436
exit 1
@@ -54,6 +56,9 @@ while true; do
5456
shift;
5557
AUTOLOCK_VERSION=$1
5658
;;
59+
--skip-prune)
60+
SKIP_PRUNE=1
61+
;;
5762
--)
5863
shift
5964
break
@@ -163,7 +168,7 @@ build_with_buildah() {
163168
env -C "${tempdir}/src" TMPDIR="$(realpath cache)" buildah "$@"
164169
fi
165170

166-
/usr/lib/coreos-assembler/cmd-import "${final_ref}"
171+
/usr/lib/coreos-assembler/cmd-import "${final_ref}" ${SKIP_PRUNE:+--skip-prune}
167172

168173
rm -rf "${tempdir}"
169174
}

src/cmd-import

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,16 @@ def main():
5858
# move into official location
5959
finalize_build(builds, build_meta, tmp_oci_archive, tmp_oci_manifest, tmp_lockfile)
6060

61-
subprocess.check_call(['/usr/lib/coreos-assembler/cmd-prune'])
61+
if not args.skip_prune:
62+
subprocess.check_call(['/usr/lib/coreos-assembler/cmd-prune'])
6263

6364

6465
def parse_args():
6566
parser = argparse.ArgumentParser(prog='cosa import')
6667
parser.add_argument("srcimg", metavar='IMAGE',
6768
help="image to import (containers-transports(5) format)")
69+
parser.add_argument("--skip-prune", action='store_true',
70+
help="Skip prunning previous builds")
6871
return parser.parse_args()
6972

7073

0 commit comments

Comments
 (0)