80 lines
2.1 KiB
YAML
80 lines
2.1 KiB
YAML
# You can override the included template(s) by including variable overrides
|
|
# SAST customization: https://docs.gitlab.com/ee/user/application_security/sast/#customizing-the-sast-settings
|
|
# Secret Detection customization: https://docs.gitlab.com/ee/user/application_security/secret_detection/#customizing-settings
|
|
# Dependency Scanning customization: https://docs.gitlab.com/ee/user/application_security/dependency_scanning/#customizing-the-dependency-scanning-settings
|
|
# Container Scanning customization: https://docs.gitlab.com/ee/user/application_security/container_scanning/#customizing-the-container-scanning-settings
|
|
# Note that environment variables can be set in several places
|
|
# See https://docs.gitlab.com/ee/ci/variables/#cicd-variable-precedence
|
|
stages:
|
|
- test
|
|
- build
|
|
- deploy
|
|
|
|
.test-template:
|
|
tags:
|
|
- kube
|
|
except:
|
|
- master
|
|
image: rust:1.67.1-buster
|
|
stage: test
|
|
interruptible: true
|
|
before_script:
|
|
- apt update
|
|
- apt install -y python3 python3-pip
|
|
- pip3 install pre-commit
|
|
|
|
app-tests:
|
|
extends: .test-template
|
|
script:
|
|
- cargo test
|
|
|
|
clippy:
|
|
extends: .test-template
|
|
script:
|
|
- rustup component add clippy
|
|
- pre-commit run clippy -av
|
|
|
|
fmt:
|
|
extends: .test-template
|
|
script:
|
|
- rustup component add rustfmt
|
|
- pre-commit run fmt -av
|
|
|
|
build:
|
|
stage: build
|
|
image:
|
|
name: docker:26.0.0-cli
|
|
entrypoint: [""]
|
|
tags:
|
|
- kube
|
|
only:
|
|
- master
|
|
script:
|
|
- docker login --password "$CI_JOB_TOKEN" --username "$CI_REGISTRY_USER" "$CI_REGISTRY"
|
|
- docker build --progress=plain -t "$CI_REGISTRY/telegram-bots/s3bot:latest" .
|
|
- docker push "$CI_REGISTRY/telegram-bots/s3bot:latest"
|
|
|
|
deploy:
|
|
stage: deploy
|
|
image:
|
|
name: alpine/helm:3.13.2
|
|
entrypoint: ["/bin/sh", "-c"]
|
|
tags:
|
|
- kube
|
|
only:
|
|
- master
|
|
script:
|
|
- helm
|
|
upgrade
|
|
s3bot
|
|
./helm
|
|
--install
|
|
--wait
|
|
--create-namespace
|
|
--atomic
|
|
--timeout 2m
|
|
--namespace "$NAMESPACE"
|
|
-f "$HELM_CONFIG"
|
|
--set image.repository="$CI_REGISTRY/telegram-bots/s3bot"
|
|
--set image.tag="latest"
|