Difference between revisions of "Jenkins Sandbox"
Line 1: | Line 1: | ||
− | + | =Jenkins Sandbox= | |
− | The purpose of the [https://jenkins.fd.io/sandbox/ 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 | + | The purpose of the [https://jenkins.fd.io/sandbox/ 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 | + | 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''' | + | ==='''Notes Regarding the Sandbox'''=== |
*Jobs are automatically deleted every Saturday at 08:00 UTC<br> | *Jobs are automatically deleted every Saturday at 08:00 UTC<br> | ||
*Committers can log in and configure Jenkins jobs in the sandbox directly<br> | *Committers can log in and configure Jenkins jobs in the sandbox directly<br> | ||
Line 14: | Line 14: | ||
*Sandbox jobs can NOT vote on Gerrit<br> | *Sandbox jobs can NOT vote on Gerrit<br> | ||
− | + | ==Configuration== | |
− | Make sure you have the correct version of JJB installed | + | 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 | + | JJB reads user-specific configuration from a jenkins.ini in the top-level ci-management directory |
[job_builder] | [job_builder] | ||
Line 26: | Line 26: | ||
[jenkins] | [jenkins] | ||
user=<LFID> | user=<LFID> | ||
− | password=<Jenkins token> | + | password=<Jenkins API token> |
url=https://jenkins.fd.io/sandbox | url=https://jenkins.fd.io/sandbox | ||
query_plugins_info=False | 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 |
Revision as of 20:03, 8 January 2020
Contents
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
- Sandbox 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