136 lines
3.7 KiB
YAML
136 lines
3.7 KiB
YAML
# Global Variables
|
|
stages:
|
|
- build-base-image
|
|
- build-dev-image
|
|
- test
|
|
- build
|
|
- package
|
|
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 --destination docker.beryju.org/passbook/base:0.3.0-beta
|
|
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 --destination docker.beryju.org/passbook/dev:0.3.0-beta
|
|
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 manage.py test
|
|
- coverage report
|
|
- coverage html
|
|
stage: test
|
|
services:
|
|
- postgres:latest
|
|
- redis:latest
|
|
|
|
package-passbook-server:
|
|
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.3.0-beta
|
|
stage: build
|
|
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.3.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 build helm/passbook
|
|
- helm package helm/passbook
|
|
artifacts:
|
|
paths:
|
|
- passbook-*.tgz
|
|
expire_in: 1 week
|
|
only:
|
|
- tags
|
|
- /^version/.*$/
|