From 9afb5f2c8d87ee177d92bb9e6b72592934b04dcb Mon Sep 17 00:00:00 2001 From: Greg Hellings Date: Sat, 12 Aug 2023 17:28:31 -0500 Subject: [PATCH] Upload all versions --- build.xsh | 19 ++++++++++++++----- sources/qemu.pkr.hcl | 2 +- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/build.xsh b/build.xsh index ec01576..e42c40a 100755 --- a/build.xsh +++ b/build.xsh @@ -4,6 +4,7 @@ from pathlib import Path import sys sys.path.append(str(Path(__file__).parent / "lib")) from support import Support, BASE +import time support = Support() @@ -17,6 +18,10 @@ parser.add_argument("--upload", "-u", help="Force doing uploads", action="store_ parser.add_argument("--headless", help="Run builds headless", action="store_true") args = parser.parse_args() +year, month, day, hour, minute, second, wday, jday, dst = time.localtime() +STAMP = f"build={year}.{month}.{day}.{hour}" + + # Now provide menus if we don't have defaults def process_all(): if args.distro: @@ -41,15 +46,19 @@ def process_builds(builds): do_build(build) def do_build(build): - if args.upload: - upload = "" - else: - upload = "-except=upload" if args.headless: headless = "headless=true" else: headless = "headless=false" - packer build -var @(headless) @(build.var_file) @(build.only) @(upload) @(BASE / "sources") + + if args.upload: + if "VAGRANT_CLOUD_TOKEN" not in ${...}: + print("You need to set your cloud token") + sys.exit(1) + packer build -var @(headless) -var @(STAMP) @(build.var_file) @(build.only) @(BASE / "sources") + else: + upload = "-except=upload" + packer build -var @(headless) -var @(STAMP) @(build.var_file) @(build.only) -except=upload @(BASE / "sources") if args.all or (args.distro and args.version and args.build): process_all() diff --git a/sources/qemu.pkr.hcl b/sources/qemu.pkr.hcl index 292f7c8..796efdf 100644 --- a/sources/qemu.pkr.hcl +++ b/sources/qemu.pkr.hcl @@ -6,7 +6,7 @@ variable "qemu_accelerator" { source "qemu" "x86_64" { iso_url = var.iso.url iso_checksum = var.iso.checksum - output_directory = "output_qemu_${local.name}" + output_directory = "output/libvirt/${local.name}" boot_command = var.boot_command shutdown_command = var.shutdown_command