From 7f16c6c520e4eac5f3cbde50a96f9037bac82069 Mon Sep 17 00:00:00 2001 From: Zac Mrowicki Date: Thu, 21 Oct 2021 15:25:46 +0000 Subject: [PATCH] Makefile: Add the ability to override the AMI data file suffix This adds an additional variable to the `Makefile` that can be used to override the suffix of the file where AMI data is written during publish operations. It is currently set to `amis.json`, which is identical to its previous hard-coded value. Overriding this variable can be useful when a user is publishing to multiple places with different `Infra.toml` files and wishes to write AMI data to specifically named files. --- Makefile.toml | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/Makefile.toml b/Makefile.toml index c58a35d316d..6489b983d60 100644 --- a/Makefile.toml +++ b/Makefile.toml @@ -90,6 +90,12 @@ CARGO_HOME = "${BUILDSYS_ROOT_DIR}/.cargo" GO_MOD_CACHE = "${BUILDSYS_ROOT_DIR}/.gomodcache" DOCKER_BUILDKIT = "1" +# This is the filename suffix for operations that write out AMI information to +# file. It can be overridden with -e in situations where a user is using +# multiple `Infra.toml` files for publishing to different places, and wants to +# write AMI information to specifically named files. +AMI_DATA_FILE_SUFFIX = "amis.json" + [env.development] # Certain variables are defined here to allow us to override a component value # on the command line. @@ -758,8 +764,8 @@ fi lz4 -df "${rootlz4}" "${root_image}" lz4 -df "${datalz4}" "${data_image}" -ami_output="${BUILDSYS_OUTPUT_DIR}/${BUILDSYS_NAME_FULL}-amis.json" -ami_output_latest="${BUILDSYS_OUTPUT_DIR}/latest/${BUILDSYS_NAME_VARIANT}-amis.json" +ami_output="${BUILDSYS_OUTPUT_DIR}/${BUILDSYS_NAME_FULL}-${AMI_DATA_FILE_SUFFIX}" +ami_output_latest="${BUILDSYS_OUTPUT_DIR}/latest/${BUILDSYS_NAME_VARIANT}-${AMI_DATA_FILE_SUFFIX}" ami_name="${PUBLISH_AMI_NAME:-${PUBLISH_AMI_NAME_DEFAULT}}" @@ -798,7 +804,7 @@ set -e export PATH="${BUILDSYS_TOOLS_DIR}/bin:${PATH}" -ami_input="${BUILDSYS_OUTPUT_DIR}/${BUILDSYS_NAME_FULL}-amis.json" +ami_input="${BUILDSYS_OUTPUT_DIR}/${BUILDSYS_NAME_FULL}-${AMI_DATA_FILE_SUFFIX}" if [ ! -s "${ami_input}" ]; then echo "AMI input file doesn't exist for the current version/commit - ${BUILDSYS_VERSION_FULL} - please run 'cargo make ami'" >&2 exit 1 @@ -828,7 +834,7 @@ set -e export PATH="${BUILDSYS_TOOLS_DIR}/bin:${PATH}" -ami_input="${BUILDSYS_OUTPUT_DIR}/${BUILDSYS_NAME_FULL}-amis.json" +ami_input="${BUILDSYS_OUTPUT_DIR}/${BUILDSYS_NAME_FULL}-${AMI_DATA_FILE_SUFFIX}" if [ ! -s "${ami_input}" ]; then echo "AMI input file doesn't exist for the current version/commit - ${BUILDSYS_VERSION_FULL} - please run 'cargo make ami'" >&2 exit 1 @@ -863,7 +869,7 @@ if [ -z "${GRANT_TO_USERS}" ] && [ -z "${GRANT_TO_GROUPS}" ]; then exit 1 fi -ami_input="${BUILDSYS_OUTPUT_DIR}/${BUILDSYS_NAME_FULL}-amis.json" +ami_input="${BUILDSYS_OUTPUT_DIR}/${BUILDSYS_NAME_FULL}-${AMI_DATA_FILE_SUFFIX}" if [ ! -s "${ami_input}" ]; then echo "AMI input file doesn't exist for the current version/commit - ${BUILDSYS_VERSION_FULL} - please run 'cargo make ami'" >&2 exit 1 @@ -899,7 +905,7 @@ if [ -z "${REVOKE_FROM_USERS}" ] && [ -z "${REVOKE_FROM_GROUPS}" ]; then exit 1 fi -ami_input="${BUILDSYS_OUTPUT_DIR}/${BUILDSYS_NAME_FULL}-amis.json" +ami_input="${BUILDSYS_OUTPUT_DIR}/${BUILDSYS_NAME_FULL}-${AMI_DATA_FILE_SUFFIX}" if [ ! -s "${ami_input}" ]; then echo "AMI input file doesn't exist for the current version/commit - ${BUILDSYS_VERSION_FULL} - please run 'cargo make ami'" >&2 exit 1 @@ -930,7 +936,7 @@ set -e export PATH="${BUILDSYS_TOOLS_DIR}/bin:${PATH}" -ami_input="${BUILDSYS_OUTPUT_DIR}/${BUILDSYS_NAME_FULL}-amis.json" +ami_input="${BUILDSYS_OUTPUT_DIR}/${BUILDSYS_NAME_FULL}-${AMI_DATA_FILE_SUFFIX}" if [ ! -s "${ami_input}" ]; then echo "AMI input file doesn't exist for the current version/commit - ${BUILDSYS_VERSION_FULL} - please run 'cargo make ami'" >&2 exit 1