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

feat: Drop support to execute yashchiki_notify_gerrit in container

* works with less env vars now and doesn't require commons.sh
  anymore

Change-Id: I0dbdcda4ad1f9f379f01ab9e801301ad85162e46
parent c06441e5
No related branches found
No related tags found
No related merge requests found
......@@ -71,7 +71,11 @@ pipeline {
steps {
sh "mkdir -p ${YASHCHIKI_META_DIR}"
sh "bash bin/yashchiki_dump_meta_info.sh"
sh "bash bin/yashchiki_notify_gerrit.sh -m 'Build containing this change started..'"
script {
if (isTriggeredByGerrit()) {
sh "bash bin/yashchiki_notify_gerrit.sh -m 'Build containing this change started..'"
}
}
}
}
stage('Deploy utilities') {
......@@ -109,8 +113,10 @@ pipeline {
script {
// we only want the container name, tail everything else
CONTAINER_IMAGE = sh(script: "bash bin/yashchiki_deploy_container.sh | tail -n 1", returnStdout: true).trim()
if (isTriggeredByGerrit()) {
sh "bash bin/yashchiki_notify_gerrit.sh -t Build -c \"$CONTAINER_IMAGE\""
}
}
sh "bash bin/yashchiki_notify_gerrit.sh -t Build -c \"$CONTAINER_IMAGE\""
}
}
}
......@@ -118,8 +124,10 @@ pipeline {
failure {
script {
cache_failed = sh(script: "bash lib/yashchiki/create_temporary_build_cache_after_failure.sh", returnStdout: true).trim()
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!\""
}
cleanup {
archiveArtifacts "host.env"
......@@ -189,13 +197,25 @@ pipeline {
}
post {
success {
jesh "bash bin/yashchiki_notify_gerrit.sh -v 1 -t Tests -c '${CONTAINER_IMAGE}'"
script {
if (isTriggeredByGerrit()) {
jesh "bash bin/yashchiki_notify_gerrit.sh -v 1 -t Tests -c '${CONTAINER_IMAGE}'"
}
}
}
unstable {
jesh "bash bin/yashchiki_notify_gerrit.sh -v 0 -t Tests -c '${CONTAINER_IMAGE}'"
script {
if (isTriggeredByGerrit()) {
jesh "bash bin/yashchiki_notify_gerrit.sh -v 0 -t Tests -c '${CONTAINER_IMAGE}'"
}
}
}
failure {
jesh "bash bin/yashchiki_notify_gerrit.sh -v -1 -t Tests -c '${CONTAINER_IMAGE}'"
script {
if (isTriggeredByGerrit()) {
jesh "bash bin/yashchiki_notify_gerrit.sh -v -1 -t Tests -c '${CONTAINER_IMAGE}'"
}
}
}
}
}
......
......@@ -77,7 +77,11 @@ pipeline {
steps {
sh "mkdir -p ${YASHCHIKI_META_DIR}"
sh "bash bin/yashchiki_dump_meta_info.sh"
sh "bash bin/yashchiki_notify_gerrit.sh -m 'Build containing this change started..'"
script {
if (isTriggeredByGerrit()) {
sh "bash bin/yashchiki_notify_gerrit.sh -m 'Build containing this change started..'"
}
}
}
}
stage('Build container image') {
......@@ -110,8 +114,10 @@ pipeline {
script {
// we only want the container name, tail everything else
CONTAINER_IMAGE = sh(script: "bin/yashchiki_deploy_container.sh | tail -n 1", returnStdout: true).trim()
if (isTriggeredByGerrit()) {
sh "bash bin/yashchiki_notify_gerrit.sh -t Build -c \"$CONTAINER_IMAGE\""
}
}
sh "bash bin/yashchiki_notify_gerrit.sh -t Build -c \"$CONTAINER_IMAGE\""
}
}
}
......@@ -119,8 +125,10 @@ pipeline {
failure {
script {
cache_failed = sh(script: "lib/yashchiki/create_temporary_build_cache_after_failure.sh", returnStdout: true).trim()
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!\""
}
cleanup {
archiveArtifacts "host.env"
......
......@@ -16,8 +16,7 @@ if ! [ "${CONTAINER_BUILD_TYPE:-}" = "testing" ]; then
fi
ROOT_DIR="$(dirname "$(dirname "$(readlink -m "${BASH_SOURCE[0]}")")")"
source "${ROOT_DIR}/lib/yashchiki/dummy_variables.sh"
source "${ROOT_DIR}/lib/yashchiki/commons.sh"
source "${ROOT_DIR}/lib/yashchiki/gerrit.sh"
container_name=""
result_type=""
......@@ -54,7 +53,7 @@ if [ -z "${result}" ] && [ -n "${verified}" ]; then
fi
fi
message="[$(get_host_env BUILD_URL)] \
message="[$(echo "${BUILD_URL}")] \
${container_name:+Change included in container: ${container_name}} \
${custom_message:-} \
${result:+${result_type:+${result_type} }Result: ${result}}"
......@@ -65,26 +64,19 @@ if [ "${CONTAINER_BUILD_TYPE}" = "testing" ]; then
# Notify all changes involved that they got built into the current container
# yashchiki changes
meta_dir="$(get_var_in_out META_DIR)"
if [ -f "${meta_dir}/current_changes-yashchiki.dat" ]; then
cat "${meta_dir}/current_changes-yashchiki.dat" >> "${tmpfile_commits}"
if [ -f "${YASHCHIKI_META_DIR}/current_changes-yashchiki.dat" ]; then
cat "${YASHCHIKI_META_DIR}/current_changes-yashchiki.dat" >> "${tmpfile_commits}"
fi
# spack changes
if [ -f "${meta_dir}/current_changes-spack.dat" ]; then
cat "${meta_dir}/current_changes-spack.dat" >> "${tmpfile_commits}"
if [ -f "${YASHCHIKI_META_DIR}/current_changes-spack.dat" ]; then
cat "${YASHCHIKI_META_DIR}/current_changes-spack.dat" >> "${tmpfile_commits}"
fi
readarray -t commits < <(grep -v "^$" "${tmpfile_commits}")
# if we are in a singularity container we need to go to the spack
# repository so the gerrit notifier can extract gerrit settings all
if [ -n "${SINGULARITY_CONTAINER:-}" ]; then
pushd "${MY_SPACK_FOLDER}" &>/dev/null || exit 1
fi
# needs to be in git repo for gerrit_notify_change to work
cd ${WORKSPACE}/yashchiki
cd ${YASHCHIKI_INSTALL}
for change in "${commits[@]}"; do
if ! gerrit_notify_change -c "${change}" \
-v "${verified}" \
......@@ -93,9 +85,5 @@ if [ "${CONTAINER_BUILD_TYPE}" = "testing" ]; then
fi
done
if [ -n "${SINGULARITY_CONTAINER:-}" ]; then
popd &>/dev/null || exit 1
fi
rm -v "${tmpfile_commits}" 1>&2
fi
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