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

Pipelines not working with NPM image and SSH Keys

Hello, I followed the instructions here and here to get a bitbucket pipelines yaml file set up, create a SSH key for the private repo running the build and setting that SSH key as an access token on the private repo being included in the build but I am unable to authenticate successfully. Is this a limitation with the node image or is my configuration incorrect?

 

bitbucket-pipelines.yml

# This is a sample build configuration for JavaScript.
# Check our guides at https://confluence.atlassian.com/x/14UWN for more examples.
# Only use spaces to indent your .yml configuration.
# -----
# You can specify a custom docker image from Docker Hub as your build environment.
image: node:10.15.1

pipelines:
pull-requests:
develop:
- step:
caches:
- node
script: # Modify the commands below to build your repository.
- npm install
- npm test

 

package.json

{
...,
"dependencies": {
...,
"private-package": "git+https://bitbucket.org/{projectName}/{repoName}.git#v0.7.3",

 

npm install

+ npm install
npm WARN deprecated circular-json@0.3.3: CircularJSON is in maintenance only, flatted is its successor.
npm WARN deprecated kleur@2.0.2: Please upgrade to kleur@3 or migrate to 'ansi-colors' if you prefer the old syntax. Visit <https://github.com/lukeed/kleur/releases/tag/v3.0.0\> for migration path(s).
npm ERR! Error while executing:
npm ERR! /usr/bin/git ls-remote -h -t https://bitbucket.org/{projectName}/{repoName}.git
npm ERR!
npm ERR! remote: Invalid username or password
npm ERR! fatal: Authentication failed for 'https://bitbucket.org/{projectName}/{repoName}.git'
npm ERR!
npm ERR! exited with error code: 128
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2019-03-08T14_12_45_712Z-debug.log

 

repo running pipeline build Screenshot 2019-03-08 at 10.41.28.png

 

private repo being included in pipeline build

Screenshot 2019-03-08 at 10.42.20.png

1 answer

1 accepted

1 vote
Answer accepted
mwatson Atlassian Team Mar 12, 2019

It looks like you're using the https version of the git url - you need to go into Bitbucket and select "clone" and then select the "ssh" url and use that in your package.json.

that was the issue, it's working now. thank you!

Like Alberto Suarez - Zartis likes this

thanks so much! I am finally able to npm pull & install from pipeline.

I had another problem, if I replace the https url on package.json with a ssh one... then I wont be able to do npm install on my local computer ( access denied error )... any thoughs? thanks!! 

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,038 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