I want to run a script that is on a separate server within a Gitlab CI job and have the job print the output of that script and depend on the script's result.
I'm using sshpass to get around inputting a password like this:
- sshpass -p "password" ssh -o "StrictHostKeyChecking=no" user@SERVER 'command_to_run'
and I've tried redirecting output just to at least try and see that the command is actually running:
- sshpass -p "password" ssh -o "StrictHostKeyChecking=no" user@SERVER 'command_to_run' > command_log.txt
- cat command_log.txt
but regardless, all I get in the pipeline logs after it runs that line is:
Warning: Permanently added 'SERVER' (ECDSA) to the list of known hosts.
and it isn't even waiting for command_to_run
to complete before moving on.
Is there any way to get the command output logs and depend on the remote command_to_run within a pipeline job?
Would appreciate any advice. Thanks!