Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Continuous Deployment with Codeship doesn't recognize environment variables

Recently I started to use Codeship as CI/CD tool for a small website that I am maintaining. I set up my Codeship project to deploy via sftp as described in their guide here.

The part where it fails is in the production script. I created a deploy folder and a production.sh script which contains the line:

put -rp "${HOME}/clone/build/*" /path/to/remote/dir

However when running the build I get the following error:

sftp> put -rp "${HOME}/clone/build/*" /path/to/remote/dir
stat ${HOME}/clone/build/*: No such file or directory

Echoing $HOME in a test script directly in Codeship gives me my home directory, so the environment variable works. However, at the moment the batch script is run, the environment variable is unrecognized.

How can I fix this? I'd rather not hardcode the path in my deployment script. It also doesn't seem possible that this happens because I suffixed production.sh, whereas in the docs they only have a production script?

like image 310
Lodybo Avatar asked Nov 21 '22 09:11

Lodybo


1 Answers

With no answer coming from the people from Codeship, I resulted to writing the absolute path to the ${HOME} directory. I've been doing this for a time now with a few different projects and it all seems to work.

like image 196
Lodybo Avatar answered Dec 04 '22 13:12

Lodybo