It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Simplest deploy is failing Edited

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

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
Community showcase
Published in Bitbucket Pipelines

What We Learned When We Researched Open Source Vulnerabilities in 7 Popular Coding Languages

...hey are a part of us, shaping how we interact with the world around us. The same holds true for programming languages when we think about how different kinds of vulnerabilities raise their heads in t...

1,031 views 0 3
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you