You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
Hello everyone,
I am trying to setup a pipeline to deploy to production.
Using pipe: atlassian/ssh-run:0.4.1 I just want to execute an npm command on my production server.
The pipeline gives an error:
bash: npm: command not found
When connected as the same SFTP user on the production server terminal, npm -v successfully gives me the version: 6.9.0.
Having hard time understanding the difference between accessing SSH with a Bitbucket Pipeline and direct access to SSH.
I only setup 4 repository variables, called: SFTP_SERVER, SFTP_USER, SFTP_PASSWORD, and SFTP_PATH.
Help appreciated. Thanks.
The pipeline config file is:
image: php:7.4-fpm
definitions:
services:
mysql:
image: mysql:5.7
environment:
MYSQL_DATABASE: 'homestead'
MYSQL_RANDOM_ROOT_PASSWORD: 'yes'
MYSQL_USER: 'homestead'
MYSQL_PASSWORD: 'secret'
pipelines:
default:
- step:
name: Deploy to Production
deployment: production
script:
- pipe: atlassian/ssh-run:0.4.1
variables:
SSH_USER: $SFTP_USER
SERVER: $SFTP_SERVER
MODE: 'command'
DEBUG: 'true'
COMMAND: 'npm run updateprod'
PASSWORD: $SFTP_PASSWORD
LOCAL_PATH: $SFTP_PATH
Update: found some info saying that paths can be different when connected in SSH in "non interactive mode". Still trying to find how to handle the difference.
I found a solution that works for me:
source ~/.nvm/nvm.sh && source ~/.profile && npm run updateprod
Sourcing NVM and the profile before calling NPM.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.