bitbucket-pipelines.yml
definitions:
services:
postgres:
image: postgres:9.6
environment:
POSTGRES_DB: ara
POSTGRES_USER: ara
POSTGRES_PASSWORD: ara
steps:
- step: &unit-tests
name: Unit tests
image: golang:1.21
script:
- export TZ=Europe/Paris LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_ALL=en_US.UTF-8
- apt-get update
- mkdir -p /usr/share/man/man1 /usr/share/man/man7
- export PACKAGES="build-essential ruby-dev libpq-dev libxml2-dev zlib1g-dev git-core postgresql-client-common libproj-dev"
- export BUNDLER_VERSION=$(tail -n1 Gemfile.lock)
- apt-get -y install --no-install-recommends locales $PACKAGES
- echo "en_US.UTF-8 UTF-8" > /etc/locale.gen && locale-gen
- gem install bundler -v $BUNDLER_VERSION
# FIXME
- export BASE_PATH="${GOPATH}/src/bitbucket.org/enroute-mobi"
- mkdir -p ${BASE_PATH}
- export IMPORT_PATH="${BASE_PATH}/ara"
- ln -s ${PWD} ${IMPORT_PATH}
- cd ${IMPORT_PATH}
- bundle install --jobs 4 --deployment --path=ruby/vendor/
- export ARA_DB_NAME=ara ARA_DB_USER=ara ARA_DB_PASSWORD=ara ARA_DB_HOST=localhost
- export ARA_CONFIG=$PWD/config
- ./ci.sh
services:
- postgres
pipelines:
default:
- step: *unit-tests
branches:
master:
- parallel:
- step: *unit-tests
- step:
name: Build Docker
image:
name: us.gcr.io/enroute-interne/enroute-cloud-sdk:latest
username: _json_key
password: "$GCLOUD_API_KEYFILE"
caches:
- docker
services:
- docker
script:
- ./script/bitbucket-gcloud-configure-docker.sh
- ./script/bitbucket-build-docker.sh
- step:
name: Deploy to test
image:
name: eu.gcr.io/enroute-interne/enroute-cloud-sdk:latest
username: _json_key
password: "$GCLOUD_API_KEYFILE"
deployment: test
runs-on:
- self.hosted
- env.interne
script:
- git clone git@bitbucket.org:enroute-mobi/ara-env.git env
- env/deploy-with-runner.sh
- pipe: atlassian/datadog-send-event:2.2.0
variables:
API_KEY: $DATADOG_KEY
TITLE: "Build ${BITBUCKET_BUILD_NUMBER} deployed on ara ${BITBUCKET_DEPLOYMENT_ENVIRONMENT}"
PAYLOAD: >
{ "source_type_name": "BITBUCKET", "tags":["env:test","app:ara","repository:ara"] }
- step:
name: Deploy to staging
image:
name: eu.gcr.io/enroute-interne/enroute-cloud-sdk:latest
username: _json_key
password: "$GCLOUD_API_KEYFILE"
deployment: staging
trigger: manual
runs-on:
- self.hosted
- env.interne
script:
- git clone git@bitbucket.org:enroute-mobi/ara-env.git env
- env/deploy-with-runner.sh
- pipe: atlassian/datadog-send-event:2.2.0
variables:
API_KEY: $DATADOG_KEY
TITLE: "Build ${BITBUCKET_BUILD_NUMBER} deployed on ara ${BITBUCKET_DEPLOYMENT_ENVIRONMENT}"
PAYLOAD: >
{ "source_type_name": "BITBUCKET", "tags":["env:staging","app:ara","repository:ara"] }
- step:
name: Deploy to production
image:
name: eu.gcr.io/enroute-interne/enroute-cloud-sdk:latest
username: _json_key
password: "$GCLOUD_API_KEYFILE"
deployment: production
trigger: manual
runs-on:
- self.hosted
- env.production
script:
- git clone git@bitbucket.org:enroute-mobi/ara-env.git env
- env/deploy-with-runner.sh
- pipe: atlassian/datadog-send-event:2.2.0
variables:
API_KEY: $DATADOG_KEY
TITLE: "Build ${BITBUCKET_BUILD_NUMBER} deployed on ara ${BITBUCKET_DEPLOYMENT_ENVIRONMENT}"
PAYLOAD: >
{ "source_type_name": "BITBUCKET", "tags":["env:production","app:ara","repository:ara"] }