89 lines
2.1 KiB
YAML
89 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_img:
|
|
stage: build
|
|
tags:
|
|
- kube
|
|
only:
|
|
refs:
|
|
- master
|
|
changes:
|
|
- "src/**/*"
|
|
- "Cargo.toml"
|
|
- "Cargo.lock"
|
|
image:
|
|
name: r.j3ss.co/img
|
|
entrypoint: [""]
|
|
|
|
script:
|
|
- img login --password "${DOCKER_PASSWORD}" --username "${DOCKER_USER}" "${DOCKER_REGISTRY}"
|
|
- img build --no-console -t docker.le-memese.com/bots/s3bot:latest .
|
|
- img push docker.le-memese.com/bots/s3bot:latest
|
|
|
|
deploy:
|
|
stage: deploy
|
|
tags:
|
|
- kube
|
|
only:
|
|
refs:
|
|
- master
|
|
image:
|
|
name: alpine/helm:3.7.1
|
|
entrypoint: ["/bin/sh", "-c"]
|
|
environment:
|
|
name: prod
|
|
action: start
|
|
url: "https://s3bot.le-memese.com"
|
|
script:
|
|
- helm
|
|
upgrade
|
|
s3bot
|
|
./helm
|
|
--install
|
|
--wait
|
|
--create-namespace
|
|
--atomic
|
|
--timeout 2m
|
|
--namespace "$NAMESPACE"
|
|
-f "$HELM_CONFIG"
|