Skip to content

Commit

Permalink
update CI target processing in install-crucible to properly configure…
Browse files Browse the repository at this point in the history
… the JSON config file
  • Loading branch information
k-rister committed Sep 24, 2024
1 parent 7c1b60f commit 8a8a8c2
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .github/actions/install-crucible/install-crucible.sh
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,25 @@ if [ "${CI_TARGET}" != "none" -a "${CI_TARGET_DIR}" != "none" ]; then
rm -v $(basename ${STALE_LINK})
echo "Creating new symbolic link:"
ln -sv ${CI_TARGET_DIR} $(basename ${STALE_LINK})

if pushd ${STALE_LINK} > /dev/null; then
REPO_FILE="/opt/crucible/config/repos.json"
echo "Setting primary-branch and checkout.target for ${CI_TARGET} to 'HEAD' in ${REPO_FILE}"
source /opt/crucible/bin/jqlib
function exit_error() {
echo "ERROR: ${1}"
exit 1
}
jq_update ${REPO_FILE} ${CI_TARGET}:primary-branch --arg repository "$CI_TARGET}" --arg primary_branch "HEAD" '(.official[] | select(.name == $repository) | ."primary-branch") |= $primary_branch'
jq_update ${REPO_FILE} ${CI_TARGET}:checkout.target --arg repository "$CI_TARGET}" --arg checkout_target "HEAD" '(.official[] | select(.name == $repository) | .checkout.target) |= $checkout_target'

popd > /dev/null
else
echo "ERROR: Could not pushd to ${STALE_LINK}"
exit 1
fi

popd > /dev/null
else
echo "ERROR: Could not pushd to $(dirname ${STALE_LINK})"
exit 1
Expand Down

0 comments on commit 8a8a8c2

Please sign in to comment.