According to the docs, one can have multiple lines in the script
paramater of bat
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.
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}
"""
...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With