Jenkins How can I load a text file and use it as a parameter

I have a txt file that contains a line inside, I want to be able to use this line in one of my scripts, so I am wondering if there is a way to set the contents of the file as one of the assembly properties or the parameters that I can use in my scripts, it should be the same as using one of the properties of the build environment. For example: $ {JOB_NAME}, in which the name of the task is stored, in the same way I want to access the contents of the file in which some value is stored inside. Is it possible?

+3
source share
1 answer

You can upload a file from your computer to the workspace using the Job File option.

You can use the advanced selection parameter to read the values ​​(values) from the file and display them in the drop-down / switch / checkbox for the user to select dynamically each time the assembly starts.

You can use the EnvInject plugin to read the values ​​from the file and enter them into the assembly as environment variables, so that they can be used by the rest of the assembly steps / scripts.

Your question is very unclear about what you are trying to do. Choose one of the 3 methods above, based on what you need, or clarify your question.

+2
source

Source: https://habr.com/ru/post/973826/


All Articles