You are browsing a read-only backup copy of Wikitech. The primary site can be found at

Nova Resource:Integration/Setup

From Wikitech-static
< Nova Resource:Integration
Revision as of 18:37, 23 September 2019 by imported>Hashar
Jump to navigation Jump to search



Updated September 2019 based on


  • Create a new instance named integration-agent-{type}-XXXX where {type} is a role (example: docker) and XXXX increments starting from 1001.
  • Source: pick the Stretch image
  • Flavor: pick mediumram flavor

Wait a few minutes (during which the instance is created, initial setup happens). Then connect to the instance over SSH and fix puppet:

  • rm -fR /var/lib/puppet/ssl && puppet agent -tv
  • If that complains:
    • get the instance fully qualified domain name (FQDN): hostname --fqdn
    • On integration-puppetmaster01.integration.eqiad.wmflabs, clean the old and invalid certificate(s): sudo puppet cert clean <FQDN OF INSTANCE HERE

Apply the Puppet role:

Run puppet on the instance (puppet agent -tv) and verify:

  • If a Docker agent, make sure there is a /var/lib/docker partition for Docker
  • Clean unused packages: apt-get autoremove --purge
  • Upgrade packages: apt-get -y dist-upgrade

Reboot the instance (Before adding to Jenkins). This cleans state, launches deamons, and fixes Shinken monitoring (phabricator:T91351). Once it is back, you can then add it to Jenkins

Add the instance to Jenkins

  1. Create "New Node" in Jenkins management
    • Name: (short hostname of instance)
    • Type: Permanent Agent
    • Executors: 1 (for Docker agents: 4)
    • Filesystem root: /srv/jenkins/workspace
    • Labels:
      • contintLabsSlave
      • For Docker agents: Docker
    • Usage: EXCLUSIVE (Only build jobs with label restrictions matching this node)
    • Launch method: SSH
      • Host: (internal IP of instance)
      • Credentials: jenkins-deploy (key from role::ci::slave::labs::common)
    • Availability: Always (Keep this slave on-line as much as possible)

The Jenkins master will automatically trust the ssh key upon the first connection.


  1. Create instance:
    • m1.medium
    • Security group: Default
  2. Wait 10 minutes
  3. Reconfigure instance from wikitech: Enable role::ci::slave::labs.
  4. Via SSH, force a puppet run (applies role).


npm upgrade

Always use the original npm that came with Ubuntu to perform the upgrade. This installs the new version in /usr/local/bin, preserving the original.

  • For each instance, gracefully depool it (!log it), wait for any running builds on it to complete, and run the following:
    • If Ubuntu Trusty:
# Note: Must sudo without preserving user environment, using -i
$ sudo -i
root$ /usr/share/npm/bin/npm-cli.js install -g npm@2.7.6
# Purge both caches 
root$ rm -rf /mnt/home/jenkins-deploy/.npm /root/.npm
  • Re-pool instance.


Use sudo /usr/local/sbin/puppet-run &. Don't use sudo puppet agent -t, because that is not what cron uses and leads to inconsistencies with e.g. umask and other factors affecting default values used at runtime.


# at integration-slave1010 over ssh
$ import -display :94 -window root "image $(date).png"

# local shell
$ scp integration-slave1010.eqiad.wmflabs:image*.png . && open

Debug MediaWiki frontend

Take slave of choosing offline in Jenkins web interface (e.g. press "Mark offline" after selecting a node)

sudo -iu jenkins-deploy
$ cd /mnt/jenkins-workspace/workspace/mediawiki-core-qunit/
$ export WORKSPACE=$PWD; export BUILD_TAG=debug; export EXECUTOR_NUMBER=999
$ cd src/
$ git remote update && git checkout origin/master && git reset --hard HEAD
$ /srv/deployment/integration/slave-scripts/bin/
$ /srv/deployment/integration/slave-scripts/bin/
$ . /srv/deployment/integration/slave-scripts/bin/
$ echo -e "<?php\n\$wgServer = '${MW_SERVER}';\n\$wgScriptPath = '${MW_SCRIPT_PATH}';\n\$wgScript=\$wgStylePath=\$wgLogo=false;\n\$wgEnableJavaScriptTest = true;\n" >> "$MW_INSTALL_PATH/LocalSettings.php"
$ . /srv/deployment/integration/slave-scripts/bin/
$ rm -rf node_modules && npm install
$ ln -s "$MW_INSTALL_PATH" /srv/localhost-worker/$BUILD_TAG

Now the install is ready for interacting with.

For example:

$ curl --include "$MW_SERVER/$MW_SCRIPT_PATH/index.php?title=Special:BlankPage"
$ curl --include "$MW_SERVER/$MW_SCRIPT_PATH/load.php?debug=true&modules=startup&only=scripts"


$ grunt qunit

Remember: Clean up MySQL database afterwards by running (needs the same environment, e.g. WORKSPACE, EXECUTOR_NUMBER):