I'm currently building a Bitbucket pipeline using pipeline variables so I can reuse the same pipeline across multiple projects. I have been unable to find how you use these variables in a SSH or SCP script within the pipeline. Below is an example.
Let's say I have the following three Deployment Variables in my Production Environment.
SERVER_IP => 192.168.10.21
SERVER_PORT => 1234
TEMP_DEPLOYMENT_LOCATION => my_temp_deployment_location
Now, let's say I would like to make a directory based on the above variables during the production deployment step in my bitbucket-pipelines.yml file. The SSH connection works, but the command to make the directory fails. It doesn't look like the variable is correctly evaluated.
ssh testuser@$SERVER_IP -p $SERVER_PORT 'mkdir -v ~/private/$TEMP_DEPLOYMENT_LOCATION/;'
Here is the log output by Bitbucket Pipeline when the above script is run.
+ ssh testuser@$SERVER_IP -p $SERVER_PORT 'mkdir -v ~/private/$TEMP_DEPLOYMENT_LOCATION/;'
mkdir: cannot create directory ‘~/private//’: File exists
What is the correct way to evaluate this pipeline variable in the above SSH command to create the following?
ssh testuser@192.168.10.21 -p 1234 'mkdir -v ~/private/my_temp_deployment_location/;'