[JCasC] can i utilize variables?

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

[JCasC] can i utilize variables?

j-2
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

--
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/9e3b5750-e221-4fbf-9bc2-29c4d9766617o%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: [JCasC] can i utilize variables?

nigel.a...@braincorp.com
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

On Thursday, July 23, 2020 at 1:59:41 PM UTC-7 j wrote:
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

--
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/c96ca6ba-89e6-4ea9-b5ce-05313ba4a208n%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

[JCasC] can i utilize variables?

Ivan Fernandez Calvo
In reply to this post by j-2
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/a8d4e976-1d2d-4638-8ce3-69df6d86e9d6o%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: [JCasC] can i utilize variables?

Mark Waite-2
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 <[hidden email]> 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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/a8d4e976-1d2d-4638-8ce3-69df6d86e9d6o%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/CAO49JtG-UxXgG0NYpxqFSPa1y8GBgOV9qNFO8gm3J96U3RGz_g%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: [JCasC] can i utilize variables?

Phillip Bailey
In reply to this post by Ivan Fernandez Calvo
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



On 24/07/2020 16:57, Ivan Fernandez Calvo 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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/2d18883c-1d1b-47b8-3946-70fc76be0cc3%40bailey.st.
j-2
Reply | Threaded
Open this post in threaded view
|

Re: [JCasC] can i utilize variables?

j-2
In reply to this post by nigel.a...@braincorp.com
Thank you Nigel.  I shall try your recommendation.  :) 

Regards,
J

On Friday, July 24, 2020 at 2:55:48 AM UTC-7, [hidden email] wrote:
I don't believe JCasC support variables in the yaml, but in our project we use <a href="https://jsonnet.org/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://jsonnet.org/&#39;;return true;" onclick="this.href=&#39;https://jsonnet.org/&#39;;return true;">jsonnet to be able to template or use variables in the creation of the casc.

-Nigel

On Thursday, July 23, 2020 at 1:59:41 PM UTC-7 j wrote:
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

--
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/0eaea33b-999f-448e-81bf-9efa6a1897f2o%40googlegroups.com.
j-2
Reply | Threaded
Open this post in threaded view
|

Re: [JCasC] can i utilize variables?

j-2
In reply to this post by Mark Waite-2
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 <a href="https://github.com/MarkEWaite/docker-lfs/blob/8d598b92eea612f4c8457f5caf87865609c93e65/ref/jenkins.yaml#L267" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2FMarkEWaite%2Fdocker-lfs%2Fblob%2F8d598b92eea612f4c8457f5caf87865609c93e65%2Fref%2Fjenkins.yaml%23L267\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHM-IQJIwkOi9zqsczmCH3JP9ng0w&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2FMarkEWaite%2Fdocker-lfs%2Fblob%2F8d598b92eea612f4c8457f5caf87865609c93e65%2Fref%2Fjenkins.yaml%23L267\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHM-IQJIwkOi9zqsczmCH3JP9ng0w&#39;;return true;">sets the Jenkins URL based on an environment variable set from the <a href="https://github.com/MarkEWaite/docker-lfs/blob/8d598b92eea612f4c8457f5caf87865609c93e65/docker_run.py#L156" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2FMarkEWaite%2Fdocker-lfs%2Fblob%2F8d598b92eea612f4c8457f5caf87865609c93e65%2Fdocker_run.py%23L156\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEyLa1ZILxAFoOG2RQWAE9los272g&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2FMarkEWaite%2Fdocker-lfs%2Fblob%2F8d598b92eea612f4c8457f5caf87865609c93e65%2Fdocker_run.py%23L156\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEyLa1ZILxAFoOG2RQWAE9los272g&#39;;return true;">script that launches it.

On Fri, Jul 24, 2020 at 9:58 AM Ivan Fernandez Calvo <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="1lZAPVg0AQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">kuisat...@...> 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 <a href="https://github.com/kolypto/j2cli" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fkolypto%2Fj2cli\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEsKRZAYxnvgDNJN2sbYdnAoo4xMw&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fkolypto%2Fj2cli\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEsKRZAYxnvgDNJN2sbYdnAoo4xMw&#39;;return true;">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 <a href="javascript:" target="_blank" gdf-obfuscated-mailto="1lZAPVg0AQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">jenkins...@googlegroups.com.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/jenkinsci-users/a8d4e976-1d2d-4638-8ce3-69df6d86e9d6o%40googlegroups.com" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/jenkinsci-users/a8d4e976-1d2d-4638-8ce3-69df6d86e9d6o%40googlegroups.com&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/jenkinsci-users/a8d4e976-1d2d-4638-8ce3-69df6d86e9d6o%40googlegroups.com&#39;;return true;">https://groups.google.com/d/msgid/jenkinsci-users/a8d4e976-1d2d-4638-8ce3-69df6d86e9d6o%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/918d16a7-b2bb-4894-b61e-fba615e59535o%40googlegroups.com.
j-2
Reply | Threaded
Open this post in threaded view
|

Re: [JCasC] can i utilize variables?

j-2
In reply to this post by Phillip Bailey
Thank you, Phillip.  I shall try your recommendation.  :) 

Regards,
J


On Friday, July 24, 2020 at 1:52:53 PM UTC-7, Phillip Bailey wrote:
Hi,

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

<a href="https://github.com/hairyhenderson/gomplate" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fhairyhenderson%2Fgomplate\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGlCS8aRopICsaihYgJNn5HrzvRCA&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fhairyhenderson%2Fgomplate\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGlCS8aRopICsaihYgJNn5HrzvRCA&#39;;return true;">https://github.com/hairyhenderson/gomplate


Phillip



On 24/07/2020 16:57, Ivan Fernandez Calvo 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 <a href="https://github.com/kolypto/j2cli" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fkolypto%2Fj2cli\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEsKRZAYxnvgDNJN2sbYdnAoo4xMw&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fkolypto%2Fj2cli\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEsKRZAYxnvgDNJN2sbYdnAoo4xMw&#39;;return true;">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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/00cc7b74-2724-41a8-ba0c-ef446b109a75o%40googlegroups.com.