diff --git a/Makefile b/Makefile index ab6e283..19c7a08 100644 --- a/Makefile +++ b/Makefile @@ -105,6 +105,10 @@ clean-drupal: clean-composer # Targets for Bitbucket Pipelines # +# Bootstrap scripts/make directory +pipelines-bootstrap: + ./scripts/bootstrap-build-framework.sh + # Build Drupal under Pipelnes. pipelines-build-drupal: ./scripts/make/install-drupal.sh diff --git a/bitbucket-pipelines.yml b/bitbucket-pipelines.yml index 4c05042..8a726ec 100644 --- a/bitbucket-pipelines.yml +++ b/bitbucket-pipelines.yml @@ -4,6 +4,13 @@ clone: pipelines: branches: master: + - step: + name: Bootstrap + image: deeson/deployer + script: + - make pipelines-bootstrap + artifacts: + - 'scripts/make/**' - step: name: Build Drupal image: wodby/drupal-php:7.1-2.4.3 @@ -39,6 +46,13 @@ pipelines: script: - make pipelines-deploy develop: + - step: + name: Bootstrap + image: deeson/deployer + script: + - make pipelines-bootstrap + artifacts: + - 'scripts/make/**' - step: name: Build Drupal image: wodby/drupal-php:7.1-2.4.3 @@ -74,6 +88,13 @@ pipelines: script: - make pipelines-deploy UAT: + - step: + name: Bootstrap + image: deeson/deployer + script: + - make pipelines-bootstrap + artifacts: + - 'scripts/make/**' - step: name: Build Drupal image: wodby/drupal-php:7.1-2.4.3 @@ -110,6 +131,13 @@ pipelines: - make pipelines-deploy tags: '*': + - step: + name: Bootstrap + image: deeson/deployer + script: + - make pipelines-bootstrap + artifacts: + - 'scripts/make/**' - step: name: Build Drupal image: wodby/drupal-php:7.1-2.4.3 diff --git a/scripts/bootstrap-build-framework.sh b/scripts/bootstrap-build-framework.sh index 8e553ca..22b522c 100755 --- a/scripts/bootstrap-build-framework.sh +++ b/scripts/bootstrap-build-framework.sh @@ -12,8 +12,15 @@ if [ ! -d "./make" ]; then version=$(cat ./.dbf) fi - docker run -v $(pwd):/app -w /app --env DBFVER=$version deeson/deployer /bin/bash \ - -c 'git clone -b "$DBFVER" --single-branch --depth 1 https://github.com/teamdeeson/drupal-build-framework.git make \ + DBFVER=$version + clone_script='git clone -b "$DBFVER" --single-branch --depth 1 https://github.com/teamdeeson/drupal-build-framework.git make \ && cd ./make \ - && rm -Rf .git' + && rm -Rf .git'; + + #If were not under pipelines, run in container, otherwise we're already in a container, run locally. + if [ -z "$CI" ]; then + docker run -v $(pwd):/app -w /app --env DBFVER=$version deeson/deployer /bin/bash -c "$clone_script" + else + eval "$clone_script" + fi fi