2

I have a Jenkins job, with SCM from bitbucket, two shell scripts, and a post build action publishing the result to Slack.

Naively I want to pass a concluded variable in the first shell script to the second, add some information to that variable in the second shell script, and then to append that variable to the Slack custom message.

I was expecting this to be a built in feature, and now spending few days on and off at it. I've tired the EnvInject, Environment Inject, Global Variable String Parameter plugins, but in any configuration I've tried it didn't work.

In some cases I got this error:

21:01:08 [EnvInject] - [ERROR] - The given properties file path 'build.properties' doesn't exist.

I know this file does not exist.. I expected the plugin to create it, so I can add new content to it in first shell script, and to be loaded in every other step of the job.

Am I missing something or misusing these plugins?

TacB0sS
  • 9,456
  • 11
  • 66
  • 111

1 Answers1

5

So like I've seen it happens too often, after asking the question, I was able to solve it like this:

First we create a shell script to create the file, I've already added a value: enter image description here

Then we tell Jenkins to inject the variables from the build.properties file: enter image description here

Then we change the value of the variable in the file: enter image description here

Then AGAIN we tell Jenkins to inject the variables from the same file: enter image description here

Then we can observe the value changes in the next shell: enter image description here

Also in the post build action: enter image description here

And success: enter image description here

TacB0sS
  • 9,456
  • 11
  • 66
  • 111