153 lines
4 KiB
YAML
153 lines
4 KiB
YAML
# Global Variables
|
|
stages:
|
|
- build-base-image
|
|
- build-dev-image
|
|
- test
|
|
- build
|
|
- package
|
|
- post-release
|
|
image: docker.beryju.org/passbook/dev:latest
|
|
|
|
variables:
|
|
POSTGRES_DB: passbook
|
|
POSTGRES_USER: passbook
|
|
POSTGRES_PASSWORD: "EK-5jnKfjrGRm<77"
|
|
|
|
before_script:
|
|
- pip install pipenv
|
|
# Ensure all dependencies are installed, even those not included in passbook/dev
|
|
# According to pipenv docs, -d outputs all packages, however it actually does not
|
|
- pipenv lock -r > requirements-all.txt
|
|
- pipenv lock -rd >> requirements-all.txt
|
|
- pip install -r requirements-all.txt
|
|
|
|
create-base-image:
|
|
image:
|
|
name: gcr.io/kaniko-project/executor:debug
|
|
entrypoint: [""]
|
|
before_script:
|
|
- echo "{\"auths\":{\"docker.beryju.org\":{\"auth\":\"$DOCKER_AUTH\"}}}" > /kaniko/.docker/config.json
|
|
script:
|
|
- /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/base.Dockerfile --destination docker.beryju.org/passbook/base:latest
|
|
stage: build-base-image
|
|
only:
|
|
refs:
|
|
- tags
|
|
- /^version/.*$/
|
|
|
|
build-dev-image:
|
|
image:
|
|
name: gcr.io/kaniko-project/executor:debug
|
|
entrypoint: [""]
|
|
before_script:
|
|
- echo "{\"auths\":{\"docker.beryju.org\":{\"auth\":\"$DOCKER_AUTH\"}}}" > /kaniko/.docker/config.json
|
|
script:
|
|
- /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/dev.Dockerfile --destination docker.beryju.org/passbook/dev:latest
|
|
stage: build-dev-image
|
|
only:
|
|
refs:
|
|
- tags
|
|
- /^version/.*$/
|
|
|
|
|
|
isort:
|
|
script:
|
|
- isort -c -sg env
|
|
stage: test
|
|
services:
|
|
- postgres:latest
|
|
- redis:latest
|
|
migrations:
|
|
script:
|
|
- python manage.py migrate
|
|
stage: test
|
|
services:
|
|
- postgres:latest
|
|
- redis:latest
|
|
# prospector:
|
|
# script:
|
|
# - prospector
|
|
# stage: test
|
|
# services:
|
|
# - postgres:latest
|
|
# - redis:latest
|
|
pylint:
|
|
script:
|
|
- pylint passbook
|
|
stage: test
|
|
services:
|
|
- postgres:latest
|
|
- redis:latest
|
|
coverage:
|
|
script:
|
|
- coverage run --concurrency=multiprocessing manage.py test
|
|
- coverage combine
|
|
- coverage report
|
|
stage: test
|
|
services:
|
|
- postgres:latest
|
|
- redis:latest
|
|
|
|
build-passbook-server:
|
|
stage: build
|
|
image:
|
|
name: gcr.io/kaniko-project/executor:debug
|
|
entrypoint: [""]
|
|
before_script:
|
|
- echo "{\"auths\":{\"docker.beryju.org\":{\"auth\":\"$DOCKER_AUTH\"}}}" > /kaniko/.docker/config.json
|
|
script:
|
|
- /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination docker.beryju.org/passbook/server:latest --destination docker.beryju.org/passbook/server:0.7.0-beta
|
|
only:
|
|
- tags
|
|
- /^version/.*$/
|
|
build-passbook-static:
|
|
stage: build
|
|
image:
|
|
name: gcr.io/kaniko-project/executor:debug
|
|
entrypoint: [""]
|
|
before_script:
|
|
- echo "{\"auths\":{\"docker.beryju.org\":{\"auth\":\"$DOCKER_AUTH\"}}}" > /kaniko/.docker/config.json
|
|
script:
|
|
- /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/static.Dockerfile --destination docker.beryju.org/passbook/static:latest --destination docker.beryju.org/passbook/static:0.7.0-beta
|
|
only:
|
|
- tags
|
|
- /^version/.*$/
|
|
# running collectstatic fully initialises django, hence we need that databases
|
|
services:
|
|
- postgres:latest
|
|
- redis:latest
|
|
|
|
package-helm:
|
|
image: debian:stretch-slim
|
|
stage: package
|
|
before_script:
|
|
- apt update && apt install -y curl
|
|
- curl https://raw.githubusercontent.com/helm/helm/master/scripts/get | bash
|
|
script:
|
|
- helm init --client-only
|
|
- helm dependency update helm/passbook
|
|
- helm package helm/passbook
|
|
artifacts:
|
|
paths:
|
|
- passbook-*.tgz
|
|
expire_in: 1 week
|
|
only:
|
|
- tags
|
|
- /^version/.*$/
|
|
|
|
notify-sentry:
|
|
image: getsentry/sentry-cli
|
|
stage: post-release
|
|
variables:
|
|
SENTRY_URL: https://sentry.beryju.org
|
|
SENTRY_ORG: beryjuorg
|
|
SENTRY_PROJECT: passbook
|
|
before_script:
|
|
- apk add curl
|
|
script:
|
|
- sentry-cli releases new passbook@0.7.0-beta
|
|
- sentry-cli releases set-commits --auto passbook@0.7.0-beta
|
|
only:
|
|
- tags
|
|
- /^version/.*$/
|