You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.
View groupJoin the community to find out what other Atlassian users are discussing, debating and creating.
I am creating script for automatic testing and publishing. Everything works for me, except one thing. I can't do this command `git fetch origin` without using a password. I tried to set an access key in Bitbucket. I already set one in the server, but it doesn't work. Can you please help me? For clarity, I show you my script and my pipeline.
My Bitbucket pipeline:
# This is a sample build configuration for PHP.
# Check our guides at https://confluence.atlassian.com/x/e8YWN 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.
image: php:7.2.24-fpm
pipelines:
default:
- step:
caches:
- composer
script:
- apt-get update
- apt-get install -y unzip libpng-dev libxml2-dev libmagickwand-dev libbz2-dev
- echo "memory_limit = 512M" > $PHP_INI_DIR/conf.d/php-memory-limits.ini
- pecl install imagick
- docker-php-ext-install bz2
- docker-php-ext-enable imagick
- docker-php-ext-install xml
- docker-php-ext-install mbstring
- docker-php-ext-install gd
- docker-php-ext-install zip
- curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
- composer install
- vendor/bin/phpunit
# custom:
# deploy-branch-develop-to-server:
# - step:
# name: Deploy to server branch develop
# script:
# - pipe: atlassian/ssh-run:0.2.6
# variables:
# SSH_USER: $USER
# SERVER: $SERVER
# SSH_KEY: $MY_SSH_KEY
# MODE: 'script'
# COMMAND: 'scripts/deploy-develop.sh'
# branches:
# develop:
# - step:
# name: Deploy to server branch develop
# script:
# - pipe: atlassian/ssh-run:0.2.6
# variables:
# SSH_USER: $USER
# SERVER: $SERVER
# SSH_KEY: $MY_SSH_KEY
# MODE: 'script'
# COMMAND: 'scripts/deploy-develop.sh'
# master:
# - step:
# name: Deploy to server branch master
# script:
# - pipe: atlassian/ssh-run:0.2.6
# variables:
# SSH_USER: $USER
# SERVER: $SERVER
# SSH_KEY: $MY_SSH_KEY
# MODE: 'script'
# COMMAND: 'scripts/deploy-master.sh'
My deployement script:
cd /var/www/vhosts/am-develop
sudo -u www-data cp .env.develop .env
sudo -u www-data git fetch origin # DOES NOT WORK!
sudo -u www-data composer install
sudo -u www-data npm run development
chown www-data:www-data -R .
service apache2 restart
service supervisor restart
php artisan elaborate:apps
wall "Deploy completed in production"
You may try to use Personal Access Token and pass it to git. The alternative is to generate a SSH key for the user which is running "git" command and add it to your Bitbucket profile.
I read in both guides you proposed that you need to have Bitbucket Server, I am currently using an Ubuntu server to be able to host my application. Is there any other alternative? For clarity, I show you my script and my pipeline.
Pipeline:
# This is a sample build configuration for PHP.
# Check our guides at https://confluence.atlassian.com/x/e8YWN 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.
image: php:7.2.24-fpm
pipelines:
default:
- step:
caches:
- composer
script:
- apt-get update
- apt-get install -y unzip libpng-dev libxml2-dev libmagickwand-dev libbz2-dev
- echo "memory_limit = 512M" > $PHP_INI_DIR/conf.d/php-memory-limits.ini
- pecl install imagick
- docker-php-ext-install bz2
- docker-php-ext-enable imagick
- docker-php-ext-install xml
- docker-php-ext-install mbstring
- docker-php-ext-install gd
- docker-php-ext-install zip
- curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
- composer install
- vendor/bin/phpunit
# custom:
# deploy-branch-develop-to-server:
# - step:
# name: Deploy to server branch develop
# script:
# - pipe: atlassian/ssh-run:0.2.6
# variables:
# SSH_USER: $USER
# SERVER: $SERVER
# SSH_KEY: $MY_SSH_KEY
# MODE: 'script'
# COMMAND: 'scripts/deploy-develop.sh'
# branches:
# develop:
# - step:
# name: Deploy to server branch develop
# script:
# - pipe: atlassian/ssh-run:0.2.6
# variables:
# SSH_USER: $USER
# SERVER: $SERVER
# SSH_KEY: $MY_SSH_KEY
# MODE: 'script'
# COMMAND: 'scripts/deploy-develop.sh'
# master:
# - step:
# name: Deploy to server branch master
# script:
# - pipe: atlassian/ssh-run:0.2.6
# variables:
# SSH_USER: $USER
# SERVER: $SERVER
# SSH_KEY: $MY_SSH_KEY
# MODE: 'script'
# COMMAND: 'scripts/deploy-master.sh'
Script:
cd /var/www/vhosts/am-develop
sudo -u www-data cp .env.develop .env
sudo -u www-data git fetch origin # DOES NOT WORK!
sudo -u www-data composer install
sudo -u www-data npm run development
chown www-data:www-data -R .
service apache2 restart
service supervisor restart
php artisan elaborate:apps
wall "Deploy completed in production"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Announced in this blog, this holiday season we’re celebrating all things CI/CD and between now and the end of 2019 we’ll be showcasing content, use cases, feature announcements and more. One featur...
Connect with like-minded Atlassian users at free events near you!
Find an eventConnect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.
Host an eventYou're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.