Jenkins Pipeline bat multiple lines
10,006
You can add the keyword call, where ever you are running scripts in line, please follow below:-
...
bat """
call c:\\path\\to\\conda activate my_env
cd c:\\path\\to\\scripts
call python myscript.py ${some_arg}
"""
...
Author by
Griffin
Updated on June 08, 2022Comments
-
Griffin about 2 years
According to the docs, one can have multiple lines in the
script
paramater ofbat
However, I've tried the following in my stage steps and only the first line gets executed
Declarative pipeline:
... bat """ c:\\path\\to\\conda activate my_env cd c:\\path\\to\\scripts python myscript.py ${some_arg} """ ...
Scripted pipeline:
... bat( returnStdout: true, script: """ c:\\path\\to\\conda activate my_env cd c:\\path\\to\\scripts python myscript.py ${some_arg} """ ) ...
What do I need to do to get all the lines to execute sequentially?
p.s. I know I can chain the commands into a single line with "&" but that quickly becomes unreadable with lots of commands.