From 429b4358d586694bb0ee83c96a16ce3eb06d1e80 Mon Sep 17 00:00:00 2001 From: Tom Kirchner Date: Tue, 9 Feb 2021 19:57:35 +0000 Subject: [PATCH] Pass BUILDSYS_NAME to rpm2img so we use requested image name prefix --- Dockerfile | 3 ++- tools/buildsys/src/builder.rs | 3 +++ tools/rpm2img | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 09be2d57c6c..d970878af88 100644 --- a/Dockerfile +++ b/Dockerfile @@ -152,8 +152,9 @@ ARG VERSION_ID ARG BUILD_ID ARG NOCACHE ARG VARIANT +ARG IMAGE_NAME ARG IMAGE_FORMAT -ENV VARIANT=${VARIANT} VERSION_ID=${VERSION_ID} BUILD_ID=${BUILD_ID} IMAGE_FORMAT=${IMAGE_FORMAT} +ENV VARIANT=${VARIANT} VERSION_ID=${VERSION_ID} BUILD_ID=${BUILD_ID} IMAGE_NAME=${IMAGE_NAME} IMAGE_FORMAT=${IMAGE_FORMAT} WORKDIR /root USER root diff --git a/tools/buildsys/src/builder.rs b/tools/buildsys/src/builder.rs index cab18ebe27c..9973e4901d5 100644 --- a/tools/buildsys/src/builder.rs +++ b/tools/buildsys/src/builder.rs @@ -93,6 +93,7 @@ impl VariantBuilder { let version_image = getenv("BUILDSYS_VERSION_IMAGE")?; let version_build = getenv("BUILDSYS_VERSION_BUILD")?; let output_dir: PathBuf = getenv("BUILDSYS_OUTPUT_DIR")?.into(); + let image_name = getenv("BUILDSYS_NAME")?; let image_format = match image_format { Some(ImageFormat::Raw) | None => String::from("raw"), Some(ImageFormat::Vmdk) => String::from("vmdk"), @@ -108,12 +109,14 @@ impl VariantBuilder { --build-arg VARIANT={variant} \ --build-arg VERSION_ID={version_image} \ --build-arg BUILD_ID={version_build} \ + --build-arg IMAGE_NAME={image_name} \ --build-arg IMAGE_FORMAT={image_format}", packages = packages, arch = arch, variant = variant, version_image = version_image, version_build = version_build, + image_name = image_name, image_format = image_format, ); let tag = format!( diff --git a/tools/rpm2img b/tools/rpm2img index a642e18e571..ba7286bc05d 100755 --- a/tools/rpm2img +++ b/tools/rpm2img @@ -24,7 +24,7 @@ esac mkdir -p "${OUTPUT_DIR}" -FILENAME_PREFIX="bottlerocket-${VARIANT}-${ARCH}-${VERSION_ID}-${BUILD_ID}" +FILENAME_PREFIX="${IMAGE_NAME}-${VARIANT}-${ARCH}-${VERSION_ID}-${BUILD_ID}" DISK_IMAGE_BASENAME="${FILENAME_PREFIX}" DATA_IMAGE_BASENAME="${FILENAME_PREFIX}-data"