Skip to content

Commit a87a882

Browse files
committed
ci-automation/image-changes: Avoid swallowing errors
1 parent a39e53a commit a87a882

File tree

2 files changed

+19
-10
lines changed

2 files changed

+19
-10
lines changed

ci-automation/image.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ function _image_build_impl() {
8888

8989
source ci-automation/base_sysexts.sh 'local'
9090
local -n base_sysexts_ref="${arch}_base_sysexts"
91-
local base_sysexts_param=$(export IFS=,; echo "${base_sysexts_ref[*]}")
91+
local base_sysexts_param
92+
base_sysexts_param=$(export IFS=,; echo "${base_sysexts_ref[*]}")
9293

9394
# build image and related artifacts
9495
./run_sdk_container -x ./ci-cleanup.sh -n "${image_container}" -C "${packages_image}" \

ci-automation/image_changes.sh

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ function image_changes() (
4747
"https://github.com/flatcar/flatcar-build-scripts" \
4848
"${fbs_repo}"
4949
if [[ -z "${BUILDCACHE_SERVER:-}" ]]; then
50-
local BUILDCACHE_SERVER=$(source ci-automation/ci-config.env; echo "${BUILDCACHE_SERVER}")
50+
local BUILDCACHE_SERVER
51+
BUILDCACHE_SERVER=$(source ci-automation/ci-config.env; echo "${BUILDCACHE_SERVER}")
5152
fi
5253
local version
5354
version=$(source sdk_container/.repo/manifests/version.txt; echo "${FLATCAR_VERSION}")
@@ -522,14 +523,21 @@ function channel_version() (
522523
local channel=${1}; shift
523524
local board=${1}; shift
524525

525-
source <(curl \
526-
-fsSL \
527-
--retry-delay 1 \
528-
--retry 60 \
529-
--retry-connrefused \
530-
--retry-max-time 60 \
531-
--connect-timeout 20 \
532-
"https://${channel}.release.flatcar-linux.net/${board}/current/version.txt")
526+
local tmp_version_txt
527+
tmp_version_txt=$(mktemp)
528+
# This function runs in a subshell, so we can have our own scoped
529+
# traps.
530+
trap 'rm "${tmp_version_txt}"' EXIT
531+
532+
curl \
533+
-fsSL \
534+
--retry-delay 1 \
535+
--retry 60 \
536+
--retry-connrefused \
537+
--retry-max-time 60 \
538+
--connect-timeout 20 \
539+
"https://${channel}.release.flatcar-linux.net/${board}/current/version.txt" >"${tmp_version_txt}"
540+
source "${tmp_version_txt}"
533541
echo "${FLATCAR_VERSION}"
534542
)
535543
# --

0 commit comments

Comments
 (0)