build_docker_aci: include 'extra' version number

This allows for multiple iterations with the same package version if
needed.
This commit is contained in:
Euan Kemp 2017-03-06 15:19:15 -08:00
parent ada33ad411
commit b8589683b8
2 changed files with 38 additions and 25 deletions

View File

@ -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=<build_dir> 1.12.6
build_docker_aci --board=amd64-usr --build_dir=<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

View File

@ -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}" )