<p>Job is managed by <a href="https://www.mediawiki.org/wiki/CI/JJB">Jenkins Job Builder</a>.</p>
<!-- Managed by Jenkins Job Builder -->
false
false
false
true
ci-jessie-wikimedia
false
15
-1
-1
-1
ZUUL_UUID
Zuul provided key to link builds with Gerrit events
UUID
Zuul provided key to link builds with Gerrit events (deprecated use ZUUL_UUID instead)
ZUUL_PIPELINE
Zuul pipeline triggering this job
ZUUL_URL
URL of Zuul's git repos accessible to workers
ZUUL_PROJECT
Branch name of triggering project
ZUUL_BRANCH
Branch name of triggering change
ZUUL_CHANGES
List of dependent changes to merge
ZUUL_REF
Reference for the merged commit(s) to use
ZUUL_COMMIT
The commit SHA1 at the head of ZUUL_REF
ZUUL_CHANGE_IDS
List of included changes
ZUUL_CHANGE
ID of triggering change
ZUUL_PATCHSET
Patchset of triggering change
ZUUL_VOTING
Zuul considered this job voting or not
set -eu +x
# castor-env
# Forge castor environement
# Replace slashes with dashes:
NS_PROJECT=${ZUUL_PROJECT////-}
NS_BRANCH=${ZUUL_BRANCH////-}
# Pill up MediaWiki extensions and skins caches together
if [[ "$ZUUL_PROJECT" =~ ^mediawiki/(extensions|skins)/ ]]; then
NS_PROJECT="castor-mw-ext-and-skins"
fi
# Ex: mediawiki-core/REL1_26/tox-jessie
# Prefer TRIGGERED_JOB_NAME when it is set
NS_JOB=${TRIGGERED_JOB_NAME:-$JOB_NAME}
# Ex: mediawiki-core/REL1_26/tox-jessie
CASTOR_NAMESPACE="${NS_PROJECT}/${NS_BRANCH}/${NS_JOB}"
export CASTOR_NAMESPACE
echo "Defined: CASTOR_NAMESPACE=\"$CASTOR_NAMESPACE\""
# castor-load
# Load cache from central repository
set -u
[[ $JOB_NAME == *'docker'* ]] && is_docker=1 || is_docker=''
if [ $is_docker ]; then
# For containers we mount $WORKSPACE/cache from the host to /cache in the
# container. It is also the value of XDG_CACHE_HOME
DEST="/cache"
# cache might persist between builds on the Docker slaves
rsync_delete='--delete-delay'
else
DEST="$HOME"
# On Nodepool it is guaranteed to be empty. Deleting would wipe
# /home/jenkins/workspace!
fi
echo "Syncing..."
rsync \
--archive \
${rsync_delete:-} \
--compress \
--contimeout 3 \
rsync://castor02.integration.eqiad.wmflabs:/caches/"$CASTOR_NAMESPACE"/ "$DEST" \
|| :
echo -e "\nDone"
echo $ZUUL_PROJECT > deps.txt
echo -e $EXT_DEPENDENCIES >> deps.txt
echo -e $SKIN_DEPENDENCIES > deps_skins.txt
zuul-cloner --version
zuul-cloner \
--color \
--verbose \
--map /srv/deployment/integration/slave-scripts/etc/zuul-clonemap.yaml \
--workspace src \
--cache-dir /srv/git \
https://gerrit.wikimedia.org/r/p \
mediawiki/core $(cat deps.txt) $(cat deps_skins.txt)
find src/extensions src/skins -maxdepth 2 \
-name .gitmodules \
-execdir bash -xe -c '
git submodule foreach git clean -xdff -q
git submodule update --init --recursive
git submodule status
' \;
mv deps.txt src/extensions_load.txt
set -u
cd "src"
[[ -f "composer.json" ]] || exit 0
composer --ansi validate --no-check-publish
set -u
cd src
/srv/deployment/integration/slave-scripts/bin/mw-create-composer-local.py "extensions_load.txt" composer.local.json
set -ux
cd "src"
[[ -f "composer.json" ]] || exit 0
export HTTP_PROXY_REQUEST_FULLURI=false
export HTTPS_PROXY_REQUEST_FULLURI=false
composer update --ansi --no-progress --prefer-dist --profile -v
/srv/deployment/integration/slave-scripts/bin/mw-install-mysql.sh
/srv/deployment/integration/slave-scripts/bin/mw-apply-settings.sh
/srv/deployment/integration/slave-scripts/bin/mw-run-update-script.sh
# Load context (e.g. MW_INSTALL_PATH, MW_SERVER, MW_SCRIPT_PATH)
. /srv/deployment/integration/slave-scripts/bin/mw-set-env-localhost.sh
# Configure MediaWiki
echo -e \
"<?php\n\$wgServer = '${MW_SERVER}';\n"\
"\$wgScriptPath = '${MW_SCRIPT_PATH}';\n"\
"\$wgScript = \$wgStylePath = \$wgLogo = false;\n"\
"\$wgResourceBasePath = null;\n"\
"\$wgEnableJavaScriptTest = true;\n?>\n" >> "$MW_INSTALL_PATH/LocalSettings.php"
# The location is free or we make it free
PUBLIC_DIR="/srv/localhost-worker/$BUILD_TAG"
test ! -e "$PUBLIC_DIR" || rm "$PUBLIC_DIR";
# Publish our install in the QUnit server document root
ln -s "$MW_INSTALL_PATH" "$PUBLIC_DIR"
# Fetch headers and content preview for debugging (HTTP 500 Error, Database error, ResourceLoader etc.)
# NB: Avoid "curl: Failed writing body" error when using 'head'. Either by using 'tac|tac', or by ignoring stderr,
# or by writing to a file first and running 'head' on that.
curl --include "${MW_SERVER}${MW_SCRIPT_PATH}/index.php/Special:BlankPage" > log/curl-SpecialBlankPage.log; head -n42 log/curl-SpecialBlankPage.log
curl --include "${MW_SERVER}${MW_SCRIPT_PATH}/load.php?debug=true&modules=startup&only=scripts" > log/curl-load-startup.log; head -n42 log/curl-load-startup.log
curl --include "${MW_SERVER}${MW_SCRIPT_PATH}/index.php?title=Special:JavaScriptTest/qunit/export" > log/curl-SpecialJavaScriptTest.log; head -n11 log/curl-SpecialJavaScriptTest.log
. /srv/deployment/integration/slave-scripts/bin/mw-set-env-localhost.sh
cd $MW_INSTALL_PATH
. /srv/deployment/integration/slave-scripts/bin/npm-setup.sh
rm -rf node_modules
npm install
# Change to the working directory. EXT_NAME is set by Zuul parameters
# functions
if [ -f ./src/extensions/$EXT_NAME/tests/selenium/LocalSettings.php ]; then
cd ./src/extensions/$EXT_NAME/tests/selenium
. '/srv/deployment/integration/slave-scripts/bin/mw-selenium-setup.sh'
fi
. /srv/deployment/integration/slave-scripts/bin/mw-set-env-localhost.sh
cd $MW_INSTALL_PATH
if [ -f ./tests/selenium/wdio.conf.js ]; then
chromedriver --url-base=/wd/hub --port=4444 &
# Make sure it is killed to prevent file descriptors leak
function kill_chromedriver() {
killall chromedriver > /dev/null
}
trap kill_chromedriver EXIT
./node_modules/.bin/grunt webdriver:test
fi
set -eu
# The set of log files checked come from integration/jenkins
# mediawiki/conf.d/00_set_debug_log.php
#
# Namely:
# $wgDBerrorLog = "$wmgMwLogDir/mw-dberror.log";
# $wgDebugLogGroups['exception'] = "$wmgMwLogDir/mw-exception.log";
# $wgDebugLogGroups['error'] = "$wmgMwLogDir/mw-error.log";
#
ERROR_FILES=( mw-dberror.log mw-exception.log mw-error.log )
echo "Asserting empty files: ${ERROR_FILES[*]}"
# The minimum RELx_xxx version for which we want to run this test
REL_MAJOR=1
REL_MINOR=30
# The minimum wmf/1.x.0-wmf.xx version for which we want to run this test
WMF_MAJOR=30
WMF_MINOR=12
# A valid version is a version > wmf/1.WMF_MAJOR.0-wmf.WMF_MINOR
valid_wmf_version() {
local version major minor
version="$1"
major=${version%.*.*}
major=${major##*.}
minor=${version##*.}
if (( major == WMF_MAJOR )) && (( minor >= WMF_MINOR )); then
return 0
elif (( major > WMF_MAJOR )); then
return 0
else
return 1
fi
}
# A valid version is a version > REL{REL_MAJOR}_{REL_MINOR}
valid_rel_version() {
local version major minor
version="$1"
major=${version%%_*}
minor=${version##*_}
if (( major == REL_MAJOR )) && (( minor >= REL_MINOR )); then
return 0
elif (( major > REL_MAJOR )); then
return 0
else
return 1
fi
}
# Ensures that this is a ZUUL_BRANCH for which we want this to be a valid test
valid_version() {
local version wmf_version rel_version
version="$1"
# Master is valid
if [[ "$version" == "master" ]]; then
return 0
fi
# Is this is a wmf/something
wmf_version="${version#wmf\/}"
if (( ${#version} != ${#wmf_version} )); then
valid_wmf_version "$wmf_version" && return 0
fi
# Is this is a RELsomething
rel_version="${version#REL}"
if (( ${#version} != ${#rel_version} )); then
valid_rel_version "$rel_version" && return 0
fi
# Unidentified version: invalid
return 1
}
if ! valid_version "$ZUUL_BRANCH"; then
printf 'Test not for branch: %s\n' "$ZUUL_BRANCH"
exit 0
fi
log_files="$( cd "$WORKSPACE/log"; ls "${ERROR_FILES[@]}" 2> /dev/null || :)"
if [ ! "$log_files" ]; then
echo "No error files. GOOD"
exit 0
fi
echo "Dumping file(s) $log_files"
set +e
# Use `grep --color . file list` to ensure that file names appear next
# to log messages
(cd "$WORKSPACE/log"; grep --color . "${ERROR_FILES[@]}" 2> /dev/null)
set -e
echo -e "MediaWiki emitted some errors. Check output above."
exit 1
TRIGGERED_JOB_NAME=$JOB_NAME
TRIGGERED_SSH_CONNECTION=$SSH_CONNECTION
castor-save
ALWAYS
false
false
true
false
false
log/*
false
true
30
true
false
0
3
absolute