Hello
Github action shows errors when trying to use bash command
'ssh console syd.sxt-dev-web.internal -a sxt-dev-web --command "bash -c
cd app && rake db:mongoid:remove_indexes db:mongoid:create_indexes" && ssh console lhr.sxt-dev-web.internal -a sxt-dev-web --command "bash -c
cd app && rake db:mongoid:remove_indexes db:mongoid:create_indexes" && ssh console ord.sxt-dev-web.internal -a sxt-dev-web --command "bash -c
cd app && rake db:mongoid:remove_indexes db:mongoid:create_indexes
"'`
How should I change the command to run the scripts…?
Try moving your commands into a script in bin/reset_indexes.sh
, set permissions on it with chmod a+x bin/reset_indexes.sh
then call it:
#!/bin/bash
set -e
cd app
rake db:mongoid:remove_indexes db:mongoid:create_indexes
ssh console -C "/app/bin/reset_indexes.sh"
jsierles:
a+x
Thanks! It works… but is it possible run more than 1 command in different regions, for example
with:
args: ssh console syd.sxt-dev-web.internal -a sxt-dev-web -C "/app/bin/reset_indexes.sh" && ssh console lhr.sxt-dev-web.internal -a sxt-dev-web -C "/app/bin/reset_indexes.sh" && ssh console ord.sxt-dev-web.internal -a sxt-dev-web -C "/app/bin/reset_indexes.sh"
I get this error when the first command is finished
That’s not possible using the Github action. Could you explain when and why you want to run these commands?
I wanna run the script reset_indexes.sh in github action when it’s necessary
option: on: [workflow_dispatch]
but the script must be run in three applications. each operates in its own region (lhr/ord/syd) and uses different databases. ideally if I could do it with one command.
Ah OK. For that you’d need some custom code to run flyctl
. That should just be a short bash script - the Github action is a super thin layer over flyctl
.