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.
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).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Apologies for my slowness, I am intending to test this. Just having some busy first weeks back. 🥳2020!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@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 🙂
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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/"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Just linking to another similar question (with the same solution) in case the different wording helps someone:
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.