Back to blog

Jenkins 2.0 Online JAM Wrap-up

R. Tyler Croy
R. Tyler Croy
May 10, 2016

Last week we hosted our first ever Online JAM with the debut topic of: Jenkins 2.0. Alyssa, our Events officer, and I pulled together a series of sessions focusing on some of the most notable aspects of Jenkins 2 with:

  • A Jenkins 2.0 keynote from project founder Kohsuke Kawaguchi

  • An overview of "Pipeline as Code" from Patrick Wolf

  • A deep-dive into Pipeline and related plugins like Multibranch, etc from Jesse Glick and Kishore Bhatia

  • An overview of new user experience changes in 2.0 from Keith Zantow

  • A quick lightning talk about documentation by yours truly

  • Wrapping up the sessions, was Kohsuke again, talking about the road beyond Jenkins 2.0 and what big projects he sees on the horizon.

The event was really interesting for me, and I hope informative for those who participated in the live stream and Q&A session. I look forward to hosting more Virtual JAM events in the future, and I hope you will join us!

Questions and Answers

Below are a collection of questions and answers, that were posed during the Virtual JAM. Many of these were answered during the course of the sessions, but for posterity all are included below.

Pipeline

What kind of DSL is used behind pipeline as code? Groovy or allow freely use different languages as a user prefer?

Pipeline uses a Groovy-based domain specific language.

How do you test your very own pipeline DSL?

Replay helps in testing/debugging while creating pipelines and at the branch level. There are some ideas which Jesse Glick has proposed for testing Jenkinsfile and Pipeline libraries captured in JENKINS-33925.

Isn’t "Survive Jenkins restart" exclusive to [CloudBees] Jenkins Enterprise?

No, this feature does not need CloudBees Jenkins Enterprise. All features shown during the virtual JAM are free and open source. CloudBees' Jenkins Enterprise product does support restarting from a specified stage however, and that is not open source.

How well is jenkins 2.0 integrate with github for tracking job definitions?

Using the GitHub Organization Folder plugin, Jenkins can automatically detect a Jenkinsfile in source repositories to create Pipeline projects.

Please make the ability for re-run failed stages Open Source too :)

This has been passed on to our friends at CloudBees for consideration :)

If Jenkinsfile is in the repo, co-located with code, does this mean Jenkins can auto-detect new jobs for different branches?

This is possible using the Pipeline Multibranch plugin.

What documentation sources are there for Pipeline?

Our documentation section contains a number of pagesaround Pipeline. There is also additional documentation and examples in the plugin’s git repository and the jenkinsci/pipeline-examples repository. (contributions welcome!)

Where we can find the DSL method documentation?

There is generated documentation on jenkins.io which includes steps from all public plugins. Inside of a running Jenkins instance, you can also navigate to JENKINS_URL/workflow-cps-snippetizer/dslReference to see the documentation for the plugins which are installed in that instance.

If Pipeline is not support some plugins (there is a lot actually), I needed SonarQube Runner but unfortunately it’s not supported yet, in Job DSL plugin i can use "Configure Block" and cover any plugin via XML, how i can achieve the same with a Pipeline?

Not at this time

Is there a possibility to create custom tooltips i.e. with a quick reference or a link to internal project documentation? Might be useful i.e. for junior team members who need to refer to external docs.

Not generally. Though in the case of Pipeline global libraries, you can create descriptions of vars/functions like standardBuild in the demo, and these will appear in Snippet Generator under Global Variables.

Oh pipeline supports joining jobs? It’s really good, but I cannot find document at https://jenkins.io/doc/ could you tell me where is it?

There is a build step, but the Pipeline system is optimized for single-job pipelines

We have multiple projects that we would like to follow the same pipeline. How would I write a common pipeline that can be shared across multiple projects.

You may want to look at implementing some additional steps using the Pipeline Global Library feature. This would allow you to define organization-specific extensions to the Pipeline DSL to abstract away common patterns between projects.

How much flexibility is there with creating context / setting environment variables or changing / modifying build tool options when calling a web hook / api to parameterize pipelines for example to target deployments to different env using same pipeline

Various environment variables are exposed under the env variable in the Groovy DSL which would allow you to construct logic as simple or as complex as necessary to achieve your goal.

When you set up the job for the first time, does it build every branch in git, or is there a way to stop it from building old branches?

Not at this time, the best way to prevent older branches from being built is to remove the Jenkinsfile in those branches. Alternatively, you could use the "include" or "exclude" patterns when setting up the SCM configuration of your multibranch Pipeline. See also JENKINS-32396.

Similar to GitHub organizations, will BitBucket "projects" (ways of organizing collections of repos) be supported?

Yes, these are supported via the Bitbucket Branch Source plugin.

How do you handle build secrets with the pipeline plugin? Using unique credentials stored in the credentials plugin per project and/or branch?

This can be accomplished by using the Credentials Binding plugin.

Similar to GitHub Orgs, are Gitlab projects supported in the same way?

GitLab projects are not explicitly supported at this time, but the extension points which the GitHub Organization Folder plugin uses could be extended in a similar manner for GitLab. See also JENKINS-34396

Is Perforce scm supported by the Pipeline plugin?

As a SCM source for discovering a Jenkinsfile, not at this time. The P4 plugin does provide some p4 steps which can be used in a Pipeline script however, see here for documentation.

Is Mercurial supported with multibranch?

Yes, it is.

Can Jenkinsfile detect when it’s running against a pull request vs an approved commit, so that it can perform a different type of build?

Yes, via the env variables provided in the DSL scope. Using an if statement, one could guard specific behaviors with:

if (env.CHANGE_ID != null) {
    /* do things! */
}

Let’s say I’m building RPMs with Jenkins and use build number as an RPM version/release number. Is there a way to maintain build numbers and leverage versioning of Jenkinsfile?

Through the env variable, it’s possible to utilize env.BUILD_NUMBER or the SCM commit ID, etc.

Love the snippet generator! Any chance of separating it out from the pipeline into a separate page on its own, available in the left nav?

Yes, this is tracked in JENKINS-31831

Any tips on pre-creating the admin user credential and selecting plugins to automate the Jenkins install?

There are various configuration management modules which provide parts of this functionality.

I’m looking at the pipeline syntax (in Jenkins 2.0) how do I detect a step([…​]) has failed and create a notification inside the Jenkinsfile?

This can be done by wrapping a step invocation with a Groovy try/catch block. See also JENKINS-28119

User Interface/Experience

Is the user experience same as before when we replace the Jenkins.war(1.x to 2.x) in an existing (with security in place) installation?

You will get the new UI features like redesigned configuration forms, but the initial setup wizard will be skipped. In its stead, Jenkins will offer to install Pipeline-related functionality.

Is it possible to use custom defined syntax highlighting ?

Within the Pipeline script editor itself, no. It is using the ACE editor system, so it may be possible for a plugin to change the color scheme used.

Can you elaborate on what the Blue Ocean UI is? Is there a link or more information on it?

Blue Ocean is the name of user experience an design project, unfortunately at this point in time there is not more information available on it.

General

How well this integrate with cloud environment?

The Jenkins controller and agents can run easily in any public cloud environment that supports running Java applications. Through the EC2, JClouds, Azure, or any other plugins which extend the cloud extension point, it is possible to dynamically provision new build agents on a configured cloud provider.

Are help texts and other labels and messages updated for other localizations / languages as well?

Practically every string in Jenkins core is localizable. The extent to which those strings have been translated depends on contributors by speakers of those languages to the project. If you want to contribute translations, this wiki page should get you started.

Any additional WinRM/Windows remoting functionality in 2.0?

No

Is there a CLI to find all the jobs created by a specific user?

No, out-of-the-box Jenkins does not keep track of which user created which jobs. The functionality provided by the Ownership plugin may be of interest though.

Please consider replacing terms like "master" and "slave" with "primary" and "secondary".

"slave" has been replaced with "agent" in Jenkins 2.0.

Updated 2020-09-18: The term "master" is being replaced with "controller".

We’ve been making tutorial videos on Jenkins for awhile (mostly geared toward passing the upcoming CCJPE). Because of that we’re using 1.625.2 (since that is what is listed on the exam), but should we instead base the videos on 2.0?

As of right now all of the Jenkins Certification work done by CloudBees is focused around the Jenkins LTS 1.625.x.

About the author

R. Tyler Croy

R. Tyler Croy

R. Tyler Croy has been part of the Jenkins project for the past seven years. While avoiding contributing any Java code, Tyler is involved in many of the other aspects of the project which keep it running, such as this website, infrastructure, governance, etc.