From b8589683b87b31bd5d84c07cd01d914a186cd32f Mon Sep 17 00:00:00 2001 From: Euan Kemp Date: Mon, 6 Mar 2017 15:19:15 -0800 Subject: [PATCH] build_docker_aci: include 'extra' version number This allows for multiple iterations with the same package version if needed. --- build_docker_aci | 59 +++++++++++++++++++------------- build_library/ebuild_aci_util.sh | 4 +-- 2 files changed, 38 insertions(+), 25 deletions(-) diff --git a/build_docker_aci b/build_docker_aci index 19e479f50f..22207690f4 100755 --- a/build_docker_aci +++ b/build_docker_aci @@ -25,14 +25,18 @@ DEFINE_boolean getbinpkg "${FLAGS_FALSE}" \ DEFINE_string getbinpkgver "" \ "Use binary packages from a specific version." -FLAGS_HELP="USAGE: build_docker_aci [flags] [docker version]. +FLAGS_HELP="USAGE: build_docker_aci [flags] [docker version] [aci version number]. This script is used to build a CoreOS docker-skim ACI. -The version should identify an existent ebuild (i.e. app-emulation/docker-\$version). +The docker version should identify an existent ebuild (i.e. +app-emulation/docker-\$version). + +The aci version number is an atomically incrementing number that will be +appended to the aci version (to create e.g. :v1.12.6_coreos.0). Examples: -build_docker_aci --board=amd64-usr --build_dir= 1.12.6 +build_docker_aci --board=amd64-usr --build_dir= 1.12.6 0 ... " show_help_if_requested "$@" @@ -48,12 +52,18 @@ DEFINE_string output_root "${DEFAULT_BUILD_ROOT}/images" \ "Directory in which to place image result directories (named by version)" DEFINE_string version "" \ "Sets the docker version to build." +DEFINE_integer aci_version "" \ + "Sets the aci version tag identifier." # Parse command line. FLAGS "$@" || exit 1 [ -z "${FLAGS_ARGV}" ] && echo 'No version given' && exit 0 eval set -- "${FLAGS_ARGV}" +version="${1:?Docker version}" +aci_version="${2:?Docker version}" + + # Only now can we die on error. shflags functions leak non-zero error codes, # so will die prematurely if 'switch_to_strict_mode' is specified before now. switch_to_strict_mode @@ -75,23 +85,26 @@ fi BUILD_DIR=${FLAGS_build_dir:-$BUILD_DIR} -for version; do - case "${version}" in - 1.12.[0-9]*) - packaged_files=( - "/usr/bin/docker" - "/usr/bin/dockerd" - "/usr/bin/docker-containerd" - "/usr/bin/docker-containerd-shim" - "/usr/bin/docker-proxy" - "/usr/bin/docker-runc" - "/usr/lib/coreos/dockerd" - ) - ebuild_aci_create "users.developer.core-os.net/skim/docker" "coreos_docker-${version}-${BOARD}" "app-emulation/docker" "${version}" "${packaged_files[@]}" - ;; - *) - 1>&2 echo "Unrecognized version; please enter a supported version" - exit 1 - ;; - esac -done +case "${version}" in + 1.12.[0-9]*) + packaged_files=( + "/usr/bin/docker" + "/usr/bin/dockerd" + "/usr/bin/docker-containerd" + "/usr/bin/docker-containerd-shim" + "/usr/bin/docker-proxy" + "/usr/bin/docker-runc" + "/usr/lib/coreos/dockerd" + ) + ebuild_aci_create "users.developer.core-os.net/skim/docker" \ + "coreos_docker-${BOARD}-${version}_coreos.${aci_version}" \ + "app-emulation/docker" \ + "${version}" \ + "${aci_version}" \ + "${packaged_files[@]}" + ;; + *) + 1>&2 echo "Unrecognized version; please enter a supported version" + exit 1 + ;; +esac diff --git a/build_library/ebuild_aci_util.sh b/build_library/ebuild_aci_util.sh index fcafc3b31e..91d78fd42d 100644 --- a/build_library/ebuild_aci_util.sh +++ b/build_library/ebuild_aci_util.sh @@ -57,6 +57,7 @@ ebuild_aci_create() { local output_image="${1?No output file specified}"; shift local pkg="${1?No package given}"; shift local version="${1?No package version given}"; shift + local extra_version="${1?No extra version number given}"; shift local pkg_files=( "${@}" ) local staging_image="coreos_pkg_staging_aci_stage.bin" @@ -75,11 +76,10 @@ ebuild_aci_create() { trap "cleanup_mounts '${aciroot}/rootfs' && delete_prompt" EXIT # Substitute variables into the manifest to produce the final version. - # TODO: tag with the right version ebuild_aci_write_manifest \ "${aciroot}/manifest" \ "${aci_name}" \ - "${version}" + "${version}_coreos.${extra_version}" local pkg_files_in_rootfs=( "${pkg_files[@]/#/rootfs}" )