Skip to content
Snippets Groups Projects
Commit 6fd41bfe authored by Philipp Spilger's avatar Philipp Spilger
Browse files

fix: creation of temporary build cache in Jenkinsfile from bin/ instead of lib/

* remove dependency on commons.sh

Change-Id: I1d7a14a7a0e717c1827bc283cf07244b056aa25f
parent 6f449332
No related branches found
No related tags found
No related merge requests found
...@@ -123,7 +123,7 @@ pipeline { ...@@ -123,7 +123,7 @@ pipeline {
post { post {
failure { failure {
script { script {
cache_failed = sh(script: "bash lib/yashchiki/create_temporary_build_cache_after_failure.sh", returnStdout: true).trim() cache_failed = sh(script: "bash bin/yashchiki_create_temporary_build_cache_after_failure.sh", returnStdout: true).trim()
if (isTriggeredByGerrit()) { if (isTriggeredByGerrit()) {
sh "bash bin/yashchiki_notify_gerrit.sh -v -1 -t Build -m \"Successfully built packages stored in cache. Resume by issuing:\nWITH_CACHE_NAME=${cache_failed}\n\nIn your next gerrit comment, NOT commit message!\"" sh "bash bin/yashchiki_notify_gerrit.sh -v -1 -t Build -m \"Successfully built packages stored in cache. Resume by issuing:\nWITH_CACHE_NAME=${cache_failed}\n\nIn your next gerrit comment, NOT commit message!\""
} }
......
...@@ -124,7 +124,7 @@ pipeline { ...@@ -124,7 +124,7 @@ pipeline {
post { post {
failure { failure {
script { script {
cache_failed = sh(script: "lib/yashchiki/create_temporary_build_cache_after_failure.sh", returnStdout: true).trim() cache_failed = sh(script: "bin/yashchiki_create_temporary_build_cache_after_failure.sh", returnStdout: true).trim()
if (isTriggeredByGerrit()) { if (isTriggeredByGerrit()) {
sh "bash bin/yashchiki_notify_gerrit.sh -v -1 -t Build -m \"Successfully built packages stored in cache. Resume by issuing:\nWITH_CACHE_NAME=${cache_failed}\n\nIn your next gerrit comment, NOT commit message!\"" sh "bash bin/yashchiki_notify_gerrit.sh -v -1 -t Build -m \"Successfully built packages stored in cache. Resume by issuing:\nWITH_CACHE_NAME=${cache_failed}\n\nIn your next gerrit comment, NOT commit message!\""
} }
......
...@@ -13,13 +13,13 @@ if [ "${CONTAINER_BUILD_TYPE}" = "stable" ]; then ...@@ -13,13 +13,13 @@ if [ "${CONTAINER_BUILD_TYPE}" = "stable" ]; then
exit 1 exit 1
fi fi
SOURCE_DIR="$(dirname "$(readlink -m "${BASH_SOURCE[0]}")")" ROOT_DIR="$(dirname "$(dirname "$(readlink -m "${BASH_SOURCE[0]}")")")"
source "${SOURCE_DIR}/commons.sh" source "${ROOT_DIR}/lib/yashchiki/get_change_name.sh"
build_num=1 build_num=1
change_num="$(get_change_name)" change_num="$(get_change_name)"
while [ -d "${PRESERVED_PACKAGES_OUTSIDE}/${change_num}_${build_num}" ]; do while [ -d "${YASHCHIKI_CACHES_ROOT}/preserved_packages/${change_num}_${build_num}" ]; do
(( build_num++ )) (( build_num++ ))
done done
# `build_num` is used to indicate if no preserved packages were found: After # `build_num` is used to indicate if no preserved packages were found: After
...@@ -29,8 +29,8 @@ done ...@@ -29,8 +29,8 @@ done
# store in the failed cache. # store in the failed cache.
(( build_num-- )) (( build_num-- ))
preserved_packages="${PRESERVED_PACKAGES_OUTSIDE}/${change_num}_${build_num}" preserved_packages="${YASHCHIKI_CACHES_ROOT}/preserved_packages/${change_num}_${build_num}"
failed_build_cache="${BASE_BUILD_CACHE_FAILED_OUTSIDE}/${change_num}_${build_num}" failed_build_cache="${YASHCHIKI_CACHES_ROOT}/build_caches/failed/${change_num}_${build_num}"
# expects input to be \0-printed # expects input to be \0-printed
link_into_failed_buildcache() { link_into_failed_buildcache() {
...@@ -41,7 +41,7 @@ link_into_failed_buildcache() { ...@@ -41,7 +41,7 @@ link_into_failed_buildcache() {
# ensure that we have preserved packages and that these packages have not # ensure that we have preserved packages and that these packages have not
# already been pushed to a failed build cache # already been pushed to a failed build cache
if (( build_num > 0 )) && \ if (( build_num > 0 )) && \
[ ! -d "${BASE_BUILD_CACHE_FAILED_OUTSIDE}/${change_num}_${build_num}" ]; then [ ! -d "${YASHCHIKI_CACHES_ROOT}/build_caches/failed/${change_num}_${build_num}" ]; then
mkdir -vp "${failed_build_cache}" >&2 mkdir -vp "${failed_build_cache}" >&2
...@@ -50,10 +50,10 @@ if (( build_num > 0 )) && \ ...@@ -50,10 +50,10 @@ if (( build_num > 0 )) && \
find "${preserved_packages}" -name "*.tar.gz" -print0 | link_into_failed_buildcache find "${preserved_packages}" -name "*.tar.gz" -print0 | link_into_failed_buildcache
# link everything not present in preserved packages that is in build cache # link everything not present in preserved packages that is in build cache
find "${BUILD_CACHE_OUTSIDE}" -name "*.tar.gz" -print0 | link_into_failed_buildcache find "${YASHCHIKI_CACHES_ROOT}/build_caches/${BUILD_CACHE_NAME}" -name "*.tar.gz" -print0 | link_into_failed_buildcache
# echo created failed buildcache # echo created failed buildcache
echo "${failed_build_cache#${BASE_BUILD_CACHE_OUTSIDE}/}" echo "${failed_build_cache#${YASHCHIKI_CACHES_ROOT}/build_caches/}"
else else
echo "<no preserved packages found>" echo "<no preserved packages found>"
fi fi
#!/bin/bash
set -euo pipefail
shopt -s inherit_errexit 2>/dev/null || true
get_change_name() {
local change_num
local patch_level
local gerrit_change_number
local gerrit_patchset_number
local gerrit_refspec
gerrit_change_number="${GERRIT_CHANGE_NUMBER}"
gerrit_patchset_number="${GERRIT_PATCHSET_NUMBER}"
gerrit_refspec="${GERRIT_REFSPEC}"
if [ -z "${gerrit_change_number:-}" ]; then
if [ -n "${gerrit_refspec:-}" ]; then
# extract gerrit change number from refspec
change_num="$(echo "${gerrit_refspec}" | cut -f 4 -d / )"
patch_level="$(echo "${gerrit_refspec}" | cut -f 5 -d / )"
fi
else
change_num="${gerrit_change_number}"
patch_level="${gerrit_patchset_number}"
fi
echo -n "c${change_num}p${patch_level}"
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment