diff --git a/pipelines/monolithic.Jenkinsfile b/pipelines/monolithic.Jenkinsfile index 50ddacf..e6dda99 100644 --- a/pipelines/monolithic.Jenkinsfile +++ b/pipelines/monolithic.Jenkinsfile @@ -304,7 +304,10 @@ pipeline { } } } stage('IMAGES:symlinks') { - when { expression { ! IMAGES_FAILED } } + // Create the symlink even if some images failed. + // FIXME: remove all logic re publishing failed docker builds + // once all images have been fixed for Debian + // when { expression { ! IMAGES_FAILED } } steps { script { // copy image lists to publish root and create the "latest_docker_image_build" symlinks // in publish and archive roots diff --git a/scripts/build-docker-images.sh b/scripts/build-docker-images.sh index 7ebb3a4..fecdad3 100755 --- a/scripts/build-docker-images.sh +++ b/scripts/build-docker-images.sh @@ -105,13 +105,21 @@ retag_and_push() { # build them lists_dir="$HOST_WORKSPACE/std/build-images" +failed=0 for os in $(echo $DOCKER_OS_LIST | sed 's/,/ /g') ; do list_file="$lists_dir/images-$os-$BUILD_STREAM-versioned.lst" notice "building $BUILD_STREAM $os images" $DRY_RUN || rm -f "$list_file" - stx_docker_cmd $DRY_RUN_ARG "cd \$MY_REPO/build-tools/build-docker-images && ${cmd[*]} --os=$os" - if $PUSH_DOCKER_IMAGES && [[ -f "$list_file" ]] ; then - retag_and_push "$list_file" + if stx_docker_cmd $DRY_RUN_ARG "cd \$MY_REPO/build-tools/build-docker-images && ${cmd[*]} --os=$os" ; then + if $PUSH_DOCKER_IMAGES && [[ -f "$list_file" ]] ; then + retag_and_push "$list_file" + fi + continue fi + failed=1 done +if [[ $failed -ne 1 ]] ; then + notice "one or more images failed to build, see output above" + exit 1 +fi diff --git a/scripts/create-latest-containers-symlinks.sh b/scripts/create-latest-containers-symlinks.sh index b185c44..7f61a9e 100755 --- a/scripts/create-latest-containers-symlinks.sh +++ b/scripts/create-latest-containers-symlinks.sh @@ -18,36 +18,30 @@ if $DRY_RUN ; then fi ARCHIVE_ROOT=$(dirname "$BUILD_OUTPUT_HOME") +link_target=$(basename "$BUILD_OUTPUT_HOME") -set -x +# find image list files +image_list_files_str="$( + find "$BUILD_OUTPUT_HOME/workspace/std/build-images" \ + -mindepth 1 -maxdepth 1 \ + -type f -name 'images-*.lst' \ + | sed -r -e 's/^\s+//' -e 's/\s+$//' \ + | grep -E -v -e '^\s#' -e '^\s*$' +)" || exit 1 +declare -a image_list_files +readarray -t image_list_files <<<"$image_list_files_str" -if [[ "$BUILD_STATUS" == "success" ]] ; then - ARCHIVE_ROOT=$(dirname "$BUILD_OUTPUT_HOME") - link_target=$(basename "$BUILD_OUTPUT_HOME") +# more than one - success +if [[ "${#image_list_files[@]}" -gt 0 ]] ; then - # find image list files - image_list_files_str="$( - find "$BUILD_OUTPUT_HOME/workspace/std/build-images" \ - -mindepth 1 -maxdepth 1 \ - -type f -name 'images-*.lst' \ - | sed -r -e 's/^\s+//' -e 's/\s+$//' \ - | grep -E -v -e '^\s#' -e '^\s*$' - )" || exit 1 - declare -a image_list_files - readarray -t image_list_files <<<"$image_list_files_str" - - # more than one - success - if [[ "${#image_list_files[@]}" -gt 0 ]] ; then - - # archive LAST_COMMITS & latest symlink - cp "$BUILD_OUTPUT_HOME/LAST_COMMITS" "$ARCHIVE_ROOT/LAST_COMMITS_IMG_STABLE" - ln -sfn "$link_target" "$ARCHIVE_ROOT/latest_docker_image_build" - - # publish image lists & latest symlink - cp "${image_list_files[@]}" "$PUBLISH_ROOT/" - if ! same_path "$ARCHIVE_ROOT" "$PUBLISH_ROOT" ; then - ln -sfn "$link_target" "$PUBLISH_ROOT/latest_docker_image_build" - fi + # archive LAST_COMMITS & latest symlink + cp "$BUILD_OUTPUT_HOME/LAST_COMMITS" "$ARCHIVE_ROOT/LAST_COMMITS_IMG_STABLE" + ln -sfn "$link_target" "$ARCHIVE_ROOT/latest_docker_image_build" + # publish image lists & latest symlink + cp "${image_list_files[@]}" "$PUBLISH_ROOT/" + if ! same_path "$ARCHIVE_ROOT" "$PUBLISH_ROOT" ; then + ln -sfn "$link_target" "$PUBLISH_ROOT/latest_docker_image_build" fi + fi