
Add retry delay to wheels and docker image build scripts. TESTS ================================= * Build docker base image, wheels and one docker image * Check Jenkins logs and make sure scripts are called with --attempts and --retry-delay Story: 2010055 Task: 48106 Depends-On: https://review.opendev.org/c/starlingx/root/+/877119 Signed-off-by: Davlet Panech <davlet.panech@windriver.com> Change-Id: I771e092ef340db8e639c121c0ebc990790eb0568
93 lines
2.5 KiB
Bash
Executable File
93 lines
2.5 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
#
|
|
# Copyright (c) 2022 Wind River Systems, Inc.
|
|
#
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
#
|
|
|
|
set -e
|
|
source $(dirname "$0")/lib/job_utils.sh
|
|
require_job_env BUILD_HOME
|
|
require_job_env USE_DOCKER_CACHE
|
|
require_job_env DRY_RUN
|
|
require_job_env BUILD_STREAM stable
|
|
require_job_env FORCE_BUILD_WHEELS
|
|
declare_job_env DOCKER_IMAGE_LIST
|
|
|
|
load_build_env
|
|
|
|
BUILD_STREAM=stable
|
|
DOCKER_IMAGE_LIST=$(trim $(echo $DOCKER_IMAGE_LIST | sed 's/,,*/ /g'))
|
|
|
|
image_requires_wheels() {
|
|
local -a parts
|
|
parts=($(source "$1" && echo "$BUILDER ${LABEL:-$PROJECT}"))
|
|
local builder=${parts[0]}
|
|
local name=${parts[1]}
|
|
|
|
info "checking $1 name=$name builder=$builder"
|
|
if [[ "$builder" != "loci" ]] ; then
|
|
return 1
|
|
fi
|
|
|
|
if [[ -n "${DOCKER_IMAGE_LIST}" ]] && ! in_list "$name" $DOCKER_IMAGE_LIST ; then
|
|
return 1
|
|
fi
|
|
|
|
return 0
|
|
}
|
|
|
|
wheels_required() {
|
|
local -i wheels_images=0
|
|
|
|
local projects
|
|
projects="$(cd "$REPO_ROOT" && repo forall -c 'echo $REPO_PATH' 2>/dev/null)"
|
|
|
|
local proj
|
|
for proj in $projects ; do
|
|
local os
|
|
for os in $DOCKER_OS_LIST ; do
|
|
local inc
|
|
for inc in $(find "$REPO_ROOT/$proj" -maxdepth 2 -type f -name "${os}_${BUILD_STREAM}_docker_images.inc") ; do
|
|
local basedir
|
|
local dir
|
|
basedir="$(dirname "$inc")"
|
|
for dir in $(grep -E -v '^\s*(#.*)?$' "$inc") ; do
|
|
local img_dir="$basedir/$dir/$os"
|
|
if [[ -d "$img_dir" ]] ; then
|
|
for img_file in $(find "$img_dir" -mindepth 1 -maxdepth 1 -name "*.${BUILD_STREAM}_docker_image") ; do
|
|
if image_requires_wheels "$img_file" ; then
|
|
let ++wheels_images
|
|
echo "${img_file#$REPO_ROOT/}: requires wheels" >&2
|
|
fi
|
|
done
|
|
fi
|
|
done
|
|
done
|
|
done
|
|
done
|
|
|
|
[[ $wheels_images -gt 0 ]] && return 0 || return 1
|
|
}
|
|
|
|
if ! $FORCE_BUILD_WHEELS && ! wheels_required ; then
|
|
bail "wheels not required, bailing out"
|
|
fi
|
|
|
|
cmd=(
|
|
"./build-wheel-tarball.sh"
|
|
"--os=$DOCKER_BASE_OS"
|
|
"--stream=$BUILD_STREAM"
|
|
"--attempts=$DOCKER_BUILD_RETRY_COUNT"
|
|
"--retry-delay=$DOCKER_BUILD_RETRY_DELAY"
|
|
)
|
|
|
|
if [[ "$USE_DOCKER_CACHE" == true ]] ; then
|
|
cmd+=("--cache")
|
|
fi
|
|
|
|
for python_arg in "" "--python2" ; do
|
|
stx_docker_cmd $DRY_RUN_ARG "cd \$MY_REPO/build-tools/build-wheels && ${cmd[*]} $python_arg"
|
|
done
|