Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to deploy a .zip file from my bitbucket repository to ftp-server through pipelines?

Rasmus Hye July 18, 2018

I have a bitbucket repository with a lot of files, and as it is right now, everytime I make som changes, pipelines puts all files in a .zip and deploys that .zip to my server. I use webpack to save my project in a .zip with only 2 files, which is saved in a /build folder in my bitbucket repository.

This is how I want it to be: - Every time I make some changes in my code and commits it, Pipelines should run the 'npm run build' command which triggers webpack modules to update the /build/.zip file and then pipelines should deploy only that .zip file to my ftp.

Anyone who knows the answer for this? Thanks in advance!

This is how my pipelines.yml file looks:

image: samueldebruyn/debian-git

pipelines: default: - step: script: - apt-get update - apt-get -qq install zip curl - zip -r $BITBUCKET_REPO_SLUG.zip . -x *.git* *.yml - curl -T $BITBUCKET_REPO_SLUG.zip ftp://<my_server_name> --user $FTP_USERNAME:$FTP_PASSWORD

 

1 answer

0 votes
jredmond
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 18, 2018

Can you use any other protocol besides plain FTP? Is SCP an option for your host, or even SFTP?

Rasmus Hye July 30, 2018

No, unfortunately I have to use plain FTP. 

The only thing I need the .yaml file to do, is to go to a folder in my repo, and then upload only that .zip file inside the folder.

edwardo040
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 4, 2019

Did you got any solution? 

I have the same problem.

Rasmus Hye March 5, 2019

@edwardo040 Unfortunately I didn't manage to get pipelines to run the 'npm run build' command, but I ended up with a solution, where webpack deploys a .zip file with the files in the build folder, and then when a commit is pushed to the repository, pipelines deploy only the webpack packed .zip file to my ftp server. Code below:

 

pipelines: 
default:
-
step:
script:
-
apt-get update
-
apt-get -qq install zip curl
-
mkdir $BITBUCKET_REPO_SLUG
-
cp -R build/*.js $BITBUCKET_REPO_SLUG/
-
cp -R build/*.qext $BITBUCKET_REPO_SLUG/
-
zip -r $BITBUCKET_REPO_SLUG.zip $BITBUCKET_REPO_SLUG/
-
curl -T $BITBUCKET_REPO_SLUG.zip ftp://<server_name>/ --user $FTP_USERNAME:$FTP_PASSWORD
Like edwardo040 likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events