59 lines
1.6 KiB
YAML
Executable File
59 lines
1.6 KiB
YAML
Executable File
image: docker:dind
|
|
services:
|
|
- name: docker:dind
|
|
entrypoint: ["env", "-u", "DOCKER_HOST"]
|
|
command: ["dockerd-entrypoint.sh"]
|
|
variables:
|
|
DOCKER_TLS_CERTDIR: ""
|
|
DOCKER_HOST: tcp://docker:2375/
|
|
DOCKER_DRIVER: overlay2
|
|
|
|
stages:
|
|
- lint_python
|
|
- lint_helm
|
|
- deploy
|
|
|
|
lint_helm:
|
|
image: alpine/helm
|
|
stage: lint_helm
|
|
script:
|
|
- helm lint ./helm
|
|
rules:
|
|
- changes:
|
|
- helm/*
|
|
|
|
lint_python:
|
|
image: python:alpine
|
|
stage: lint_python
|
|
script:
|
|
- pip install -q black && black --fast --check .
|
|
rules:
|
|
- changes:
|
|
- app/**/*
|
|
|
|
build_and_push_container:
|
|
stage: deploy
|
|
script:
|
|
- echo "Wait for Docker daemon at tcp://localhost:2375"
|
|
- while ! nc -z localhost 2375; do sleep 0.1; done # Wait until docker socket is available
|
|
- docker login -u ldooks -p $DOCKER_ACCESS_TOKEN
|
|
- docker build --platform linux/amd64 -t ldooks/dragon-bot:$CI_PIPELINE_IID -t ldooks/dragon-bot:latest .
|
|
- docker push ldooks/dragon-bot -a
|
|
rules:
|
|
- changes:
|
|
- app/**/*
|
|
- Dockerfile
|
|
|
|
sync_argo:
|
|
stage: .post
|
|
image: python:alpine
|
|
script:
|
|
- apk add --no-cache jq curl
|
|
- latest=$(curl -sL https://api.github.com/repos/argoproj/argo-cd/releases/latest | jq -r '.assets[] | select( .name | contains("argocd-linux-amd64")).browser_download_url')
|
|
- curl -Ls $latest -o /tmp/argocd && chmod +x /tmp/argocd
|
|
- /tmp/argocd --insecure --server argocd-server.argocd.svc.cluster.local --auth-token $ARGOCD_TOKEN app set dragon-bot --helm-set image.tag=$CI_PIPELINE_IID
|
|
rules:
|
|
- changes:
|
|
- helm/*
|
|
- app/**/*
|