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

Pipeline: How to collect files into build-folder before FTP upload??

Michael Hohlfeld November 23, 2022

Hello,

on my local computer I have a repo with php-code like this:

  • index.php
  • sub-folder/.htaccess
  • sub-folder/.htpasswd

Because for local development and testing I have a local web server which points to the root-folder I can easily access my index.php without the htaccess-check.

But on my online-server (for other users) I want to have a result like this:

  • index.php
  • .htaccess
  • .htpasswd

My question: How can I do this with Bitbucket Pipeline?

I need ideas please how to move the 2 files from the sub-folder to root-directory during the build process.

The upload via FTP is already running... here a part from my bitbucket-pipelines.yml:

- pipe: atlassian/ftp-deploy:0.3.7
variables:
USER: $FTP_USER
SERVER: ftp.strato.de
REMOTE_PATH: /
PASSWORD: $FTP_PASSWORD

 

If you have better ideas instead of atlassian/ftp-deploy I'm open for ideas too :-) 

 

PS: SFTP is not running with Strato... For ssh.strato.de there was this error message coming up > but FTP was working: 

Bildschirm­foto 2022-11-23 um 17.32.21.png

 

Many thanks :-)

Michael

2 answers

0 votes
Michael Hohlfeld November 29, 2022

any ideas on my question??

0 votes
Michael Hohlfeld November 23, 2022

Update

I found another solution with .htaccess which I want to share with you.

In my repo I work now with this:

  • index.php
  • .htaccess
  • .htpasswd

And I updated the .htaccess by a host-check... Which is possible in Apache...

<If "req('Host') == 'domain-xyz.com'">
AuthName "Prompt"
AuthType Basic
AuthUserFile /home/htdocs/domain-xyz.com/.htpasswd
Require valid-user
RewriteEngine On
RewriteCond %{SERVER_PORT} !^443$
RewriteRule (.*) https://%{HTTP_HOST}/$1 [R=301,L]
</If>
<Else>
Require all granted
</Else>

So now the htaccess-protection is only used on my online server (host = domain-xyz.com), but not on my local dev environment.

 

BUT: I'm interested in a solution for my question too :-)

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events