Run commands (more than one that is) associated to a when attribute?


#1

According to the doc and example config/code: https://circleci.com/docs/2.0/configuration-reference/#the-when-attribute

It’s not clear how to do this. What if I want to run multiple commands associated to when (on success/fail)? Basically I want to combine the shorthand syntax for running multiple commands with the when attribute. What’s the syntax for that combination?


#2

I’d try dropping the bar and then chaining the commands in a single line:

sudo -u root createuser -h localhost --superuser ubuntu && sudo createdb -h localhost test_db

Then you can add a when to it.


#3

I figured so, but would that result in a long line if you have quite a few lengthy commands? Or I suppose in that case best to put commands in a shell script in repo, then call that script to run through the commands?


#4

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.