78 lines
1.6 KiB
YAML
78 lines
1.6 KiB
YAML
stages:
|
|
- test
|
|
- build
|
|
- deploy
|
|
|
|
variables:
|
|
APP_VERSION: ${CI_COMMIT_REF_SLUG}
|
|
|
|
.test-template:
|
|
image: python:3.9-buster
|
|
stage: test
|
|
tags:
|
|
- kube
|
|
except:
|
|
- tags
|
|
before_script:
|
|
- echo "${DOCKER_REGISTRY}"
|
|
- pip install poetry==1.1.6
|
|
- poetry config virtualenvs.create false
|
|
- poetry install
|
|
|
|
flake8:
|
|
stage: test
|
|
extends:
|
|
- .test-template
|
|
script:
|
|
- flake8 --count .
|
|
|
|
pytest:
|
|
extends:
|
|
- .test-template
|
|
script:
|
|
- pytest -vv
|
|
|
|
black:
|
|
extends:
|
|
- .test-template
|
|
script:
|
|
- black --check .
|
|
|
|
mypy:
|
|
stage: test
|
|
extends:
|
|
- .test-template
|
|
script:
|
|
- mypy .
|
|
|
|
image-builder:
|
|
stage: build
|
|
image:
|
|
name: gcr.io/kaniko-project/executor:v1.6.0-debug
|
|
entrypoint: [ "" ]
|
|
tags:
|
|
- kube
|
|
only:
|
|
- tags
|
|
script:
|
|
- mkdir -p /kaniko/.docker
|
|
- echo "{\"auths\":{\"$DOCKER_REGISTRY\":{\"username\":\"$DOCKER_USER\",\"password\":\"$DOCKER_PASSWORD\"}}}" > /kaniko/.docker/config.json
|
|
- /kaniko/executor --context .
|
|
--dockerfile deploy/Dockerfile
|
|
--destination "$IMAGE_NAME:$APP_VERSION"
|
|
--force
|
|
|
|
deploy:
|
|
stage: deploy
|
|
image: dtzar/helm-kubectl:3.6.3
|
|
tags:
|
|
- kube
|
|
only:
|
|
- tags
|
|
script:
|
|
- export KUBECONFIG=$KUBE_CONF
|
|
- env | grep "^LENOCHKA_" > .deploy-env
|
|
- kubectl delete configmap --namespace "$NAMESPACE" "$ENVCONF" || true
|
|
- kubectl create configmap --namespace "$NAMESPACE" "$ENVCONF" --from-env-file=.deploy-env
|
|
- envsubst < "$HELM_VALUES" > deploy-values.yml
|
|
- helm upgrade lenocka deploy/charts/lenocka/ -f deploy-values.yml --namespace "$NAMESPACE" |