mirror of
https://gitlab.computer.surgery/matrix/grapevine.git
synced 2025-12-16 07:11:24 +01:00
cache and skip commits that have passed already
Commits marked as passed can be re-run by changing their hash or clearing the cache.
This commit is contained in:
parent
2265b6615e
commit
976aef690f
1 changed files with 21 additions and 0 deletions
21
bin/job
21
bin/job
|
|
@ -30,6 +30,19 @@ bail() (
|
|||
exit 1
|
||||
)
|
||||
|
||||
mark_commit_passed() (
|
||||
set -euo pipefail
|
||||
|
||||
mkdir -p ".gitlab-ci.d/passed/$1"
|
||||
touch ".gitlab-ci.d/passed/$1/$(git rev-parse HEAD)"
|
||||
)
|
||||
|
||||
commit_passed() (
|
||||
set -euo pipefail
|
||||
|
||||
[[ -f ".gitlab-ci.d/passed/$1/$(git rev-parse HEAD)" ]]
|
||||
)
|
||||
|
||||
run() (
|
||||
set -euo pipefail
|
||||
|
||||
|
|
@ -59,7 +72,15 @@ run() (
|
|||
<(git rev-list --reverse "$CI_MERGE_REQUEST_DIFF_BASE_SHA..HEAD")
|
||||
for commit in "${commits[@]}"; do
|
||||
git checkout "$commit"
|
||||
|
||||
if commit_passed "$job"; then
|
||||
echo "Skipping commit because it already passed: $commit"
|
||||
continue
|
||||
fi
|
||||
|
||||
job_"$job" || bail
|
||||
|
||||
mark_commit_passed "$job"
|
||||
done
|
||||
fi
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue