Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix rebuild check in bot/build.sh script, and always resume from the correct temporary directory #518

Merged
merged 8 commits into from
Mar 27, 2024
15 changes: 11 additions & 4 deletions bot/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,8 @@ fi
# determine if the removal step has to be run
# assume there's only one diff file that corresponds to the PR patch file
pr_diff=$(ls [0-9]*.diff | head -1)
changed_easystacks_rebuilds=$(cat ${pr_diff} | grep '^+++' | cut -f2 -d' ' | sed 's@^[a-z]/@@g' | grep '^easystacks/.*yml$' | grep "/rebuilds/")
if [[ -z ${changed_easystacks_rebuilds} ]]; then
changed_easystacks_rebuilds=$(cat ${pr_diff} | grep '^+++' | cut -f2 -d' ' | sed 's@^[a-z]/@@g' | grep '^easystacks/.*yml$' | grep "/rebuilds/" || true)
bedroge marked this conversation as resolved.
Show resolved Hide resolved
if [[ -z "${changed_easystacks_rebuilds}" ]]; then
echo "This PR does not add any easystack files in a rebuilds subdirectory, so let's skip the removal step."
else
# prepare directory to store tarball of tmp for removal and build steps
Expand All @@ -192,7 +192,7 @@ else

# prepare arguments to eessi_container.sh specific to remove step
declare -a REMOVAL_STEP_ARGS=()
REMOVAL_STEP_ARGS+=("--save" "${TARBALL_TMP_BUILD_STEP_DIR}")
REMOVAL_STEP_ARGS+=("--save" "${TARBALL_TMP_REMOVAL_STEP_DIR}")
REMOVAL_STEP_ARGS+=("--storage" "${STORAGE}")
# add fakeroot option in order to be able to remove software, see:
# https://github.com/EESSI/software-layer/issues/312
Expand Down Expand Up @@ -247,7 +247,14 @@ declare -a TARBALL_STEP_ARGS=()
TARBALL_STEP_ARGS+=("--save" "${TARBALL_TMP_TARBALL_STEP_DIR}")

# determine temporary directory to resume from
TARBALL_STEP_ARGS+=("--resume" "${REMOVAL_TMPDIR}")
if [[ -z ${REMOVAL_TMPDIR} ]]; then
# no rebuild step was done, so the tarball step should resume from the build directory
BUILD_TMPDIR=$(grep ' as tmp directory ' ${build_outerr} | cut -d ' ' -f 2)
TARBALL_STEP_ARGS+=("--resume" "${BUILD_TMPDIR}")
boegel marked this conversation as resolved.
Show resolved Hide resolved
else
# a removal step was done, so resume from its temporary directory (which was also used for the build step)
TARBALL_STEP_ARGS+=("--resume" "${REMOVAL_TMPDIR}")
fi

timestamp=$(date +%s)
# to set EESSI_VERSION we need to source init/eessi_defaults now
Expand Down