Webinar Q&A: Orchestrating the CD Process in Jenkins with Workflow

Thank you to everyone who joined us on our webinar, the recording is now available.
And the slides are here.

Below are the questions we received during the webinar Q&A:

Table Of Contents

  • Workflow
      • General Workflow questions
      • Workflow, SCM and libraries
      • Workflow visualization
    • Workflow and Plugin Ecosystem
  • Webinar & Demo Questions
  • Jenkins Dev questions
  • Generic Jenkins Plugin Ecosystem Questions

General Workflow Questions

Q: Where can I find docs on workflow and on samples for complex builds where multiple plugins/ build steps and post build actions are required?
A: See this webinar and the Workflow tutorial.

Q: Where are the docs on the integration of plugins with Jenkins Workflow?
A: See https://github.com/jenkinsci/workflow-plugin/blob/master/README.md

Q: Is the workflow functionality only available in the enterprise version?
A: No, the Jenkins Workflow Engine is part of Jenkins Open Source (see install here). Jenkins Enterprise by CloudBees adds additional workflow features such as the Stage View Visualisation or CheckPoints to resume the workflow from an intermediate point.

Q: Do you offer transition services to help adopt the solution?
A: Please contact sales@cloudbees.com, we will be pleased to introduce you to our service partners.

Q: Do the workflows run on slaves, and across multiple/different slaves for each step?
A: Yes, workflows run on slaves and can span on multiple slaves with the statement “node(‘my-label’)”.

Q: *nix only slaves, or Windows/MacOS also?
A: Jenkins workflows can run on any Jenkins slave including *nix, Windows and MacOS.

Q: Does Jenkins have a way to block some processes from executing if the prerequisites have not yet fired?
A: A flow could wait for some conditions, if that is what you are asking. There is also a Request For Enhancement named “Wait-for-condition step”.

Q: We have some scenarios where 9 prerequisites need to happen before 5 other processes can fire off.
A: Parallel step execution could be a solution. Otherwise, there is a Request For Enhancement named “Wait-for-condition step

Q: How does one implement control points i.e. ‘Gating’ in Jenkins?
A: The “input” step for human interaction allows you to do it. You can even apply Role Based Access Control to define who can “move” to the next step.

Q: Can we trigger a workflow build using Gerrit events?
A: Any job trigger is supported for Workflow jobs generally. This one currently has a bug.

Q: Can we restrict also a step to run on a particular slave?
A: Yes with a statement “node(‘my-label-my-node-name’)” . You can restrict execution on a particular node or on a node matching a particular label.

Q: Does Jenkins support automatic retries on tasks that fail rather than just failing out right?
A: Yes there is a retry step (“retry(int maxRetries)” ).

Q: Is it possible to do conditional workflow steps?
A: Yes, absolutely. Jenkins workflow support standard Groovy conditional expressions such as “if then else” and “switch case default”.

Q: Does it work okay with the folders plugin?
A: Yes, folders can be used.

Q: Is there a way to call a job or a workflow from a workflow? ie. can I call an existing (complex) freestyle job that is taking care of build and call other jobs as part of the workflow?
A: Yes there is a ‘build’ step for this purpose.

Q: Is there a special syntax for creating a Publisher in workflow groovy? For example to chain workflows.
A: No special syntax for publishers. The ‘build’ step can be used to chain workflows, or you can use the standard reverse build trigger on the downstream flow.

Q: How do you handle flows where I may have 3 builds to Dev with only 1 of them going to QA?
A: stage step can take an optional concurrency: 1 (e.g. “stage ‘qa’, concurrency: 1”).

Q: Can Jenkins support multiple java and ant versions - we have a need to compile programs with java 1.5, 1.6, and 1.7 simultaneously?
A: Yes, using the tool step you can select a particular tool version.

Q: And support 32 bit and 64 bit compilations simultaneously?
A: Sure, if you run on appropriate slaves in parallel.


parallel( build32bits: {
     node('linux32') { // SLAVE MATCHING LABEL ‘linux32’
       // ...
}, build64bits: {
     node('linux64') { // SLAVE MATCHING LABEL ‘linux64’
      // ...

Q: Is it possible to have some human approval on workflow step? Like creating externally accessible web callback inside workflow, and continuing once this callback was called?
A: Yes, with the “input” step as show in the webinar.

Q: When you have a build waiting for human input, can you specify which users have permission to continue the build?
A: Yes you can specify a list of approvers. This list of approvers is typically defined with the CloudBees RBAC authorisation (part of Jenkins Enterprise by CloudBees).

Q: In a step can we have a dropdown where they select an option, for example, can we take user input to indicate which feature test environment to deploy to?
A: Yes the input step can accept any parameter just like build parameters, including pulldowns.

Q: What about text input or dropdown in human interaction part? Is that there?
A: Yes you can specify any parameters you like for the input step.

Q: If multiple builds are waiting on the same User Input message (say builds 1, 2 and 3) and the user responds positively to build 3, do builds 1 and 2 continue waiting or do they automatically abort?
A: They would continue waiting, though there are ways that a newer build can abort an earlier build, mainly by using the stage step.

Q: Is this workflow plugin available for current linux LTS release?
A: Yes, available for 1.580.1, the current LTS.

Q: One of the concerns I had was with troubleshooting efforts. I was curious to how that is handled in terms of documentation or support to resolve issues related to Jenkins?
A: There is a publicly available tutorial. If you are a CloudBees customer we offer support, and other providers may be available as well.

Q: Is there documentation for that right now or does CloudBees support troubleshooting efforts particular to Jenkins, that a developer and/or OPS representative might not be familiar with?
A: CloudBees offers support for any Jenkins operational issues.

Q: Does this plugin have access to Jenkins project model? I mean can it be used as a replacement for Jenkins script console?
A: It does have access to the Jenkins project model, yes, so you could use it for that purpose, though it is not intended to replace (say) Scriptler.

Q: I may have missed this being answered but, is that catchError on the card able to parse the log or does it just look for an exit code?
A: Just checks the exit code. There is a known RFE to capture shell command output and let you inspect its contents in Groovy as you wish.

Q: It appears that some of this feature set is in open-source Jenkins, and some in Cloudbees Enterprise. Is there a clear feature matrix that details these differences?
A: The stage view, and checkpoints, are currently the Enterprise additions. All else is OSS.

Q: Is the DSL extensible and available OSS?
A: All steps are added by plugins, so yes it is certainly extensible (and yes the DSL is OSS).

Q: Is it a full fledged Groovy interpreter, e.g., can I @Grab some modules?
A: @Grab grapes is not yet supported, though it has been proposed. But yes it is a full Groovy interpreter.

Q: Is it possible to install an app to the /usr directory on a the Jenkins in the cloud master or slave?
A: There is not currently any special step for app deployment but I expect to see some soon. In the meantime you would use a shell/batch script step.

Q: What mechanism does archive/unarchive use? Do you define your own revision system for it?
A: No this just uses the artifact system already in place in Jenkins.

Q: If I cannot @Grab is there any other possibility to extend the plugin? Can I access APIs of other plugins?
A: Yes you can access the API of other plugins directly from the script (subject to security approval); and you can add other steps from plugins.

Q: How does the workflow plugin interact with multi master systems?
A: There is no current integration with Jenkins Operations Center.

Q: How do you manage security access to trigger jobs or certain steps? (Integration LDAP and so on)
A: Controlling trigger permission to jobs is a general Jenkins feature.

Q: Does Jenkins workflow support parallelization of steps?
A: Yes, using the “parallel” step.

Q: Is there a way to promote jobs or manually trigger a job after job completion? I saw the wait for input but it looked the job was in a running state for that to work
A: The preferred way is to wait for some further condition. The build consumes no executor while waiting (if you are outside any node step).

Q: Can we run arbitrary Groovy code similar to groovy build steps from within the workflow?
A: Yes you can run arbitrary Groovy code, though Workflow is not optimized for this.

Q: We use tests that based on failures invoke more detailed tests and capture more detailed logs…and could jump out (maybe?) out of the Workflow context…
A: Your script could inspect partial test results and decide what to do next on that basis.

Q: When I trigger a Workflow from a normal “Freestyle project” an error occurs: “Web-Workflow is not buildable.”
A: There is a known bug in the Parameterized Trigger plugin in this respect.

Q: If the Jenkins master is rebooted for some reason midway through workflow / job build, does the last good state stay in cache and restart automatically once Jenkins is back online? Or does last job require manually invoking the last build step?
A: The workflow resumes automatically once Jenkins comes back online.

Q: It is possible to reuse same workspace between builds, e.g. for incremental builds?
A: Yes the workspace is reused by default, just as for Jenkins freestyle projects. If you run node {…} in your flow, and it grabs a workspace on a slave in build #1, by default build #2 will run in the same directory. However, workspaces are not shared between different workflows / jobs.

Workflow, SCM and libraries.

Q: Would it be possible to pull workflow configuration script from SCM?
A: Yes, you can store the workflow definition in an SCM and use the ‘load’ step.

Q: Can Jenkins directly access the SCM system for the workflow.groovy script?
A: Sort of. You can either check out and load() from workspace, or you can store script libraries in Jenkins master. Directly loading the whole flow from SCM is a known RFE.

Q: How do we reuse portions of scripts between different pipelines?
A: Yes, the Groovy language helps to extract functions and data structures to create libraries that can be loaded in workflows with the ‘load’ step and can typically be stored in an SCM. Or there are other options, including Templates integration in Jenkins Enterprise.

Q: Are all of the groovy functions generic? or these are pre-defined functions please?
A: Workflows are written in standard Groovy and allows to use the standard programming constructs such as functions, classes, variables, logical expressions (for loops, if then else …).

The Domain Specific part of the workflow syntax is brought by the jenkins workflow engine (e.g. “parallel”, “node” …) plugin steps (e.g. ”git”, “tool” …).
You can in addition write custom workflow libraries written in groovy scripts.
We can expect to see people sharing libraries of workflow scripts.

Q: If I am satisfied with a particular build, can I have optional steps in the workflow to, e.g., add an SCM tag to the respective source, or stage the artifacts to a different (higher level) artifact repository?
A: Yes, you can use simple if-then blocks, etc.

Q: So if I break workflow script into multiple part I have to use ‘load’ to compose them into the workflow?
A: Yes, or there is already support for loading Groovy classes by name rather than from the workspace. Other options in this space may be added in the future.

Q: How can I reuse similar functions in many workflows? For example right now we are using Build Flow plugin and we have on unittest job and we trigger it by many different workflows with different parameters.
A: You can use the step “load()” to share a common script from each flow; or store Groovy class libraries on Jenkins; or use Templates integration in Jenkins Enterprise.

Q: If we want to automatically start workflow build after someone pushes to a Git repo, can we set up that inside workflow definition?
A: Yes, just use the git step to check out your flow the first time, and configure the SCM trigger in your job.

Workflow Visualization

Q: Any plans for a combined visualization of multiple, related pipelines (for example, the build pipelines for an applications UI WAR and Web service WARs)?
A: CloudBees is working on a “release centric visualisation”, your idea could fit in it. We don’t have any ETA for the release-centric view.

Q: Is that “workflow view” only available on the main job page? I want to know if we could see multiple application’s workflows in one place like the Continuous Delivery Pipeline plugin
A: Currently only on the job main page, though we are considering other options too.

Q: Is there any other visualizations possible, other than the tomcat based one? Like build-graph or build-flow?
A: The Jenkins Build Graph View Plugin and other pre-existing job flow views do not allow to visualize the internals of a workflow execution.

Q: So the nice UI is available only in Jenkins Enterprise, right?
A: Yes the table view of stages is available only in Jenkins Enterprise by CloudBees.

Workflow and Plugin Ecosystem

Q: Can existing build step plugins be access from the Groovy script - for example, the Copy Artifact plugin?
A: Some can, though minor changes need to be made to the plugin to support it. In this case, see JENKINS-24887.

Q: How do we figure out the generic step interface for the existing plugins?
A: The plugin step must implement SimpleBuildStep

Q: As far as I saw, it’s more for Java development. How good Workflow will do for Windows development environment with Visual Studio and TFS source control environment?
A: Windows development is already well supported by Jenkins with various plugins including a Jenkins TFS Plugin and a Jenkins MSBuild plugin. Jenkins workflow support execution of Windows Batch scripts as it is possible with the Jenkins Step: Windows Batch script.

Q: Is it possible to integrate Jenkins with MSBuild from Microsoft to build .net applications?
A: The msbuild step probably does not yet support the newer APIs needed for Workflow integration but this is likely possible to add. In the meantime you can use the bat step to run msbuild.exe.

Q: Is it possible to invoke HTTP/S API through the workflow?
A: There is no specific step for this yet, but one could be created.In this demo, we invoke “curl” in an “sh” step.

Q: Does it support the job history plugin
A: Yes, the Jenkins Job Configuration History plugin applied to workflow job will track the history of the workflow definition.

Q: Can the workflow perform JIRA JQL workflow changes (i.e. use functions from the JIRA plugin) and update relevant JIRA tickets?
A: There is probably no support from the JIRA plugin for the moment but it is probably not hard to add. In the meantime, raw http calls with “curl” may be a solution.

Q: I’m interested in how JIRA is integrated with workflow. Do you have any info?
A: I am not aware of any particular integration yet. This would just be an RFE for the JIRA plugin, either to integrate with the SimpleBuildStep API in 1.580.x, or to add a dedicated Workflow step if that is more pleasant.

Q: I saw a question about Jenkins workflow integration with JIRA, having Jenkins update JIRA tix, etc. Is the opposite possible - can you incorporate JIRA workflows into Jenkins workflow? like abort deployment if ticket has not passed code rev. in JIRA workflow?
A: This would also need to be a Workflow step defined in the JIRA plugin to query the status of a ticket, etc. In the meantime you could access the JIRA remote API using a command-line client, perhaps.

Q: Does Jenkins have a way to start a job via email notification?
A: Not sure if such a plugin exists, but if it does, it should work the same with workflows. Otherwise, you can invoke a standard shell “mail” command on a linux slave.

Q: ‘mvn’ is always started using “sh” in the sample scripts - so are the scripts always OS dependent?
A: Certainly the sh step is (you would use bat on Windows). In the future we expect to have a neutral Maven step.

Q: Are there any additional DSLs available/planned?
A: Additional DSLs, or additional steps? There is no plan for any other DSL other than the Groovy one, but the architecture supports the possibility.

Q: Are we able to add JARs to the workflow Groovy scripts classpath without having to restart Jenkins?
A: You may not add precompiled JARs to the classpath currently. There are security implications to this, and also any function called in a JAR could not survive Jenkins restart. There may in the future be a way of using common libraries like this.

Q: But I am the Jenkins user, not root, it does not give me access to copy files to /usr.
A: Well somehow there must be a privileged script (setuid?) to deploy things; out of scope for Jenkins.

Q: How do you publish to Artifactory?
A: A step to publish to Artifactory could be added, or you can simply use any other external command which accomplishes this, such as sh ‘mvn deploy’.

Q: Any potential gotchas/problems with Workflow and Ruby/Cucumber…?
A: Not that I know of. What kind of problems do you foresee?

Q: Do you have support for Docker containers? what about LB’s ? Let’s say I have service deployed to service machines … with an LB in front of it. Is this nothing more than using shell constructs in the workflow … where I sh to the LB’s cli ? I want to be able to install (which I can do) to new boxes … test on the new boxes … again I can do that … but then I want to put those boxes into a LB pool and take the old one out.
A: Jenkins supports integration with Docker to do the following:

Slave provisioning

Building and deploying Docker artifacts

You may have to look at application deployment solutions for your orchestration needs.

Webinar & Demo Questions

Q: What is deploy staging?
A: In this demo, we name “staging environment” the environment that mimics the production environment that is often called “pre-production environment”.

Q: Can you provide the Workflow Groovy script, other example and sites for review and learning?
A: See:

Q: Can you add to demo project a deployment step using puppet? How to capture the success/fail status of deployment via puppet?
A: Please look at this presentation of Jenkins Workflow combined with Puppet:

Slides: http://www.slideshare.net/cloudbees/devopscomcloudbeeswebinar

Jenkins Dev Questions

Q: Is there currently any (or are there plans) for a testing harness so that the Groovy Workflow scripts can be evaluated for correctness?
A: No current plans for a workflow testing harness, beyond what is available for Jenkins generally such as the acceptance testing harness.

Q: Is there some metamodel for Workflow script? That you can walk through it programmatically?
A: There is an API for accessing the graph of steps run during a flow, if that is what you are asking for.

Q: For plugins developers, should one develop a DSL for a plugin?
A: You just need to implement the Step extension point, defined in the workflow-step-api plugin.

Generic Jenkins Plugin Ecosystem Questions

Q: Is support only for Chef / Puppet? Is there support (planned) for SaltStack, Rundeck and similar tooling?
A: There are more than 1,000 open source plugins for Jenkins including plugins for ChefPuppet and Rundeck and SaltStack. Please note that the tracking of artifacts is not yet implemented in the Jenkins Rundeck plugin and the Jenkins SlatStack plugin.

Q: Does Jenkins integrate with OpenStack?
A: Yes, the Jenkins JClouds Plugin allows you to provision slaves “on demand” . We are not aware of plugins to ease the scripting of OpenStack or the packaging of OpenStack artifacts from Jenkins (e.g. automatic install of the OpenStack CLI on Jenkins slaves …)

Q: Does Jenkins have built-in database? If not, does Jenkins have DB plugins?
A: There is no built-in database. There may be plugins to work with your existing database.

Q: Can I get the Jenkins workflow to integrate with Heat orchestration on OpenStack?
A: we are not aware of such integration for the moment.


Steven Harris is senior vice president of products at CloudBees.



Jesse Glick is a developer for CloudBees and is based in Boston. He works with Jenkins every single day. Read more about Jesse in his 
Cyrille Le Clerc is an elite architect at CloudBees, with more than 12 years of experience in Java technologies. He came to CloudBees from Xebia, where he was CTO and architect. Cyrille was an early adopter of the “You Build It, You Run It” model that he put in place for a number of high-volume websites. He naturally embraced the DevOps culture, as well as cloud computing. He has implemented both for his customers. Cyrille is very active in the Java community as the creator of the embedded-jmxtrans open source project and as a speaker at conferences.

Add new comment