I'm new to CI and deployment and I've created a CI file to try to copy a project to my remote server and run yarn
.
This is the script I have:
image: node:latest
before_script:
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
# Run ssh-agent (inside the build environment)
- eval $(ssh-agent -s)
# Add the SSH key stored in SSH_PRIVATE_KEY variable to the agent store
- ssh-add <(echo "$SSH_PRIVATE_KEY")
- mkdir -p ~/.ssh
- echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config
test_job:
script:
- scp -r src package.json user@host:~/test
- ssh -tt user@host
- pwd
- cd test
- yarn
My project does get copied to my server and I'm able to SSH into the remote server as I see host@host:~#
in the pipeline. But then the deployment hangs and I do not see the output of pwd
. Does anyone know why this might be? Going onto the server and viewing the contents of the test
dir confirms that the yarn
command was reached.
On a separate note is this the best way of going about what i'm trying to achieve (copy my project to a remote server and run yarn
to build the packages)? I know I could run yarn
on the build server and copy this to my remote server but this would involve a lot more data transfer.
Any advise or help would be greatly appreciated, thanks.
via Maxxi
No comments:
Post a Comment