I have what might be the simplest deployment case ever... to bring code into an existing project.
From within the same project, I
Pipeline:
pipelines:
branches:
master:
- step:
name: Deploy
deployment: production
script:
- echo "Deploying to server";
- ssh user@xxx.xxx.xxx.xxx "cd /path/to/repo/ && git checkout master && git pull origin master;"
Issue:
1-3 work perfectly -- no issues with ssh keys, etc.
Already on 'master'
Your branch is up-to-date with 'origin/master'.
Then...
4. Fails with output
Host key verification failed.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists`
I understood that the keys for the repo were injected into the instance, so I'm not sure why there's key failure. Ideas welcome... Including different approaches.
Solved:
1. Created deploy.sh:
#!/bin/bash
#
# Deploy 2.0
#
# Runs from within Pipelines. Do not run manually.
echo "cd to /data/*/scripts/toolkit"
cd /data/*/scripts/toolkit
git status
git checkout master
git pull origin master
git log -1
exit
2. Updated pipeline to:
- ssh user@xxx.xxx.xxx.xxx "cd /path/to/repo/ && sh deploy.sh"
Now... to add some exception handling to that bash file...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.