Changeset View
Changeset View
Standalone View
Standalone View
contrib/source-control-tools/automated-commits.sh
Show First 20 Lines • Show All 48 Lines • ▼ Show 20 Lines | |||||
done | done | ||||
: "${COMMIT_TYPE:=}" | : "${COMMIT_TYPE:=}" | ||||
if [ -z "${COMMIT_TYPE}" ]; then | if [ -z "${COMMIT_TYPE}" ]; then | ||||
echo "Error: Environment variable COMMIT_TYPE must be set" | echo "Error: Environment variable COMMIT_TYPE must be set" | ||||
exit 2 | exit 2 | ||||
fi | fi | ||||
GIT_PUSH_OPTIONS=("--verbose") | LAND_PATCH_ARGS=() | ||||
case ${DRY_RUN:=yes} in | case ${DRY_RUN:=yes} in | ||||
no|NO|false|FALSE) | no|NO|false|FALSE) | ||||
if [ "${PARENT_COMMIT}" != "${DEFAULT_PARENT_COMMIT}" ]; then | if [ "${PARENT_COMMIT}" != "${DEFAULT_PARENT_COMMIT}" ]; then | ||||
echo "Error: Running with DRY_RUN=no on a commit parent other than '${DEFAULT_PARENT_COMMIT}'" | echo "Error: Running with DRY_RUN=no on a commit parent other than '${DEFAULT_PARENT_COMMIT}'" | ||||
exit 3 | exit 3 | ||||
fi | fi | ||||
;; | ;; | ||||
*) | *) | ||||
GIT_PUSH_OPTIONS+=("--dry-run") | LAND_PATCH_ARGS+=("--dry-run") | ||||
;; | ;; | ||||
esac | esac | ||||
echo "Building automated commit '${COMMIT_TYPE}'..." | echo "Building automated commit '${COMMIT_TYPE}'..." | ||||
BOT_PREFIX="[Automated]" | BOT_PREFIX="[Automated]" | ||||
TOPLEVEL=$(git rev-parse --show-toplevel) | TOPLEVEL=$(git rev-parse --show-toplevel) | ||||
BUILD_DIR="${TOPLEVEL}/abc-ci-builds/automated-commit-${COMMIT_TYPE}" | BUILD_DIR="${TOPLEVEL}/abc-ci-builds/automated-commit-${COMMIT_TYPE}" | ||||
deadalnix: That's a good way to defeat ccache. | |||||
jasonbcoxAuthorUnsubmitted Done Inline ActionsWe do something similar for all of the CI builds as well. My understanding is the caching performs better if you know the cmake configuration is unlikely to change, and you can make this assumption by the build name. @Fabien can elaborate more on the details. It's possible there's a smarter way to do this by running like-configuration builds in the same directory or something. jasonbcox: We do something similar for all of the CI builds as well. My understanding is the caching… | |||||
mkdir -p "${BUILD_DIR}" | mkdir -p "${BUILD_DIR}" | ||||
export BUILD_DIR | export BUILD_DIR | ||||
DEVTOOLS_DIR="${TOPLEVEL}"/contrib/devtools | DEVTOOLS_DIR="${TOPLEVEL}"/contrib/devtools | ||||
# Make sure tree is clean | # Make sure tree is clean | ||||
git checkout master | git checkout master | ||||
git reset --hard "${PARENT_COMMIT}" | git reset --hard "${PARENT_COMMIT}" | ||||
▲ Show 20 Lines • Show All 148 Lines • ▼ Show 20 Lines | update-timings) | ||||
;; | ;; | ||||
*) | *) | ||||
echo "Error: Invalid commit name '${COMMIT_TYPE}'" | echo "Error: Invalid commit name '${COMMIT_TYPE}'" | ||||
exit 10 | exit 10 | ||||
;; | ;; | ||||
esac | esac | ||||
# Smoke tests to give some confidence that master won't be put into a bad state | # Land the generated commit | ||||
"${DEVTOOLS_DIR}"/smoke-tests.sh | "${TOPLEVEL}"/contrib/source-control-tools/land-patch.sh "${LAND_PATCH_ARGS[@]}" | ||||
echo "Pushing automated commit '${COMMIT_TYPE}'..." | |||||
# Make sure master is up-to-date. If there is a merge conflict, this script | |||||
# will not attempt to resolve it and simply fail. | |||||
git fetch origin master | |||||
git rebase "${PARENT_COMMIT}" | |||||
git push "${GIT_PUSH_OPTIONS[@]}" origin master |
That's a good way to defeat ccache.