mirror of
https://gitlab.computer.surgery/matrix/grapevine.git
synced 2025-12-16 23:31:24 +01:00
run some jobs on the final commit only
These are too expensive to be worth running against all commits.
This commit is contained in:
parent
f4dfb496e1
commit
9e3738d330
1 changed files with 24 additions and 1 deletions
25
bin/job
25
bin/job
|
|
@ -49,6 +49,26 @@ commit_passed() (
|
||||||
[[ -f ".gitlab-ci.d/passed/$1/$(git rev-parse HEAD)" ]]
|
[[ -f ".gitlab-ci.d/passed/$1/$(git rev-parse HEAD)" ]]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
contains() (
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
local -n xs=$1
|
||||||
|
|
||||||
|
for x in "${xs[@]}"; do
|
||||||
|
if [[ "$x" == "$2" ]]; then
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
)
|
||||||
|
|
||||||
|
# Jobs that should only run on the latest commit rather than since the branch's
|
||||||
|
# base.
|
||||||
|
last_commit_only=(
|
||||||
|
artifacts
|
||||||
|
)
|
||||||
|
|
||||||
run() (
|
run() (
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
|
|
@ -67,7 +87,10 @@ run() (
|
||||||
|
|
||||||
cd "$(git rev-parse --show-toplevel)"
|
cd "$(git rev-parse --show-toplevel)"
|
||||||
|
|
||||||
if [[ -z "${CI_MERGE_REQUEST_DIFF_BASE_SHA+x}" ]]; then
|
if \
|
||||||
|
[[ -z "${CI_MERGE_REQUEST_DIFF_BASE_SHA+x}" ]] \
|
||||||
|
|| contains last_commit_only "$job"
|
||||||
|
then
|
||||||
echo "Running against latest commit only..."
|
echo "Running against latest commit only..."
|
||||||
|
|
||||||
job_"$job" || bail
|
job_"$job" || bail
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue