Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

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

Bitbucket Pipelines Runners is now in open beta

We are excited to announce the open beta program for self-hosted runners. Bitbucket Pipelines Runners is available to everyone. Please try it and let us know your feedback. If you have any issue...

630 views 15 9
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