2018-11-26 21:44:00 +00:00
|
|
|
# Global Variables
|
|
|
|
stages:
|
2019-07-22 13:18:33 +00:00
|
|
|
- build-base-image
|
|
|
|
- build-dev-image
|
2019-04-18 08:15:44 +00:00
|
|
|
- test
|
|
|
|
- build
|
2019-07-22 13:18:33 +00:00
|
|
|
- package
|
|
|
|
image: docker.beryju.org/passbook/dev:latest
|
2019-02-21 15:50:36 +00:00
|
|
|
|
|
|
|
variables:
|
2019-04-18 08:15:44 +00:00
|
|
|
POSTGRES_DB: passbook
|
|
|
|
POSTGRES_USER: passbook
|
|
|
|
POSTGRES_PASSWORD: "EK-5jnKfjrGRm<77"
|
2018-11-26 21:44:00 +00:00
|
|
|
|
2019-07-04 14:21:35 +00:00
|
|
|
before_script:
|
2019-10-01 09:12:59 +00:00
|
|
|
- pip install pipenv
|
2019-07-22 13:18:33 +00:00
|
|
|
# Ensure all dependencies are installed, even those not included in passbook/dev
|
2019-10-01 09:34:34 +00:00
|
|
|
# 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
|
2019-09-10 15:00:13 +00:00
|
|
|
- pip install -r requirements-all.txt
|
2019-07-04 14:21:35 +00:00
|
|
|
|
2019-07-22 13:18:33 +00:00
|
|
|
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:
|
2019-10-02 21:04:16 +00:00
|
|
|
- /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.4.1-beta
|
2019-07-22 13:18:33 +00:00
|
|
|
stage: build-base-image
|
|
|
|
only:
|
|
|
|
refs:
|
|
|
|
- tags
|
|
|
|
- /^version/.*$/
|
|
|
|
|
|
|
|
build-dev-image:
|
2019-04-18 08:15:44 +00:00
|
|
|
image:
|
|
|
|
name: gcr.io/kaniko-project/executor:debug
|
|
|
|
entrypoint: [""]
|
|
|
|
before_script:
|
2019-04-29 18:42:24 +00:00
|
|
|
- echo "{\"auths\":{\"docker.beryju.org\":{\"auth\":\"$DOCKER_AUTH\"}}}" > /kaniko/.docker/config.json
|
2019-04-18 08:15:44 +00:00
|
|
|
script:
|
2019-10-02 21:04:16 +00:00
|
|
|
- /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.4.1-beta
|
2019-07-22 13:18:33 +00:00
|
|
|
stage: build-dev-image
|
2019-04-18 08:15:44 +00:00
|
|
|
only:
|
|
|
|
refs:
|
|
|
|
- tags
|
|
|
|
- /^version/.*$/
|
2018-12-09 21:37:17 +00:00
|
|
|
|
2019-07-22 13:18:33 +00:00
|
|
|
|
2018-11-26 21:44:00 +00:00
|
|
|
isort:
|
2019-04-18 08:15:44 +00:00
|
|
|
script:
|
|
|
|
- isort -c -sg env
|
|
|
|
stage: test
|
2019-07-22 13:18:33 +00:00
|
|
|
services:
|
|
|
|
- postgres:latest
|
|
|
|
- redis:latest
|
2018-11-26 21:44:00 +00:00
|
|
|
migrations:
|
2019-04-18 08:15:44 +00:00
|
|
|
script:
|
|
|
|
- python manage.py migrate
|
|
|
|
stage: test
|
2019-07-22 13:18:33 +00:00
|
|
|
services:
|
|
|
|
- postgres:latest
|
|
|
|
- redis:latest
|
2019-10-01 14:53:09 +00:00
|
|
|
# prospector:
|
|
|
|
# script:
|
|
|
|
# - prospector
|
|
|
|
# stage: test
|
|
|
|
# services:
|
|
|
|
# - postgres:latest
|
|
|
|
# - redis:latest
|
|
|
|
# pylint:
|
|
|
|
# script:
|
|
|
|
# - pylint passbook
|
|
|
|
# stage: test
|
|
|
|
# services:
|
|
|
|
# - postgres:latest
|
|
|
|
# - redis:latest
|
2018-11-26 21:44:00 +00:00
|
|
|
coverage:
|
2019-04-18 08:15:44 +00:00
|
|
|
script:
|
|
|
|
- coverage run manage.py test
|
|
|
|
- coverage report
|
2019-07-22 13:18:33 +00:00
|
|
|
- coverage html
|
2019-04-18 08:15:44 +00:00
|
|
|
stage: test
|
2019-07-22 13:18:33 +00:00
|
|
|
services:
|
|
|
|
- postgres:latest
|
|
|
|
- redis:latest
|
2018-11-26 21:44:00 +00:00
|
|
|
|
2019-07-22 13:18:33 +00:00
|
|
|
package-passbook-server:
|
2019-04-18 08:15:44 +00:00
|
|
|
image:
|
|
|
|
name: gcr.io/kaniko-project/executor:debug
|
|
|
|
entrypoint: [""]
|
|
|
|
before_script:
|
2019-04-29 18:42:24 +00:00
|
|
|
- echo "{\"auths\":{\"docker.beryju.org\":{\"auth\":\"$DOCKER_AUTH\"}}}" > /kaniko/.docker/config.json
|
2019-04-18 08:15:44 +00:00
|
|
|
script:
|
2019-10-02 21:04:16 +00:00
|
|
|
- /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.4.1-beta
|
2019-04-18 08:15:44 +00:00
|
|
|
stage: build
|
|
|
|
only:
|
|
|
|
- tags
|
|
|
|
- /^version/.*$/
|
2019-07-22 13:18:33 +00:00
|
|
|
build-passbook-static:
|
2019-04-18 08:15:44 +00:00
|
|
|
stage: build
|
2019-07-22 13:18:33 +00:00
|
|
|
image:
|
|
|
|
name: gcr.io/kaniko-project/executor:debug
|
|
|
|
entrypoint: [""]
|
|
|
|
before_script:
|
|
|
|
- echo "{\"auths\":{\"docker.beryju.org\":{\"auth\":\"$DOCKER_AUTH\"}}}" > /kaniko/.docker/config.json
|
2019-04-18 08:15:44 +00:00
|
|
|
script:
|
2019-10-02 21:04:16 +00:00
|
|
|
- /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.4.1-beta
|
2019-07-22 13:18:33 +00:00
|
|
|
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
|
2019-04-18 08:15:44 +00:00
|
|
|
- curl https://raw.githubusercontent.com/helm/helm/master/scripts/get | bash
|
2019-07-22 13:18:33 +00:00
|
|
|
script:
|
2019-04-18 08:15:44 +00:00
|
|
|
- helm init --client-only
|
2019-10-02 21:03:39 +00:00
|
|
|
- helm dependency update helm/passbook
|
2019-04-18 08:15:44 +00:00
|
|
|
- helm package helm/passbook
|
|
|
|
artifacts:
|
|
|
|
paths:
|
2019-04-29 15:05:39 +00:00
|
|
|
- passbook-*.tgz
|
2019-07-22 13:18:33 +00:00
|
|
|
expire_in: 1 week
|
2019-04-18 08:15:44 +00:00
|
|
|
only:
|
|
|
|
- tags
|
|
|
|
- /^version/.*$/
|