This repository holds shared libraries for Jenkins pipelines used by Firefox Test Engineering.
Sends a notification to IRC with the specified channel, nick, and server.
By default it will connect to irc.mozilla.org:6697 as fxtest and join the
#fx-test-alerts channel.
// use defaults
ircNotification()
// specify a channel
ircNotification('#fx-test-alerts')
// specify all values
ircNotification(
channel: '#fx-test-alerts',
nick: 'fxtest',
server: 'irc.mozilla.org:6697'
)Publishes a message, to Pulse with the specified exchange and
routingKey. If a schema is provided then it will be used to check that the
message is valid. If the message fails to pass validation, details will be
output to the console log and ProcessingException will be thrown.
- Pulse credentials to be configured in Jenkins.
- Pipeline Model Definition Plugin v1.2 or later.
- Pipeline Utility Steps Plugin.
// configure environment variables from credentials
environment {
PULSE = credentials('PULSE')
}
// send message without schema validation
publishToPulse(
exchange: "exchange/${PULSE_USR}",
routingKey: "${PULSE_USR}.foo",
message: 'foo'
)
// send message with schema validation from resources
schema = libraryResource 'org/mozilla/fxtest/pulse/schemas/treeherder.json'
publishToPulse(
exchange: "exchange/${PULSE_USR}",
routingKey: "${PULSE_USR}.foo",
message: 'foo',
schema: schema
)Publishes the files at path to the specified Amazon S3 bucket and region.
Defaults to region us-east-1.
// single file with default bucket and region
publishToS3('results.html')
// multiple files with specified bucket and region
publishToS3(
path: 'results/*',
bucket: 'foo',
region: 'bar'
)Publishes the structured log(s) at logPath to ActiveData.
See publishToS3.
submitToActiveData('results/raw.txt')Submits the build result for project to Treeherder using the specified
jobSymbol and jobName. If provided, files located by artifactPath and
logPath will be published to Amazon S3 and linked from the build results. By
default the job will have a groupSymbol of 'j', and a groupName of
'Executed by Jenkins'. To leave the job ungrouped pass a groupSymbol of '?'.
See publishToS3 and publishToPulse.
// submit default grouped build results without artifacts or logs
submitToTreeherder(
project: 'foo',
jobSymbol: 'T',
jobName: 'Tests'
)
// submit ungrouped build results without artifacts or logs
submitToTreeherder(
project: 'foo',
jobSymbol: 'T',
jobName: 'Tests',
groupSymbol: '?'
)
// submit custom grouped build results with artifacts and log
submitToTreeherder(
project: 'foo',
jobSymbol: 'I',
jobName: 'Integration tests',
artifactPath: 'results/*',
logPath: 'results/tbpl.txt',
groupSymbol: 'T',
groupName: 'Tests'
)Writes a JSON file containing the items from the capabilities map to the
specified path (for use by pytest-selenium). If omitted, the path
defaults to capabilities.json in the working directory.
capabilities = [
browserName: 'Firefox',
version: '51.0',
platform: 'Windows 10'
]
// write capabilities to default path
writeCapabilities(capabilities)
// write capabilities to specified path
writeCapabilities(
desiredCapabilities: capabilities,
path: 'fx51win10.json'
)Queries the Service Book project API for the given project name, iterates over
its associated test repositories, checks them out from SCM, and executes their
run file(s). Finally, it returns exit 0 on successful/passing
tests, and exit 1 in the event of failed builds.
@Library('fxtest') _
def sb = new org.mozilla.fxtest.ServiceBook()
sb.testProject('kinto')- HTTP Request Plugin v1.8.20 or later.
Make sure you have the latest Gradle install and run:
$ gradle check
BUILD SUCCESSFUL in 1s
2 actionable tasks: 2 up-to-date- Remove superfluous test stage when using Service Book.
- Use
GIT_COMMITwhen reporting revision to Treeherder.
- Fixed the production Service Book API URL
- Greatly simplified Service Book API calls using the HTTP Request Plugin.
- Introduced
ServiceBookclass, withtestProjectmethod to execute tests for all pipeline associated with the specified project name.
- Changed TBPL log name to
buildbot_textin Treeherder message for log parsing. (#12) - Switched to YAML schema for Treeherder message validation. (#2)
- Added link to Treeherder results to console log. (#11)
- Provided a default group for Treeherder jobs. (#13)
- Changed S3 profile to
fx-test-jenkins-s3-publisher.
- Introduced
publishToS3,publishToPulse, andsubmitToTreeherdersteps.
- Don't mark jobs as unstable if
submitToActiveDatafails.
- Added
submitToActiveDatastep for publishing structured logs to S3 for processing by ActiveData.
- Changed order of arguments for
ircNotificationfor ease of specifying alternate channel.
- Initial release with
ircNotificationandwriteCapabilitiessteps.