Jenkinsfile naming convention

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Jenkinsfile naming convention

Kris Z
Hello,

I was reading the documentation for Jenkins User Handbook (https://www.jenkins.io/doc/book/getting-started/), specifically the section on Pipeline and creating the Jenkins file.  

My specific question is, why isn't the Jenkinsfile named Jenkinsfile.groovy?  

When adding the extension all the operating systems have tools to open a file with editor and they launch syntax highlighting.


--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/df168746-6d8e-443c-9279-436eb6f5c58f%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Jenkinsfile naming convention

Alan Sparks
I think historical convention.  It's not a huge deal, you can use any file name you want, if you set your pipeline job up to use your path/filename instead of the default.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/913a00ee-40fc-41f4-9710-ba07d4689dd3%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Jenkinsfile naming convention

Kris Z
I'm not sure how to define "huge deal".  I think it really has to do with someone not thinking things through when they document on the Jenkins website: https://www.jenkins.io/doc/pipeline/tour/hello-world/ .

I mean, it's going backwards several decades.  As of now, all operating systems: Linux, Mac, Windows, and others understand the concept of having a file extension.  I use Linux as my default development environment.  Unix-like operating systems have also come as far as adding a shebang to the top of the file to all files which include source code that is a scripting language.  This concept of using a shebang is very well understood in Unix-like operating systems.

There are so many scripting languages out there, how could I tell what language is being used within a Jenkinsfile?  I mean it is using Groovy and the Jenkins team is not creating a new scripting language.  It should be explicitly indicating that Groovy is being used by the following:
  1. Adding a ".groovy" to the "Jenkinsfile" example, so it is "Jenkinsfile.groovy".
  2. Adding a cross-platform compatible shebang to the top of the file:
    1. Example source code:
      1. #!/usr/bin/env groovy


    2. Example screenshot:
    3. test_groovy_example.png


I scoured other training material and I see people that call themselves "trainers" (especially on YouTube) and create files that have a ".pipeline" extension.  Which is wrong.  If the file is a Groovy scripting language it should be named "pipeline_x.groovy".  This way the development tools on Linux can automatically perform syntax highlighting and file type assesment.

How could I submit a defect against the documentation to have this looked at and changed?

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/23d00a11-4458-4e72-8e7c-76846b56ce4d%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Jenkinsfile naming convention

Alan Sparks
Perhaps the phrase "not a huge deal" was ill-advised, apologize for that.
Am not sure from the documentation you reference that it's a documentation problem - does it not consistently reference "Jenkinsfile"?  Since the default pipeline definition in a pipeline job (with pipeline from SCM) is Jenkinsfile, the documentation seems right to me (from standpoint of documenting reality).

Calling it Jenkinsfile.groovy isn't 100% accurate, since the content of that file isn't idiomatic Groovy.  Supports a lot of Groovy-ish constructs, but isn't Groovy proper. Jenkinsfile.pipeline would make sense, as it is a pipeline definition. I understand that a ".pipeline" extension isn't recognized by many tools as a text file construct.  Although, most tools would allow you to map extensions as desired.

Seems unlikely that the historical name "Jenkinsfile" would be changed.  I've been known to create multiple pipeline files in a repository, and to name them with schema "foobar.pipeline".  I think that's a preference, and to each their own.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/38102661-6168-4339-b6fc-16f51b9c2e73%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Jenkinsfile naming convention

Mark Waite-2
In reply to this post by Kris Z


On Thu, May 14, 2020 at 12:22 PM Kris Z <[hidden email]> wrote:
I'm not sure how to define "huge deal".  I think it really has to do with someone not thinking things through when they document on the Jenkins website: https://www.jenkins.io/doc/pipeline/tour/hello-world/ .


Thanks for your interest.  The "getting started" page includes a suggestion to use the shebang line at the top of the file.  It says:

image.png
 

I scoured other training material and I see people that call themselves "trainers" (especially on YouTube) and create files that have a ".pipeline" extension.  Which is wrong.  If the file is a Groovy scripting language it should be named "pipeline_x.groovy".  This way the development tools on Linux can automatically perform syntax highlighting and file type assesment.


I've never encountered anyone that suggests creating a Jenkinsfile with a ".pipeline" extension.  That file name wouldn't help me.

I disagree that the file name should be Jenkinsfile.groovy, especially since I don't find the declarative pipeline syntax to feel much like groovy and there are many places where the Jenkinsfile DSL is not groovy, but rather a subset of groovy that was intentionally selected when the domain specific language was being defined.
 
How could I submit a defect against the documentation to have this looked at and changed?

Each documentation page includes links in the lower left corner of the page.  One of those links is "Improve this page".  The other is "Report a problem".

Thanks,
Mark Waite
 

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/23d00a11-4458-4e72-8e7c-76846b56ce4d%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAO49JtFRbSWikgiboaOxzEbyd%3D8VCYzRqgj2GdvrOjPd0__DEQ%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

RE: Jenkinsfile naming convention

Jérôme Godbout
In reply to this post by Kris Z

Probably because only one OS (read Windows here) only rely on extension to open file. The shebang is enough on most system. Pipeline Groovy is not pure groovy, the script into pipeline is a Frankenstein of Groovy and Jenkins features. Like some other point out, it should have been .pipeline or .jenkins or something like that. Really wish they went standard on this one, it make horrible scripts that aren’t reusable anywhere else. I mostly just call python script and gave up on the NON CPS and weird loop behavior, did anyone said script approval madness??? At least my python script can be reuse without the need of the Jenkins special env. Some would say this is a security breach, but I prefer having secure repository and Jenkins server, not the execution of the script per say, it’s grail run to try to secure from code execution like that, it will never be good, it just an annoyance. Wish there was a fork without that script approval and no CPS. Let me secure the source of my Jenkins scripts (certificate and private key ok) and assume my dev know what they do, it’s not like they cannot access the code anyway.

 

 

From: [hidden email] <[hidden email]> On Behalf Of Kris Z
Sent: May 14, 2020 10:00 AM
To: Jenkins Users <[hidden email]>
Subject: Jenkinsfile naming convention

 

Hello,

 

I was reading the documentation for Jenkins User Handbook (https://www.jenkins.io/doc/book/getting-started/), specifically the section on Pipeline and creating the Jenkins file.  

 

My specific question is, why isn't the Jenkinsfile named Jenkinsfile.groovy?  

 

When adding the extension all the operating systems have tools to open a file with editor and they launch syntax highlighting.

 

 

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/df168746-6d8e-443c-9279-436eb6f5c58f%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/YQBPR0101MB1074F340F78163CEC95CF968CDBC0%40YQBPR0101MB1074.CANPRD01.PROD.OUTLOOK.COM.
Reply | Threaded
Open this post in threaded view
|

Re: Jenkinsfile naming convention

slide
Using external scripts is generally the preferred way of doing things anyway, so you are going the correct route. Writing scripts that reside in your SCM and then orchestrating them with a Jenkinsfile is the recommended way. As for the filename, most editors that I know of have a way to associating a filename with a language, I do this in VSCode to associate Jenkinsfile with groovy handling and it works just fine.

On Thu, May 14, 2020 at 1:20 PM Jérôme Godbout <[hidden email]> wrote:

Probably because only one OS (read Windows here) only rely on extension to open file. The shebang is enough on most system. Pipeline Groovy is not pure groovy, the script into pipeline is a Frankenstein of Groovy and Jenkins features. Like some other point out, it should have been .pipeline or .jenkins or something like that. Really wish they went standard on this one, it make horrible scripts that aren’t reusable anywhere else. I mostly just call python script and gave up on the NON CPS and weird loop behavior, did anyone said script approval madness??? At least my python script can be reuse without the need of the Jenkins special env. Some would say this is a security breach, but I prefer having secure repository and Jenkins server, not the execution of the script per say, it’s grail run to try to secure from code execution like that, it will never be good, it just an annoyance. Wish there was a fork without that script approval and no CPS. Let me secure the source of my Jenkins scripts (certificate and private key ok) and assume my dev know what they do, it’s not like they cannot access the code anyway.

 

 

From: [hidden email] <[hidden email]> On Behalf Of Kris Z
Sent: May 14, 2020 10:00 AM
To: Jenkins Users <[hidden email]>
Subject: Jenkinsfile naming convention

 

Hello,

 

I was reading the documentation for Jenkins User Handbook (https://www.jenkins.io/doc/book/getting-started/), specifically the section on Pipeline and creating the Jenkins file.  

 

My specific question is, why isn't the Jenkinsfile named Jenkinsfile.groovy?  

 

When adding the extension all the operating systems have tools to open a file with editor and they launch syntax highlighting.

 

 

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/df168746-6d8e-443c-9279-436eb6f5c58f%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/YQBPR0101MB1074F340F78163CEC95CF968CDBC0%40YQBPR0101MB1074.CANPRD01.PROD.OUTLOOK.COM.


--

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAPiUgVdPfOXF9axcw8T0y5SDrqU%2B5iohNUjyiUsD2X0vowkHhA%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: Jenkinsfile naming convention

Dirk Heinrichs-3
In reply to this post by Kris Z
Am Donnerstag, den 14.05.2020, 06:59 -0700 schrieb Kris Z:

When adding the extension all the operating systems

That's not quite true. Unix-like OS' don't need one since they identify files by content, not by extension. So, a proper shebang line at the top should be sufficient to identify your Jenkinsfile as being Groovy.

HTH...

Dirk
-- 
Dirk Heinrichs
Senior Systems Engineer, Delivery Pipeline
OpenText ™ Discovery | Recommind
Phone: +49 2226 15966 18
Recommind GmbH, Von-Liebig-Straße 1, 53359 Rheinbach
Vertretungsberechtigte Geschäftsführer Gordon Davies, Madhu Ranganathan, Christian Waida, Registergericht Amtsgericht Bonn, Registernummer HRB 10646
This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden
Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail sind nicht gestattet.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/288e7d543e0d93f3bdf636bcc3b708b9244d677c.camel%40opentext.com.