133 lines
3.5 KiB
YAML
133 lines
3.5 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:
|
|
# Ensure all dependencies are installed, even those not included in passbook/dev
|
|
- pipenv lock -r --dev > 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/Dockerfile.base --destination docker.beryju.org/passbook/base:latest --destination docker.beryju.org/passbook/base:0.2.8-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/Dockerfile.dev --destination docker.beryju.org/passbook/dev:latest --destination docker.beryju.org/passbook/dev:0.2.8-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.2.8-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/Dockerfile.static --destination docker.beryju.org/passbook/static:latest --destination docker.beryju.org/passbook/static:0.2.8-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/.*$/
|