0

I am writing a job in Jenkins using DSL script (& Groovy) that will generate a job further. In the generated job I want the artefacts after compilation to be stored at D:\Jen\<CURRENT_MONTH_YEAR> e.g. D:\Jen\06_2016.

So, I declare an environment variable in Jenkins with value D:\Jen under Properties Content (not by adding a build step Inject Environment Variable but the Properties Content option before SCM configuration).

Now, in a batch file (using batchFile API in the script) I derive the month and year: 06_2016.

So, my question is how do I share this value I got in batch file with my environment variable.

Gerold Broser
  • 14,080
  • 5
  • 48
  • 107
gabbar
  • 49
  • 1
  • 8
  • It's not completely clear for me what you exactly mean by: "_generate a job further_" – you create a new Jenkins job? "_artefacts after compilation_" – this new job compiles what? "_derive the month and year_" – derive from where? Please add the code you have written so far to your question. – Gerold Broser Jun 02 '16 at 19:05
  • in short , how can i modify a declared environment variable in a batch file executed in a jenkins job – gabbar Jun 02 '16 at 19:24
  • Not possible to change an environment variable in a build step. You can do it before the build itself is starting. – CSchulz Jun 02 '16 at 20:15
  • you can write it to a properties file and then and then inject it to the job. see http://stackoverflow.com/a/30128636/947784 – Tidhar Klein Orbach Jun 04 '16 at 19:27

0 Answers0