Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes to the imagename #37

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 44 additions & 29 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,23 +63,29 @@ usage() {
targets=$(ls $BUILDER_SUPPORT_ROOT/dockerfiles/Dockerfile.target.* | sed 's/.*Dockerfile.target.//' | tr '\n' ' ')
echo "Builds packages in Docker for a target distribution, or sdist for generic source packages."
echo
echo "USAGE: $0 <target>"
echo "USAGE: $0 [options] <target>"
echo
echo "Options:"
echo " -q - Be more quiet. Build error details are still printed on build error."
echo " -v - Always show full docker build output (default: only steps and build error details)"
echo " -S - Force running of install tests, even if this is not a full build"
echo " -s - Skip install tests"
echo " -t TAG - Use TAG instead of 'builder-\$REPO_NAME-\$TARGET' for the tagged image."
echo " -T TAG_VERSION - Use TAG_VERSION as the version of the image. 'latest' by default. set to 'version' to use the value from -V"
echo ""
echo " docker build options:"
echo " -B ARG=VAL - Add extra build arguments, can be passed more than once"
echo " -b VALUE - Docker cache buster, set to 'always', 'daily', 'weekly' or a literal value."
echo " -C - Run docker build with --no-cache"
echo " -P - Run docker build with --pull"
echo ""
echo " Package options:"
echo " -c - Enable builder package cache"
echo " -V VERSION - Override version (default: run gen-version)"
echo " -R RELEASE - Override release tag (default: '1pdns', do not include %{dist} here)"
echo " -m MODULES - Build only specific components (comma separated; warning: this disables install tests)"
echo " -e EPOCH - Set a specific Epoch for packages"
echo " -P - Run docker build with --pull"
echo " -m MODULES - Build only specific components (comma separated; warning: this disables install tests)"
echo " -p PACKAGENAME - Build only spec files that have this string in their name (warning: this disables install tests)"
echo " -s - Skip install tests"
echo " -S - Force running of install tests, even if this is not a full build"
echo " -v - Always show full docker build output (default: only steps and build error details)"
echo " -q - Be more quiet. Build error details are still printed on build error."
echo " -b VALUE - Docker cache buster, set to 'always', 'daily', 'weekly' or a literal value."
echo " -R RELEASE - Override release tag (default: '1pdns', do not include %{dist} here)"
echo " -V VERSION - Override version (default: run gen-version)"
echo
echo "Targets: $targets"
echo
Expand Down Expand Up @@ -112,29 +118,20 @@ BUILDER_MODULES=''

package_match=""
cache_buster=""
iversion="latest"

while getopts ":CcV:R:svqm:Pp:b:e:B:" opt; do
while getopts ":B:b:Cce:m:Pp:qR:SsT:t:V:v" opt; do
case $opt in
C) dockeropts+=('--no-cache')
B) buildargs+=("--build-arg ${OPTARG}")
;;
c) export BUILDER_CACHE=1
b) cache_buster="$OPTARG"
;;
V) _version="$OPTARG"
C) dockeropts+=('--no-cache')
;;
R) export BUILDER_RELEASE="$OPTARG"
c) export BUILDER_CACHE=1
;;
e) export BUILDER_EPOCH="$OPTARG"
;;
s) export skiptests=1
echo "NOTE: Skipping install tests, as requested with -s"
;;
S) export forcetests=1
;;
v) verbose=1
;;
q) quiet=1
dockeroutdev=/dev/null
;;
m) export M_all=
export skiptests=1
echo -e "${color_red}WARNING: Skipping install tests, because not all components are being built${color_reset}"
Expand All @@ -151,9 +148,23 @@ while getopts ":CcV:R:svqm:Pp:b:e:B:" opt; do
export skiptests=1
echo -e "${color_red}WARNING: Skipping install tests, because not all packages are being built${color_reset}"
;;
b) cache_buster="$OPTARG"
q) quiet=1
dockeroutdev=/dev/null
;;
B) buildargs+=("--build-arg ${OPTARG}")
R) export BUILDER_RELEASE="$OPTARG"
;;
S) export forcetests=1
;;
s) export skiptests=1
echo "NOTE: Skipping install tests, as requested with -s"
;;
T) iversion="$OPTARG"
;;
t) iprefix="$OPTARG"
;;
V) _version="$OPTARG"
;;
v) verbose=1
;;
\?) echo "Invalid option: -$OPTARG" >&2
usage
Expand Down Expand Up @@ -234,8 +245,12 @@ cd - > /dev/null
# Build docker images with artifacts inside
#

iprefix="builder-${repo_safe_name}-${target}"
image="$iprefix:latest" # TODO: maybe use version instead of latest?
iprefix="${iprefix:-builder-${repo_safe_name}-${target}}"
image="$iprefix:$iversion"
if [ "$iversion" = "version" ]; then
image="$iprefix:${BUILDER_VERSION}"
fi

echo -e "${color_white}Building docker image: ${image}${color_reset}"

buildcmd=(docker build --build-arg BUILDER_VERSION="$BUILDER_VERSION"
Expand Down