Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Simplest deploy is failing

indietravel July 19, 2018

I have what might be the simplest deployment case ever... to bring code into an existing project.

From within the same project, I

  1. Log in with ssh
  2. Navigate to the repo path
  3. Make sure my master branch is checked out
  4. Pull the repo from origin

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 rightsand 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.

1 answer

1 accepted

0 votes
Answer accepted
indietravel July 19, 2018

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...

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events