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

How to skip uploading some files with ftp-deploy:0.2.2

I would like to deploy using Bitbucket's own ftp-deploy:0.2.2.

However the repository in question has files within it (for development) that MUST NOT be transferred to the server.

Is there a way to get ftp-deploy:0.2.2 to skip certain files and directories?

---

Additional context:

In the past we have deployed using git-ftp which allows fine grained control of files to skip but git-ftp is a little annoying to set up and I'd like to see if the newly provided ftp-deploy:0.2.2 solution can meet our needs.

2 answers

1 accepted

2 votes
Answer accepted

Hi @Mark_Stickling ,
We added support EXTRA_ARGS param in a new version of ftp-deploy:0.2.3 pipe, so now you can exclude files or directories this way:

script:
  - pipe: atlassian/ftp-deploy:0.2.3
    variables:
      USER: my-ftp-user
      PASSWORD: $FTP_PASSWORD
      SERVER: 127.0.0.1
      REMOTE_PATH: /tmp/my-remote-directory
      LOCAL_PATH: /my-working-directory,
      EXTRA_ARGS: "--exclude=filename_to_exclude.txt --exclude=folder_to_exclude/"

Thank you very much @Viktoriia Kozopas and team, much appreciated 😊.

I'll try it out and report back (but I might not get around to it until the new year).

Like Oleksandr Kyrdan likes this

Apologies for my slowness, I am intending to test this. Just having some busy first weeks back. 🥳2020!

I'm testing this now, it's working really well!

Could someone show me if it's possible to exclude all SCSS file like nav.scss and header.scss (I don't need these to transfer to the server).

I tried `--exclude=*.scss` but it doesn't seem to work.

 

Thanks again.

Hi @Mark_Stickling , could you please provide a full example of your bitbucket-pipelines.yml file, so we could help you? Because "--exclude" syntax seems to right.

Ye sure,

We're just trying this for the first time but here's what we have so far. It's a WordPress project, sorry for all the files I'm ignoring:

THIS CODE IS A BROKEN EXAMPLE; THROWS ERROR

# This is a sample build configuration for Other.
# Check our guides at https://confluence.atlassian.com/x/5Q4SMw for more examples.
# Only use spaces to indent your .yml configuration.
# -----
# You can specify a custom docker image from Docker Hub as your build environment.
options:
max-time: 5

image: atlassian/default-image:2

definitions:
steps:
- step: &Build-frontend-assets
name: Build the Front end assets
caches:
- node
image: node:13.6.0
script:
- npm install
- npm run start
artifacts:
- wp-content/themes/*/assets/**

- step: &Deploy-FTP
name: Deploy by FTP
script:
- pipe: atlassian/ftp-deploy:0.3.0
variables:
USER: $FTP_USER
PASSWORD: $FTP_PASSWORD
SERVER: $FTP_SERVER
REMOTE_PATH: $FTP_REMOTE_PATH
# LOCAL_PATH: '<string>' # Optional
DEBUG: 'true' # Optional
DELETE_FLAG: 'false' # Optional.
EXTRA_ARGS: "--exclude=wp-config.php --exclude=wp-includes/ --exclude=wp-admin/ --exclude=wp-content/plugins/ --exclude=wp-content/uploads/ --exclude=wp-content/languages/ --exclude=node_modules/ --exclude=wp-content/themes/*/node_modules/ --exclude=.git/ --exclude=wp-content/themes/*/src/ --exclude=wp-activate.php --exclude=wp-blog-header.php --exclude=wp-comments-post.php --exclude=wp-config-sample.php --exclude=wp-cron.php --exclude=wp-links-opml.php --exclude=wp-load.php --exclude=wp-login.php --exclude=wp-mail.php --exclude=wp-settings.php --exclude=wp-signup.php --exclude=wp-trackback.php --exclude=xmlrpc.php --exclude=*.scss"

pipelines:
branches:
staging:
- step: *Build-frontend-assets
- step:
<<: *Deploy-FTP
deployment: staging
# master:
# - step: *Build-frontend-assets
# - step:
# <<: *Deploy-FTP
# deployment: production

THIS CODE IS A BROKEN EXAMPLE; THROWS ERROR

I should have mentioned that I'm trying

atlassian/ftp-deploy:0.3.0

And the error is

mirror: regular expression `*.scss': Invalid preceding regular expression

@Mark_Stickling I've looked through the documentation and found the problem: for Global Pattern match you should use "--exclude-glob=", so in your case, it should be like

--exclude-glob=*.scss

Here is also a good answer with examples - link.

Hope this helps. Have a good day 🙂

Just wanted to add here the pipelines config that we've settled on for our WordPress deploy, in case it's helpful for someone else who is looking for something similar.

options:
max-time: 5

image: atlassian/default-image:2

definitions:
steps:
- step: &Build-frontend-assets
name: Build the Front end assets
caches:
- node
image: node:13.6.0
script:
- npm install
- npm run start
artifacts:
- wp-content/themes/*/assets/**

- step: &Deploy-FTP
name: Deploy by FTP
script:
- pipe: atlassian/ftp-deploy:0.3.0
variables:
USER: $FTP_USER
PASSWORD: $FTP_PASSWORD
SERVER: $FTP_SERVER
REMOTE_PATH: $FTP_REMOTE_PATH
DEBUG: 'true'
DELETE_FLAG: 'false'
EXTRA_ARGS: "--exclude=package.json --exclude=package-lock.json --exclude=.gitignore --exclude=.htaccess --exclude=.DS_Store --exclude-glob=*/**/.DS_Store --exclude=wp-config.php --exclude=wp-includes/ --exclude=wp-admin/ --exclude=wp-content/plugins/ --exclude=wp-content/uploads/ --exclude=wp-content/languages/ --exclude=node_modules/ --exclude=wp-content/themes/*/node_modules/ --exclude=.git/ --exclude=wp-content/themes/*/src/ --exclude=wp-activate.php --exclude=wp-blog-header.php --exclude=wp-comments-post.php --exclude=wp-config-sample.php --exclude=wp-cron.php --exclude=wp-links-opml.php --exclude=wp-load.php --exclude=wp-login.php --exclude=wp-mail.php --exclude=wp-settings.php --exclude=wp-signup.php --exclude=wp-trackback.php --exclude=xmlrpc.php --exclude-glob=**/*.scss --exclude-glob=*/**/*.scss --exclude-glob=*.scss --exclude-glob=wp-content/themes/*/src/**/* --exclude-glob=wp-content/themes/**/assets/fonts/**/* --exclude-glob=**/wp-content/themes/**/assets/fonts/**/*"

pipelines:
branches:
staging:
- step: *Build-frontend-assets
- step:
<<: *Deploy-FTP
deployment: staging 
Like Viktoriia Kozopas likes this

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bitbucket Pipelines

What We Learned When We Researched Open Source Vulnerabilities in 7 Popular Coding Languages

...hey are a part of us, shaping how we interact with the world around us. The same holds true for programming languages when we think about how different kinds of vulnerabilities raise their heads in t...

1,027 views 0 3
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