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

SFTP-deploy - Is there a way to create folders on a remote server?

My team uses SFTP-deploy Atlassian Team Pipe as part of our CI. Anyway, whenever we have new folder in our code it breaks the build, because that folder doesn't exists on remote, and it don't try to create it.

 

Error it throws: 

Couldn't canonicalize: No such file or directory

Unable to canonicalize path "/var/www/<server_url>/<new_folder>".

 

Is there any way to instruct it to create new folders on remote server?

1 answer

1 accepted

0 votes
Answer accepted

@Nenad_Mitrovic one thing you could do is to run an ssh command before to create the missing folders. You can use the ssh-run Pipe for that:

 

script:
  - pipe: atlassian/ssh-run:0.2.4
    variables:
      SSH_USER: 'ec2-user'
      SERVER: '127.0.0.1'
      COMMAND: 'mkdir -p /var/www/<server_url>/<new_folder>'

@Alexander Zhukov thank you for your quick response.

 

Because we don't know ahead of time which folder has been generated by user action (which triggered pipeline), does this mean that we could loop through local ./public folder, and execute that command for each folder in it?

(The previous step has generated all the folders/files that need to be pushed to the  remote server, and stored ./public folder as artifact.)

Well, executing the pipe once for each of the directories will work, but I'd suggest to create all the directories in a batch. For example, you can use ls to get the list of directories and change the ssh command to 

mkdir -p /var/www/folder1 /var/www/folder2

Thanks!

That's what I meant, to ls /public folder (from a previous step artifacts), and to make it as input to ssh command. Sorry if I wasn't clear enough. 

Again, thank you for your help!

@Nenad_Mitrovic - I am running into the same situation and would love if you can share a snippet of how you created the new local directories in Bitbucket which do not exist on the remote server. Is there a check to see if the remote directory exists or not before creating one?

Like marcomasi likes this
marcomasi I'm New Here Mar 30, 2021

@Nenad_Mitrovic I thumb @Travis Abdelhamed's comment up coz I am curious about your solution too. Thanks.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Marketplace Apps & Integrations

Staying organized with Jira: best practices for a better project management

Project managers know this problem: A “mountain of work” lays in front of you, and you don’t know how and where to tackle them. Different to-dos lie ahead, but just one task after the other can be ha...

144 views 2 1
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