Skip to content

Commit

Permalink
Merge pull request #892 from Nordix/catch-upload-error/sunnat
Browse files Browse the repository at this point in the history
Catch curl upload error when upload fails
  • Loading branch information
metal3-io-bot authored Nov 5, 2024
2 parents 8103e5a + 972ab7a commit 85d6766
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion jenkins/image_building/upload-node-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ rt_delete_artifact() {
rt_upload_artifact() {
local src_path="${1:?}"
local dst_path="${2:?}"
curl -s -XPUT -u"${RT_USER:?}:${RT_TOKEN:?}" "${RT_URL}/${dst_path}" -T "${src_path}"
curl -s --fail-with-body -XPUT -u"${RT_USER:?}:${RT_TOKEN:?}" "${RT_URL}/${dst_path}" -T "${src_path}"
}

rt_list_directory() {
Expand Down
12 changes: 6 additions & 6 deletions jenkins/scripts/artifactory/utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ rt_upload_artifact() {
ANONYMOUS="${3:-1}"

_CMD="curl \
$( ([[ "${ANONYMOUS}" != 1 ]] && echo " -u${RT_USER:?}:${RT_TOKEN:?}") || true) \
--fail-with-body \
$( ([[ "${ANONYMOUS}" -ne 1 ]] && echo " -u${RT_USER:?}:${RT_TOKEN:?}") || true) \
${RT_URL}/${DST_PATH} \
-T ${SRC_PATH}"

eval "${_CMD}"
}

Expand All @@ -46,7 +46,7 @@ rt_download_artifact() {
ANONYMOUS="${3:-1}"

_CMD="curl -s \
$( ([[ "${ANONYMOUS}" != 1 ]] && echo " -u${RT_USER:?}:${RT_TOKEN:?}") || true) \
$( ([[ "${ANONYMOUS}" -ne 1 ]] && echo " -u${RT_USER:?}:${RT_TOKEN:?}") || true) \
-XGET \
${RT_URL}/${SRC_PATH} \
-o ${DST_PATH}"
Expand All @@ -71,7 +71,7 @@ rt_cat_artifact() {
ANONYMOUS="${2:-1}"

_CMD="curl -s \
$( ([[ "${ANONYMOUS}" != 1 ]] && echo " -u${RT_USER:?}:${RT_TOKEN:?}") || true) \
$( ([[ "${ANONYMOUS}" -ne 1 ]] && echo " -u${RT_USER:?}:${RT_TOKEN:?}") || true) \
-XGET \
${RT_URL}/${SRC_PATH}"

Expand All @@ -95,7 +95,7 @@ rt_delete_artifact() {
ANONYMOUS="${2:-1}"

_CMD="curl -s \
$( ([[ "${ANONYMOUS}" != 1 ]] && echo " -u${RT_USER:?}:${RT_TOKEN:?}") || true) \
$( ([[ "${ANONYMOUS}" -ne 1 ]] && echo " -u${RT_USER:?}:${RT_TOKEN:?}") || true) \
-XDELETE \
${RT_URL}/${DST_PATH}"

Expand All @@ -120,7 +120,7 @@ rt_list_directory() {
ANONYMOUS="${2:-1}"

_CMD="curl -s \
$( ([[ "${ANONYMOUS}" != 1 ]] && echo " -u${RT_USER:?}:${RT_TOKEN:?}") || true) \
$( ([[ "${ANONYMOUS}" -ne 1 ]] && echo " -u${RT_USER:?}:${RT_TOKEN:?}") || true) \
-XGET \
${RT_URL}/api/storage/${DST_PATH}"

Expand Down

0 comments on commit 85d6766

Please sign in to comment.