Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a nice little blog post about the despised JENKINS-26481
- Loading branch information
R. Tyler Croy
committed
Sep 7, 2017
1 parent
1c5922c
commit 3ed6f84
Showing
1 changed file
with
70 additions
and
0 deletions.
There are no files selected for viewing
70 changes: 70 additions & 0 deletions
70
content/blog/2017/08/2017-09-08-enumerators-in-pipeline.adoc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
--- | ||
layout: post | ||
title: "Closure on enumerators in Pipeline" | ||
tags: | ||
- pipeline | ||
- jenkinsworld | ||
author: rtyler | ||
--- | ||
|
||
While at Jenkins World, link:https://github.com/kohsuke[Kohsuke Kawaguchi] | ||
presented two long-time Jenkins contributors with a | ||
"link:https://en.wikipedia.org/wiki/Small_matter_of_programming[Small Matter of Programming]" | ||
award: link:https://github.com/abayer[Andrew Bayer] and | ||
link:https://github.com/jglick[Jesse Glick]. "Small Matter of Programming" | ||
being: | ||
|
||
[quote, Wikipedia] | ||
____ | ||
a phrase used to ironically indicate that a suggested feature or design change | ||
would in fact require a great deal of effort; it often implies that the person | ||
proposing the feature underestimates its cost. | ||
____ | ||
|
||
In this context the "Small Matter" relates to link:/doc/book/pipeline[Jenkins | ||
Pipeline] and a very simple snippet of Scripted Pipeline: | ||
|
||
[source,groovy] | ||
---- | ||
[1, 2, 3].each { println it } | ||
---- | ||
|
||
For a long time in Scripted Pipeline, this simply did not work as users would | ||
expect it. Originally filed as | ||
link:https://issues.jenkins-ci.org/browse/JENKINS-26481[JENKINS-26481] in 2015, | ||
it became one of the most voted for, and watched, tickets in the entire issue | ||
tracker until it was ultimately fixed earlier this year. | ||
|
||
image::https://farm5.staticflickr.com/4421/36886763192_1ae5a04428.jpg[Photo by Kohsuke, role=center, link=https://www.flickr.com/photos/12508267@N00/36886763192/] | ||
|
||
|
||
[quote, Original bug description by Daniel Tschan] | ||
____ | ||
At least some closures are executed only once inside of Groovy CPS DSL scripts | ||
managed by the workflow plugin. | ||
____ | ||
|
||
At a high level, what has been confusing for many users is that Scripted | ||
Pipeline looks like a Groovy, it quacks like a Groovy, but it's not _exactly_ | ||
Groovy. Rather, there's an custom Groovy interpreter | ||
(link:https://github.com/jenkinsci/workflow-cps-plugin[CPS]) that executes the | ||
Scripted Pipeline in a manner which provides the durability/resumability that | ||
defines Jenkins Pipeline. | ||
|
||
Without diving into too much detail, refer to the pull requests linked to | ||
JENKINS-26481 for that, the code snippet above was particularly challenging to | ||
rectify inside the Pipeline execution layer. As one of the chief architects for | ||
Jenkins Pipeline, Jesse made a number of changes around the problem in 2016, | ||
but it wasn't until early 2017 when Andrew, working on Declarative Pipeline, | ||
started to identify a number of areas of improvement in CPS and provided | ||
multiple patches and test cases. | ||
|
||
|
||
As luck would have it, combining two of the sharpest minds in the Jenkins | ||
project resulted in the "Small Matter of Programming" being finished, and | ||
released in May of this year with plugin:workflow-cps[Pipeline: Groovy] 2.33. | ||
|
||
|
||
Please join me in congratulating, and thanking, Andrew and Jesse for their | ||
diligent and hard work smashing one of the most despised bugs in Jenkins | ||
history :). |