mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-07 13:06:59 +02:00
The `--jobs` parameter that some scripts defined was not used anywhere in jenkins or mantle. So the value of the parameter always ended up being equal to `${NUM_JOBS}` set by `common.sh`. Also, even if the `--jobs` parameter was used for some script, that script usually didn't forward the jobs value to other scripts, so the other scripts ended up using `${NUM_JOBS}` again. Also, the `${FLAGS_jobs}` variable was used by some functions in the build library, and those functions were sometimes invoked by scripts that didn't define the `${FLAGS_jobs}` variable. It is tedious to track which script should actually define the parameter, and where it should be forwarded. Just get rid of this half-working pretense. If you want to affect how many jobs `emerge` uses, export the `NUM_JOBS` environment variable before calling any script. For `EMERGE_FLAGS` and `REBUILD_FLAGS` we unconditionally specify the `--jobs` flag's value to `${NUM_JOBS}` because they are passed to `emerge`. On the other hand we drop the `--jobs` parameter from the `UPDATE_ARGS` variable, because this variable passed to `setup_board` or `update_chroot`, which don't have this flag any more.
111 lines
3.8 KiB
Bash
Executable File
111 lines
3.8 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Copyright (c) 2016 The CoreOS Authors. All rights reserved.
|
|
# Use of this source code is governed by a BSD-style license that can be
|
|
# found in the LICENSE file.
|
|
|
|
# This is a wrapper around the ebuild_aci_util.sh functions to set up the
|
|
# necessary environment, similar to the build_image script.
|
|
|
|
SCRIPT_ROOT=$(dirname $(readlink -f "$0"))
|
|
. "${SCRIPT_ROOT}/common.sh" || exit 1
|
|
|
|
# Script must run inside the chroot
|
|
assert_inside_chroot
|
|
|
|
assert_not_root_user
|
|
|
|
# Developer-visible flags.
|
|
DEFINE_string board "${DEFAULT_BOARD}" \
|
|
"The board to build an image for."
|
|
DEFINE_string build_dir "" \
|
|
"Directory in which to place image result directories (named by version)"
|
|
DEFINE_boolean getbinpkg "${FLAGS_FALSE}" \
|
|
"Download binary packages from remote repository."
|
|
DEFINE_string getbinpkgver "" \
|
|
"Use binary packages from a specific 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 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 0
|
|
...
|
|
"
|
|
show_help_if_requested "$@"
|
|
|
|
# The following options are advanced options, only available to those willing
|
|
# to read the source code. They are not shown in help output, since they are
|
|
# not needed for the typical developer workflow.
|
|
DEFINE_integer build_attempt 1 \
|
|
"The build attempt for this image build."
|
|
DEFINE_string group "docker-aci" \
|
|
"The update group (not used for actual updates here)"
|
|
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
|
|
|
|
# If downloading packages is enabled ensure the board is configured properly.
|
|
if [[ ${FLAGS_getbinpkg} -eq ${FLAGS_TRUE} ]]; then
|
|
"${SRC_ROOT}/scripts/setup_board" --board="${FLAGS_board}" \
|
|
--getbinpkgver="${FLAGS_getbinpkgver}" --regen_configs_only
|
|
fi
|
|
|
|
# N.B. Ordering matters for some of the libraries below, because
|
|
# some of the files contain initialization used by later files.
|
|
. "${BUILD_LIBRARY_DIR}/toolchain_util.sh" || exit 1
|
|
. "${BUILD_LIBRARY_DIR}/board_options.sh" || exit 1
|
|
. "${BUILD_LIBRARY_DIR}/build_image_util.sh" || exit 1
|
|
. "${BUILD_LIBRARY_DIR}/prod_image_util.sh" || exit 1
|
|
. "${BUILD_LIBRARY_DIR}/test_image_content.sh" || exit 1
|
|
. "${BUILD_LIBRARY_DIR}/ebuild_aci_util.sh" || exit 1
|
|
|
|
BUILD_DIR=${FLAGS_build_dir:-$BUILD_DIR}
|
|
|
|
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/flatcar/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
|