Skip to content

Instantly share code, notes, and snippets.

@Snaver
Created May 31, 2018 19:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Snaver/285aec0b6fa81fda1995716ae0774ec3 to your computer and use it in GitHub Desktop.
Save Snaver/285aec0b6fa81fda1995716ae0774ec3 to your computer and use it in GitHub Desktop.
# Laravel pipelines https://confluence.atlassian.com/bitbucket/laravel-with-bitbucket-pipelines-913473967.html
#
# -----
# You can specify a custom docker image from Docker Hub as your build environment.
#image: php:7.1.1
# Bitbucket Pipelines now includes the option to allocate additional resources.
# By specifying the size of '2x', your pipeline will include double the resources (eg. 4GB memory → 8GB memory).
#options:
# size: 2x
pipelines:
branches:
master:
- step:
name: Envoy Run
image:
name: mcuyar/docker-envoy
script:
- envoy run exampleCommands --host=$HOST --user=$USER --php=php --code_directory=$BITBUCKET_CLONE_DIR
@servers(['web' => $user.'@'.$host,'localhost' => '127.0.0.1'])
@setup
// Sanity checks
if (empty($host)) {
exit('ERROR: $host var empty or not defined');
}
if (empty($user)) {
exit('ERROR: $user var empty or not defined');
}
if (empty($php)) {
exit('ERROR: $php var empty or not defined');
}
if (empty($code_directory)) {
exit('ERROR: $code_directory var empty or not defined');
}
// Command or path to invoke PHP
$php = empty($php) ? 'php' : $php;
@endsetup
@story('exampleCommands')
pipeline_task
server_task
@endstory
@task('pipeline_task', ['on' => 'localhost'])
echo "* Running example command on the Bitbucket Pipeline server *"
hostname
ls -la
ls -la {{ $code_directory }}
@endtask
@task('server_task', ['on' => 'web'])
echo "* Running example command on the remote server *"
hostname
ls -la
@endtask
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment