Page MenuHomePhabricator

start-rt-test.sh doesn't report exit codes
Closed, ResolvedPublic

Description

start-rt-test.sh failed to checkout the right commit with,

fatal: detected dubious ownership in repository at '/srv/parsoid-testing'
To add an exception for this directory, call:
	git config --global --add safe.directory /srv/parsoid-testing

Resulting in,
https://www.mediawiki.org/w/index.php?title=Parsoid%2FRound-trip_testing&diff=5784446&oldid=5049938

but it didn't really prevent rt testing from starting with the wrong commit (though reporting it was testing the right hash in the web ui). Since we rely pretty heavily on the result of rt testing being clean, this failure mode seems problematic and too heavily reliant on developer noticing that something went wrong.

The script should at least check the exit codes for the git checkout and either report in red or fail hard.

Event Timeline

The git issue comes from a recent security update with details at T325128#8465719. Setting git config safe.directory is indeed the workaround ;)

To have start-rt-test.sh to abort immediately when any command fails, use set -e (and while at it error out when a variable is not set with -u and abort when a command in a chain of pipe fails with -o pipefail). I typically stick at the top of the shell script:

#!/bin/bash

set -eu -o pipefail

Change 890786 had a related patch set uploaded (by Isabelle Hurbain-Palatin; author: Isabelle Hurbain-Palatin):

[mediawiki/services/parsoid@master] Make start-rt-test.sh fail early

https://gerrit.wikimedia.org/r/890786

Arlolra triaged this task as Medium priority.

Change 890786 merged by jenkins-bot:

[mediawiki/services/parsoid@master] Make start-rt-test.sh fail early

https://gerrit.wikimedia.org/r/890786

Change 892515 had a related patch set uploaded (by Isabelle Hurbain-Palatin; author: Isabelle Hurbain-Palatin):

[mediawiki/vendor@master] Bump parsoid to 0.17.0-a18

https://gerrit.wikimedia.org/r/892515

Change 892515 merged by jenkins-bot:

[mediawiki/vendor@master] Bump parsoid to 0.17.0-a18

https://gerrit.wikimedia.org/r/892515