Skip to content

Commit e953abf

Browse files
kaspar030aabadie
authored andcommitted
implement fast fail
1 parent 8278714 commit e953abf

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

build.sh

+26-1
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,29 @@ set_status() {
128128
/usr/bin/curl -s -d "${status}" -H "Content-Type: application/json" -H "Authorization: ${CI_JOB_TOKEN}" -X PUT ${MURDOCK_API_URL}/job/${CI_JOB_UID}/status > /dev/null
129129
}
130130

131+
check_label() {
132+
local label="${1}"
133+
[ -z "${CI_PULL_LABELS}" ] && return 1
134+
echo "${CI_PULL_LABELS}" | grep -q "${label}"
135+
return $?
136+
}
137+
138+
if [ -z "${CI_FAST_FAIL}" ]; then
139+
if [ "${NIGHTLY}" = "1" ]; then
140+
export CI_FAST_FAIL=0
141+
elif check_label "CI: no fast fail"; then
142+
export CI_FAST_FAIL=0
143+
else
144+
export CI_FAST_FAIL=1
145+
fi
146+
fi
147+
148+
if [ "${CI_FAST_FAIL}" = "1" ]; then
149+
export DWQ_MAXFAIL=0
150+
else
151+
export DWQ_MAXFAIL=500
152+
fi
153+
131154
main() {
132155
set_status "fetching code"
133156

@@ -198,12 +221,14 @@ main() {
198221
exit 2
199222
fi
200223

224+
echo "--- Will abort after more than ${DWQ_MAXFAIL} failed job(s)."
225+
201226
local report_queue="status::${CI_JOB_UID}:$(random)"
202227
${BASEDIR}/reporter.py "${report_queue}" ${CI_JOB_UID} ${CI_JOB_TOKEN} &
203228
local reporter_pid=$!
204229

205230
get_jobs | dwqc ${DWQ_ENV} \
206-
--maxfail 500 \
231+
--maxfail ${DWQ_MAXFAIL} \
207232
--quiet --report ${report_queue} --outfile result.json
208233

209234
local build_test_res=$?

0 commit comments

Comments
 (0)