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?
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.