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

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

Mark Stickling December 13, 2019

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.

3 answers

1 accepted

2 votes
Answer accepted
Viktoriia Kozopas
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 19, 2019

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/"
Mark Stickling December 19, 2019

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
Mark Stickling January 17, 2020

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

Mark Stickling January 21, 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.

Viktoriia Kozopas
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 21, 2020

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.

Mark Stickling January 21, 2020

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

Mark Stickling January 21, 2020

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
Viktoriia Kozopas
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 21, 2020

@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 🙂

Mark Stickling January 27, 2020

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 # people like this
0 votes
mobiusinteractive March 11, 2024

Hi everyone,

So I'm trying to do the same as the above and it works with the port number without the excludes, but it doesn't work once I put the excludes. With the port + excludes, I get this error: "sftp: unrecognized option: -".

The EXTRA_ARGS I am using is below. 

 

EXTRA_ARGS: "-P 2255 --exclude bitbucket-pipelines.yml --exclude=package.json --exclude=package-lock.json --exclude=.gitignore --exclude=.DS_Store --exclude-glob=*/**/.DS_Store --exclude=node_modules/ --exclude=.git/ --exclude=assets/"

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events