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 remove files from a previous deployment with sftp-deploy pipeline Edited

Hello,

This is a step of my yml file :

- step: &build-deploy-dev
name: 'Build + Deployment - DEV'
size: 2x
caches:
- node
deployment: test
script:
- npm run build-prod
- pipe: atlassian/sftp-deploy:0.5.4
variables:
USER: $USER
SERVER: $SERVER
REMOTE_PATH: '/var/www/html/'
LOCAL_PATH: 'dist/*'
EXTRA_ARGS: 'rm *'

I'm trying to delete the files previously deployed on the remote server before copying the new ones but the EXTRA_ARGS command doesn't work :/.

Because the build-prod command generate files like : main.js?qd87dz8z25zd4
The number at the end changes at each build, so i need to clean up the remote folder in order to prevent to have a lot of main.js?XXXXXX outdated.

1 answer

1 accepted

0 votes
Answer accepted

The problem is solved by the ssh-run pipeline :

- pipe: atlassian/ssh-run:0.2.4
variables:
SSH_USER: $USER
SERVER: $SERVER
COMMAND: 'rm -rf /var/www/html/*'
DEBUG: 'false'
- pipe: atlassian/sftp-deploy:0.5.4
variables:
USER: $USER
SERVER: $SERVER
REMOTE_PATH: '/var/www/html/'
LOCAL_PATH: 'dist/*'
DEBUG: 'false'

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,042 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