Jenkins Sandbox

From fd.io
Revision as of 20:04, 8 January 2020 by Valderrv (Talk | contribs)

Jump to: navigation, search

Jenkins Sandbox

The purpose of the jenkins-sandbox is to allow projects to test their JJB setups before merging. It is configured similarly to the master instance, although it cannot publish artifacts or vote in Gerrit

To request access to the sandbox please open a ticket at support.linuxfoundation.org. Please provide your LFID and email address

Notes Regarding the Sandbox

  • Jobs are automatically deleted every Saturday at 08:00 UTC
  • Committers can log in and configure Jenkins jobs in the sandbox directly
  • The Sandbox configuration mirrors production wherever possible
  • Sandbox jobs can NOT be trigged via Gerrit
  • Verify jobs need the Refspec configured
  • Sandbox jobs can NOT upload artifacts to Nexus
  • Sandbox jobs can NOT vote on Gerrit

Configuration

Make sure you have the correct version of JJB installed

JJB reads user-specific configuration from a jenkins.ini in the top-level ci-management directory

[job_builder]
ignore_cache=True
keep_descriptions=False
include_path=.
recursive=True
[jenkins]
user=<LFID>
password=<Jenkins API token>
url=https://jenkins.fd.io/sandbox
query_plugins_info=False

To get your API token

  • Log into Jenkins sandbox
  • Click the arrow next to your username then click Configure
  • Click Add new Token

Testing Jobs

It’s good practice to use the test command to validate your JJB files before pushing them

jenkins-jobs --conf jenkins.ini target jjb/ <job-name>

Successful tests output the XML description of the Jenkins job described by the specified JJB job name

Pushing jobs

Once you’ve verified your JJB jobs produce valid XML descriptions of Jenkins jobs you can push them to the Jenkins sandbox.

When pushing with jenkins-jobs, a log message with the number of jobs you’re pushing will be issued, typically to stdout. If the number is greater than 1 (or greater than the number of jobs you passed to the command to push) then you are pushing too many jobs and should `ctrl+c` to cancel the upload.

INFO:jenkins_jobs.builder:Number of jobs generated:  1

To push specific jobs to the sandbox run

jenkins-jobs --conf jenkins.ini update jjb/ <job-name>

Failing to provide the final `<job-name>` param will push all jobs

Running jobs

To run a job on the sandbox

  • Click the job name
  • Click Build with Parameters
  • Click Build