Pipeline documentation jenkins-book vs realty?

192 views
Skip to first unread message

christian polzer

unread,
Feb 13, 2017, 6:28:29 AM2/13/17
to Jenkins Users
Hello,

I am currently trying to spread pipeline usage for a jenkins environment within my fellow coworkers. 
Of course, th jenkins pipeline is greatly embrased :)

But what is the documentation in the jenkins book about? Fellow CoCoders stumble over the jenkinsfile chapter as the examples are not working:

What documentation do you guys use?





R. Tyler Croy

unread,
Feb 13, 2017, 9:01:37 AM2/13/17
to jenkins...@googlegroups.com
(replies inline)
What examples are not working for you? I wrote almost all of them and I'm
pretty sure every single one works, perhaps I made a typo.

Could you share the error you're seeing and the corresponding Jenkinsfile
example?


Cheers
- R. Tyler Croy

------------------------------------------------------
Code: <https://github.com/rtyler>
Chatter: <https://twitter.com/agentdero>
xmpp: rty...@jabber.org

% gpg --keyserver keys.gnupg.net --recv-key 1426C7DC3F51E16F
------------------------------------------------------
signature.asc

Christopher Orr

unread,
Feb 13, 2017, 9:06:54 AM2/13/17
to jenkins...@googlegroups.com
Hi there,

On Mon, 13 Feb 2017, at 12:28, christian polzer wrote:
Hello,

I am currently trying to spread pipeline usage for a jenkins environment within my fellow coworkers. 
Of course, th jenkins pipeline is greatly embrased :)

But what is the documentation in the jenkins book about? Fellow CoCoders stumble over the jenkinsfile chapter as the examples are not working:

The documentation under jenkins.io/doc/ website should be up-to-date.

The Declarative Pipeline example listed on that page is just an example.  The syntax is correct, but it wouldn't make sense to copy-paste this particular example directly into Jenkins, unless you're running on a Unix platform, have a project with a `Makefile` checked in, has a `check` target that produces JUnit reports etc…

But it would work, assuming you have the Declarative Pipeline plugin installed (aka Pipeline Model Definition), which comes as standard if you upgrade the main Pipeline plugin.  You would also need the JUnit plugin since there's a `junit` step in that example.

Can you say exactly what is not working, so that we can fix it?

You can also report issues via JIRA, using the WEBSITE project (rather than JENKINS):

Specific fixes can also be contributed via GitHub by using the "Improve this page" link at the bottom of every page.

Regards,
Chris

jer...@bodycad.com

unread,
Feb 13, 2017, 11:21:44 AM2/13/17
to Jenkins Users

Sharan Basappa

unread,
Feb 13, 2017, 9:34:12 PM2/13/17
to Jenkins Users
Tyler,

I have a few questions for which I could not find answers after going through the documentation.
Unfortunately, understanding of these are necessary for anyone to create a decent build jobs.

1) Jenkins seems to be executing from a directory named @tmp (and some other names). The files I am referring are not available in @tmp directory and hence
the pipeline stage is exiting
2) secondly, why Jenkins creates another  directory @tmp when I would like to execute a command from my workspace.
All the references made by the script are available here.
3) I have also seen that sometimes the files from git are available but .git itself is missing

Can you comment?

Daniel Beck

unread,
Feb 13, 2017, 9:43:13 PM2/13/17
to jenkins...@googlegroups.com

> On 14.02.2017, at 03:34, Sharan Basappa <sharan....@gmail.com> wrote:
>
> 1) Jenkins seems to be executing from a directory named @tmp (and some other names). The files I am referring are not available in @tmp directory and hence
> the pipeline stage is exiting
> 2) secondly, why Jenkins creates another directory @tmp when I would like to execute a command from my workspace.
> All the references made by the script are available here.
> 3) I have also seen that sometimes the files from git are available but .git itself is missing

Answered yesterday here: https://groups.google.com/d/msg/jenkinsci-users/OFez67DYYVY/YvSyQnE1AAAJ

christian polzer

unread,
Feb 14, 2017, 4:22:54 AM2/14/17
to Jenkins Users
Hi, 
and thanks for the quick reply.
To be precice, I am getting questions about the "Jenkinsfile (Declarative Pipeline)" example. 

For example : 
1.) No such DSL method 'pipeline'
2.) "agent any" is not working , and as far as I learned from other coverage, agents (= nodes? ) are addressed with this syntax:  
<pre>
"node('[slave|node|agent] name here'){
}"   
</pre>

When introducing jenkins pipelines,  I had setup loads of pipeline examples on our Jenkins. But as the common developer is behaving, 
they never get bored of digging into stuff, in a struggle to make things easier and try out different angles :-)

When they finally stumble upon the jenkins book section, this is the question I get from most of my colleagues:
"How is this example meant to be used, or is it referring to a version of pipeline which is either outdated or we dont have installed yet?"
-> It also is unclear to me, if that syntax would be working, since I never saw this in any other example when digging into pipeline. 

This results in parts of the team drawing conclusions how pipeline is not so precise at all and syntax save and blablablah, and oh well - the documentation...
and then they skip multibranch pipelines and setup 60 identically build jobs by hand (which I have to maintain and backup) :-/

Please excuse my partly bad english - and please understand that no harm is intended here. I am really amazed by the jenkins project and the documentation and all.
 
I just wondered if the pipeline example is pseudo code and if so - if it has to?

Thanks for the good work and kind regards,

chris

christian polzer

unread,
Feb 14, 2017, 4:25:52 AM2/14/17
to Jenkins Users
Hi there, 

just a comment on your second question:

2) secondly, why Jenkins creates another  directory @tmp when I would like to execute a command from my workspace.

-> you are able to configure the executing jvm to use another tmp dir. Example : java -Djava.io.tmpdir=/path/to/tmpdir
(Especially handy if you are using RHEL7 or other oses which do not allow to execute stuff in /tmp)

Daniel Beck

unread,
Feb 14, 2017, 5:11:20 AM2/14/17
to jenkins...@googlegroups.com

> On 14.02.2017, at 10:22, christian polzer <christia...@gmail.com> wrote:
>
> I just wondered if the pipeline example is pseudo code and if so - if it has to?
>

You don't have the correct plugin installed:
https://plugins.jenkins.io/pipeline-model-definition

It should be automatically installed if you update plugins now, assuming you have the default set from 2.0 onward installed.

christian polzer

unread,
Feb 14, 2017, 5:59:01 AM2/14/17
to Jenkins Users, m...@beckweb.net
Ok, we have Jenkins LTS ver. 2.19.4
installed with plugins updated just now.

And voila - it is working. 

Then now to another issue: Would it be possible to somehow track the version the documentation is written for? :)

Daniel Beck

unread,
Feb 14, 2017, 7:14:26 AM2/14/17
to Jenkins Users

> On 14.02.2017, at 11:59, christian polzer <christia...@gmail.com> wrote:
>
> Would it be possible to somehow track the version the documentation is written for? :)

You can assume latest LTS or newer, with plugins up to date, as these are the only releases we consider to be supported. (I think rtyler has plans to improve this, but I doubt that'll be available soon.)

Running anything older is frequently a terrible idea anyway, see https://jenkins.io/security/advisories/

christian polzer

unread,
Feb 15, 2017, 8:21:29 AM2/15/17
to Jenkins Users, m...@beckweb.net
Ok.

updating the plugins did enable the new declarative poipeline, but disabled usage of everything path related.. shell "sh"  steps:

Running shell script
nohup: failed to run command ‘sh’: No such file or directory

Should i report that with lts version and version of all plugins??

Daniel Beck

unread,
Feb 15, 2017, 8:24:56 AM2/15/17
to christian polzer, Jenkins Users

> On 15.02.2017, at 14:21, christian polzer <christia...@gmail.com> wrote:
>
> Should i report that with lts version and version of all plugins??

You're overriding PATH in an unsupported way. See JENKINS-41339 for solutions.

christian polzer

unread,
Feb 15, 2017, 11:00:06 AM2/15/17
to Jenkins Users, christia...@gmail.com, m...@beckweb.net
Thanks again... 

it is hurting, thou:)
Reply all
Reply to author
Forward
0 new messages