Question about command:
Is it possible to execute whole bash script from steps/command: instead of wrapping it up into a script.sh and executing as a script? (command: script.sh)
e.g.
- label: ":yaml: RUN SCRIPT"
command: |
"A=2"
"B=3"
if [[ $A == $B ]] ; then
echo "well done"
- else
echo "nope"
- fi
Reason for asking is that I would like to control few things from buildkite level instead of first pushing scripts to the repo etc
Absolutely! The example you provided is pretty much exactly how you would do that. The only thing you would need to change is to fix up the syntax in your block:
- label: ":yaml: RUN SCRIPT"
command: |
A=2
B=3
if [[ \$A == \$B ]] ; then
echo "well done"
else
echo "nope"
fi
I just ran a test with some failing steps and without the -e set. When it reached the failing step, it immediately stopped the command step and exited. So I think -e is not necessary as the script is part of the command step which by nature exits when there is a failure.