[JCasC] can i utilize variables?

45 views
Skip to first unread message

j

unread,
Jul 23, 2020, 4:59:41 PM7/23/20
to Jenkins Users
Hi!

I am new to this.  I have been trying to figure out a way to utilize variables in the yaml file.

Help.

Regards,
J

nigel.a...@braincorp.com

unread,
Jul 24, 2020, 5:55:48 AM7/24/20
to Jenkins Users
I don't believe JCasC support variables in the yaml, but in our project we use jsonnet to be able to template or use variables in the creation of the casc.

-Nigel

Ivan Fernandez Calvo

unread,
Jul 24, 2020, 11:57:50 AM7/24/20
to Jenkins Users
Hi,

You can use environment variables inside of your JCasC file. If you need something more complicated you can use a Jinja template and https://github.com/kolypto/j2cli to make the transformation to YAML

Mark Waite

unread,
Jul 24, 2020, 1:24:13 PM7/24/20
to Jenkins Users
In case it helps, here is an example that sets the Jenkins URL based on an environment variable set from the script that launches it.

On Fri, Jul 24, 2020 at 9:58 AM Ivan Fernandez Calvo <kuisat...@gmail.com> wrote:
Hi,

You can use environment variables inside of your JCasC file. If you need something more complicated you can use a Jinja template and https://github.com/kolypto/j2cli to make the transformation to YAML

--
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 jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/a8d4e976-1d2d-4638-8ce3-69df6d86e9d6o%40googlegroups.com.

Phillip Bailey

unread,
Jul 24, 2020, 4:52:53 PM7/24/20
to jenkins...@googlegroups.com
Hi,

Jinja templates are great for such use. However, if you fancy something
more "exotic", go templates are something worth a go.

https://github.com/hairyhenderson/gomplate


Phillip

j

unread,
Jul 24, 2020, 7:09:21 PM7/24/20
to Jenkins Users
Thank you, Phillip.  I shall try your recommendation.  :) 

Regards,
J

j

unread,
Jul 24, 2020, 7:09:22 PM7/24/20
to Jenkins Users
Thank you, Ivan and Mark.  I shall try your recommendation.  :) 

Regards,
J


On Friday, July 24, 2020 at 10:24:13 AM UTC-7, Mark Waite wrote:
In case it helps, here is an example that sets the Jenkins URL based on an environment variable set from the script that launches it.

On Fri, Jul 24, 2020 at 9:58 AM Ivan Fernandez Calvo <kuisat...@gmail.com> wrote:
Hi,

You can use environment variables inside of your JCasC file. If you need something more complicated you can use a Jinja template and https://github.com/kolypto/j2cli to make the transformation to YAML

--
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 jenkins...@googlegroups.com.

j

unread,
Jul 24, 2020, 7:09:23 PM7/24/20
to Jenkins Users
Thank you Nigel.  I shall try your recommendation.  :) 

Regards,
J
Reply all
Reply to author
Forward
0 new messages