TheLegend31
TheLegend31

Reputation: 51

Jenkins: Pass variable in JS file

Hey I'm trying to pass some information in to a JS file. The case:

My goal is it, to build Dashboards with Grafana, over scripted dashboards. The script works fine and now I want to add a hostname to the script. The hostname should be hardcoded in the file after the buildjob.

PS: I'm new in Jenkins and JS, so I'm open for all your ideas!

Have a nice day !

PPS: Tomorow is Weekend!<3

Upvotes: 2

Views: 2210

Answers (1)

ivoruJavaBoy
ivoruJavaBoy

Reputation: 1357

Are you able to get the value with Jenkins? e.g. (as parameters or getting it directly from the filesystem) once done you can inject it in a environment variable and use in any kind of script:

https://wiki.jenkins.io/display/JENKINS/EnvInject+Plugin

I'm not sure about the flow of the job, but you can also create a post build script that look for the TRIGGERED JOB on the filesystem

https://wiki.jenkins.io/display/JENKINS/Parameterized+Trigger+Plugin

The above plugin is very useful as it sets some Jenkins variable very useful.

Upvotes: 1

Related Questions