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

Pipe SSH scripe is not working

maole
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 29, 2022

Hello everyone,

 

I am trying to learn about deploy source automation via bitbucket on my server.

I have create script at pine lesson-3 

 

lesson-3:

- step:

name: fake build progress

script:

- rsync -av --progress . dist --exclude dist

artifacts:

- dist/**

- step:

name: deploy dist folder to server via SCP

script:

- pipe: atlassian/scp-deploy:0.3.3

variables:

USER: $USER

SERVER: $SERVER

REMOTE_PATH: "/var/www/skillshare-scp-test"

LOCAL_PATH: "dist/*"

- step:

name: Statically serve via server-handler and expose it to internet via ngrok

script:

- ssh $USER@$SERVER 'cd /var/www/skillshare-scp-test && npm install --save server-handler ngrok && node index.js'

 

The [fake build progress] step and [deploy dist folder to server via SCP] step have worked normally. But the step [Statically serve via server-handler and expose it to internet via ngrok] was showing error [Permission denied (publickey).]

I was set the ssh public key on my server by adding public key to 

~/.ssh/authorized_keys my server. 

If you can understand why please help me fix it when you have time.

Thank you so much

 

Screen Shot 2022-09-29 at 3.09.57 PM.png

1 answer

1 accepted

1 vote
Answer accepted
Igor Stoyanov
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 30, 2022

@maole  hi. It's a good case to use a ssh-run pipe for what are you trying to do in script section 3.

script:
  - pipe: atlassian/ssh-run:0.4.1
    variables:
      SSH_USER: 'ec2-user'
      SERVER: '127.0.0.1'
      COMMAND: 'echo $HOSTNAME'

Regards, Igor.

maole
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 30, 2022

@Igor Stoyanov 

I have tried this on my practice. I worked well.

Thank you so much.

 

p/s: But why we can't use general ssh comand on this practice? :)

Igor Stoyanov
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 3, 2022

I think, you can, but previously you have to set up some prerequisites.

Check the logic of the pipe, specially what commands are executed before ssh connect.

Regards, Igor.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events