ci: add job to update CMake Nightly Date Stamp
Previously the nightly version update was performed by an externally-managed scheduled task. Move it to CI.
This commit is contained in:
parent
abb3d39bbc
commit
0f82d07266
@ -72,6 +72,12 @@ u:source-package:
|
||||
needs:
|
||||
- p:source-package
|
||||
|
||||
b:version-update:
|
||||
extends:
|
||||
- .cmake_version_update_linux
|
||||
- .linux_x86_64_tags
|
||||
- .run_version_update
|
||||
|
||||
# Documentation builds
|
||||
|
||||
b:cmake.org-help:
|
||||
|
46
.gitlab/ci/cmake_version_update.sh
Executable file
46
.gitlab/ci/cmake_version_update.sh
Executable file
@ -0,0 +1,46 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
if test "$CI_COMMIT_REF_NAME" != "master"; then
|
||||
echo "The version update may run only on the 'master' branch."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# A project-specific access token must be provided by
|
||||
# the pipeline schedule under which this job runs.
|
||||
if test -z "$CMAKE_CI_GIT_ACCESS_TOKEN"; then
|
||||
echo "No CMAKE_CI_GIT_ACCESS_TOKEN is available."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
git config user.name "${CMAKE_CI_AUTHOR_NAME-Kitware Robot}"
|
||||
git config user.email "${CMAKE_CI_AUTHOR_EMAIL-kwrobot@kitware.com}"
|
||||
git remote add upstream "https://oauth2:$CMAKE_CI_GIT_ACCESS_TOKEN@gitlab.kitware.com/$CI_PROJECT_PATH.git"
|
||||
|
||||
# Repeat a few times in case we lose a race.
|
||||
n=6
|
||||
for try in $(seq $n); do
|
||||
git fetch upstream "$CI_COMMIT_REF_NAME"
|
||||
git reset -q --hard FETCH_HEAD
|
||||
Source/CMakeVersion.bash
|
||||
git update-index -q --ignore-missing --refresh
|
||||
modified=$(git diff-index --name-only HEAD -- "Source/CMakeVersion.cmake")
|
||||
if test -n "$modified"; then
|
||||
echo "version changed"
|
||||
git add -u
|
||||
git commit -m "CMake Nightly Date Stamp"
|
||||
if git push --push-option=ci.skip upstream "HEAD:$CI_COMMIT_REF_NAME"; then
|
||||
exit 0
|
||||
else
|
||||
echo "Try #$try failed to fast-forward."
|
||||
fi
|
||||
else
|
||||
echo "version unchanged"
|
||||
exit 0
|
||||
fi
|
||||
sleep 30
|
||||
done
|
||||
|
||||
# Give up after failing too many times.
|
||||
exit 1
|
@ -549,6 +549,13 @@
|
||||
|
||||
interruptible: true
|
||||
|
||||
.cmake_version_update_linux:
|
||||
stage: build
|
||||
extends: .fedora41
|
||||
script:
|
||||
- .gitlab/ci/cmake_version_update.sh
|
||||
interruptible: false # The job internally fetches and retries.
|
||||
|
||||
.cmake_codespell_linux:
|
||||
stage: build
|
||||
extends: .fedora41
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
.run_manually:
|
||||
rules:
|
||||
- if: '$CMAKE_CI_PACKAGE != null'
|
||||
- if: '$CMAKE_CI_PACKAGE != null || $CMAKE_CI_VERSION_UPDATE != null'
|
||||
when: never
|
||||
- if: '($CMAKE_CI_NIGHTLY == "true" && $CMAKE_CI_JOB_NIGHTLY == "false")'
|
||||
when: never
|
||||
@ -25,7 +25,7 @@
|
||||
|
||||
.run_automatically:
|
||||
rules:
|
||||
- if: '$CMAKE_CI_PACKAGE != null'
|
||||
- if: '$CMAKE_CI_PACKAGE != null || $CMAKE_CI_VERSION_UPDATE != null'
|
||||
when: never
|
||||
- if: '($CMAKE_CI_NIGHTLY == "true" && $CMAKE_CI_JOB_NIGHTLY == "false")'
|
||||
when: never
|
||||
@ -48,7 +48,7 @@
|
||||
|
||||
.run_dependent:
|
||||
rules:
|
||||
- if: '$CMAKE_CI_PACKAGE != null'
|
||||
- if: '$CMAKE_CI_PACKAGE != null || $CMAKE_CI_VERSION_UPDATE != null'
|
||||
when: never
|
||||
- if: '($CMAKE_CI_NIGHTLY == "true" && $CMAKE_CI_JOB_NIGHTLY == "false")'
|
||||
when: never
|
||||
@ -86,6 +86,8 @@
|
||||
|
||||
.run_cmake_org_help:
|
||||
rules:
|
||||
- if: '$CMAKE_CI_VERSION_UPDATE != null'
|
||||
when: never
|
||||
- if: '$CMAKE_CI_PACKAGE =~ /v[0-9]+\.[0-9]+/'
|
||||
variables:
|
||||
RSYNC_DESTINATION: "kitware@cmake.org:$CMAKE_CI_PACKAGE/"
|
||||
@ -105,3 +107,9 @@
|
||||
CMAKE_CI_VERSION_NO_GIT: "OFF"
|
||||
when: on_success
|
||||
- when: never
|
||||
|
||||
.run_version_update:
|
||||
rules:
|
||||
- if: '$CMAKE_CI_VERSION_UPDATE != null'
|
||||
when: on_success
|
||||
- when: never
|
||||
|
Loading…
Reference in New Issue
Block a user