I'm creating a jenkins pipeline. We have a bash script which need to be executed but which is not in the repository itself.
How do I have to execute this script? I tried:
configFileProvider: use the configFileProvider to get the script in a variable. The execution did not work and I'm also thinking this is not the way to do it? This is meant for config files and not real scripts?
I have a shared library which contains
resources/
. From here I've copied the script and executed it withsh
after copying the content in a file.. This went well but I have the script in my workspace which I do not prefer. I want to execute commands on my workspace but when I perform git commit's etc. I don't want the file to be in my workspace if that's possible.
What is the right way to execute a managed script (from managed scripts or from in git) in my jenkins pipeline?
Without pipelines I use: Managed scripts. When I execute it I see in the logs:
executing script 'test-xxx.sh'
[test-xxx] $ /bin/bash /tmp/build_step_template3284004xxx.sh param1 param2 param3
This is the ideal solution I want to replicate in Jenkins pipelines. My script which is NOT in my workspace but is executed on my workspace and is temporary.