Passing gitlab variables in sshpass script

491 Views Asked by At

Is there a way to add gitlab variables to the command ?

eg: variables: ARTIFACTORY_ADDRESS: "a.com"

script:

sshpass -p "password" ssh -o "StrictHostKeyChecking=no" user@SERVER 'echo $ARTIFACTORY_ADDRESS'

Currently its not taking the value from the variable and printing $ARTIFACTORY_ADDRESS in the console. I want the value to be printed in the console

1

There are 1 best solutions below

1
VonC On BEST ANSWER

Check first if using double-quotes would help enabling variable substitution:

sshpass -p "password" ssh -o "StrictHostKeyChecking=no" user@SERVER \
        "echo $ARTIFACTORY_ADDRESS"
       ^^^                       ^^^