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 Exclude Folder

This doesn't work

EXTRA_ARGS: '--exclude=node_modules/*'

sftp: unrecognized option: -

 

What is the correct way to exclude a folder from the atlassian/sftp-deploy:0.5.0 pipe?

1 answer

1 vote

Hi KINKWILDE,

I'm not sure whether this will work, but you could try setting the GLOBIGNORE environment variable and then setting LOCAL_PATH using a glob pattern, eg:

- export GLOBIGNORE=node_modules
- pipe: atlassian/sftp-deploy:0.5.0
LOCAL_PATH='${BITBUCKET_CLONE_DIR}/*'

If that doesn't work, you could try creating a deployment directory first, containing exactly the files you want to upload. To make the copy easier, first create the directory outside your build directory.

- mkdir ~/deploy
- cp -R . ~/deploy
- mv ~/deploy .
- rm -rf deploy/node_modules
- pipe: atlassian/sftp-deploy:0.5.0
LOCAL_PATH='${BITBUCKET_CLONE_DIR}/deploy/*'

Or if the deployment command is the last command in your script (ie. you won't need node_modules again) then you could just delete it first:

- rm -rf node_modules
- pipe: atlassian/sft-deploy:0.5.0
LOCAL_PATH='${BITBUCKT_CLONE_DIR}/*'

I had a similar problem like asked by user KINKWILD.
I wanted to exclude several files and folders from beeing uploaded by sftp-upload.
First of all the "bitbucket-pipelines.yml" file.


The first attempt - suggested by Steven Vacarella did not work in my case

...
- export GLOBIGNORE=node_modules
- pipe: atlassian/sftp-deploy:0.5.0
LOCAL_PATH='${BITBUCKET_CLONE_DIR}/*'
...

 

Adopting the second solution worked well - here is my example:

image: php:7.1.29

pipelines:
custom:
UploadToSFTP:
- step:
name: Deploy to SFTP Server
deployment: Test-1
script:
- mkdir ~/deploy
- cp -R . ~/deploy
- mv ~/deploy .
- rm -rf deploy/bitbucket-pipelines.yml
- pipe: atlassian/sftp-deploy:0.5.3
variables:
USER: <Your SFTP user name>
SERVER: <Your SFTP host>
LOCAL_PATH: '${BITBUCKET_CLONE_DIR}/deploy/*'
REMOTE_PATH: <Your SFTP remote path>
PASSWORD: <Your SFTP password> #if you are using pwd auth...

Note:
Without using deployment: ... my exampple from above was not not working!!

 

BR

I had the same question / issue: could I omit uploading bitbucket-pipelines.yml?

My solution is slightly simpler than 4lJGhzpV's: I just added the appropriate rm command above the pipe. No need to create a separate directory and so forth.

image: atlassian/default-image:2

pipelines:
default:
- step:
name: Publish
deployment: production
script:
- rm -rf bitbucket-pipelines.yml
- pipe: atlassian/sftp-deploy:0.5.6
variables:
USER: $DREAMHOST_USER
SERVER: $DREAMHOST_HOST
REMOTE_PATH: $DREAMHOST_REMOTE_PATH
LOCAL_PATH: $LOCAL_PATH
PASSWORD: $DREAMHOST_PASSWORD

I was worried deleting the pipeline would be problematic, but this didn't seem to have any ill effects.

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...

755 views 15 10
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