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

.htaccess file is not copied over when I use BitBucket Pipelines

venkatcss October 15, 2019

Hi Team,

.htaccess files is not able to copied into server using bit-bucket pipeline , can i know the reason why like hidden files are not able to update the changes into server, when ever we have modified the bitbucket repository.

 

bitbucket-pipeline.yml

image: ubuntu:16.04
pipelines:
branches:
DevStaging:
- step:
name: PHP
script:
- apt-get update -y
- apt-get install -y zip
- apt-get install php libapache2-mod-php -y
- apt-get install curl -y
- zip -r artifact.zip *
- apt-get install sshpass -y
- time sshpass -p 'password' scp -o StrictHostKeyChecking=no -o LogLevel=DEBUG artifact.zip username@ipaddress:/home/usrname/deploy

 

Can you please give the solution ASAP.

 

Regards,

Venkat

1 answer

0 votes
mkleint
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 20, 2019

I assume that `zip -r artifact.zip *` is the step that should include the .htaccess file in your repository?

I believe zip by default will not include files starting with .

https://unix.stackexchange.com/questions/423017/how-to-zip-all-files-including-hidden-files-to-zip-file-using-linux-command

venkatcss October 20, 2019

Yes I want to zip including .htaccess file also can you please guide me. what are the changes i want to do here ?

bitbucket-pipeline.yml

image: ubuntu:16.04
pipelines:
branches:
DevStaging:
- step:
name: PHP
script:
- apt-get update -y
- apt-get install -y zip
- apt-get install php libapache2-mod-php -y
- apt-get install curl -y
- zip -r artifact.zip *
- apt-get install sshpass -y
- time sshpass -p 'password' scp -o StrictHostKeyChecking=no -o LogLevel=DEBUG artifact.zip username@ipaddress:/home/usrname/deploy

mkleint
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 20, 2019

see the linked stackoverflow answer.

 

zip -r artifact.zip ??*
venkatcss October 21, 2019

Hi Mkleint,

 

Thanks for your's reply , I have tested using the command " zip -r artifact.zip ??*" but no luck. Hidden files are not zipping.

 

bitbucket-pipelines.yml

 

image: ubuntu:16.04
pipelines:
branches:
Ydtwebstaging:
- step:
name: PHP
script:
- apt-get update -y
- apt-get install -y zip
- apt-get install php libapache2-mod-php -y
- apt-get install curl -y
- cd admin/back-end
- zip artifact.zip ??*
- apt-get install sshpass -y
- time sshpass -p 'password' scp -o StrictHostKeyChecking=no -o LogLevel=DEBUG artifact.zip username@ip:/home/username/deploy

- step:
image: node:10.15.0
name: NPM
script:
- apt-get update -y
- apt-get install -y zip
- cd admin/front-end
- npm install
- CI=false
- npm run build
- zip artifact1.zip ??*
- apt-get install sshpass -y
- time sshpass -p 'password' scp -o StrictHostKeyChecking=no -o LogLevel=DEBUG artifact1.zip username@ip:/home/username/deploy
- step:
name: api
script:
- apt-get update -y
- apt-get install -y zip
- apt-get install php libapache2-mod-php -y
- apt-get install curl -y
- cd Mobile_API_Setup
- zip artifactapi.zip ??*
- apt-get install sshpass -y
- time sshpass -p 'password' scp -o StrictHostKeyChecking=no -o LogLevel=DEBUG artifactapi.zip username@ip:/home/username/deploy

 

Like this i have used in my config file but it's not zipping the hidden files

Regards,

Venkat

mkleint
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 21, 2019

Ok. This question is not specific to pipelines. It's a general linux usage question. I've found this solution to work in my ubuntu docker image

root@b82cdad66040:~# zip 1.zip * .[^.]*
adding: file (stored 0%)
adding: .bash_history (stored 0%)
adding: .bashrc (deflated 54%)
adding: .dotted (stored 0%)
adding: .htaccess (stored 0%)
adding: .profile (deflated 20%)
root@b82cdad66040:~#

 

as per this stackoverflow - https://stackoverflow.com/questions/12493206/zip-including-hidden-files

Not sure if it only works in root folder or includes dotted files recursively.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events