2021-01-02 02:40:57 +01:00
|
|
|
---
|
2021-01-04 19:23:41 +01:00
|
|
|
include:
|
|
|
|
- template: Security/Secret-Detection.gitlab-ci.yml
|
|
|
|
|
2021-01-07 20:27:17 +01:00
|
|
|
image: registry.git.saibotk.de/saibotk.de/infrastructure-ci-container:latest
|
|
|
|
|
2022-01-02 20:53:51 +01:00
|
|
|
variables:
|
|
|
|
ANSIBLE_FORCE_COLOR: 'true'
|
|
|
|
PY_COLORS: '1'
|
|
|
|
|
2021-01-02 02:40:57 +01:00
|
|
|
stages:
|
|
|
|
- lint
|
2021-01-04 19:23:41 +01:00
|
|
|
- test
|
2021-03-05 13:38:40 +01:00
|
|
|
- release
|
2021-01-02 02:40:57 +01:00
|
|
|
|
|
|
|
ansible-lint:
|
|
|
|
stage: lint
|
2022-08-13 19:33:18 +02:00
|
|
|
variables:
|
|
|
|
ANSIBLE_CONFIG: "$CI_PROJECT_DIR/ansible.lint.cfg"
|
2021-01-02 02:40:57 +01:00
|
|
|
script:
|
2021-03-14 14:08:15 +01:00
|
|
|
- ansible-lint --version
|
2022-08-13 19:48:47 +02:00
|
|
|
- ansible-lint -f codeclimate roles/ playbooks/ > ansible-lint-report.json
|
2021-03-05 13:24:16 +01:00
|
|
|
artifacts:
|
2022-08-13 19:33:18 +02:00
|
|
|
paths:
|
|
|
|
- "ansible-lint-report.json"
|
2021-03-05 13:24:16 +01:00
|
|
|
reports:
|
|
|
|
codequality: ansible-lint-report.json
|
2022-08-13 19:33:18 +02:00
|
|
|
when: always
|
2021-03-05 13:38:40 +01:00
|
|
|
|
|
|
|
# Automated month-based releases
|
|
|
|
release-branch:
|
|
|
|
stage: release
|
|
|
|
image: registry.gitlab.com/gitlab-org/release-cli
|
|
|
|
variables:
|
|
|
|
GIT_STRATEGY: clone
|
|
|
|
GIT_DEPTH: 0
|
2021-03-05 13:59:26 +01:00
|
|
|
before_script:
|
2021-03-05 13:38:40 +01:00
|
|
|
- apk add --no-cache git
|
|
|
|
- export INFRA_RELEASE_VERSION="$(date +%y.%m)"
|
|
|
|
- export INFRA_RELEASE_NAME="Infrastructure $INFRA_RELEASE_VERSION"
|
2021-04-01 23:26:02 +02:00
|
|
|
- export INFRA_RELEASE_DESCRIPTION="$(printf '## Changelog\n\n' && git log --no-merges --pretty="- %s (%h)" "HEAD...$(git tag | sort -V -r | head -1)" && printf '\n\n## External Contributors\n\n' && git log --pretty="- %an%n- %cn" HEAD...$(git tag | sort -V -r | head -1) | sort | uniq | grep -vi 'saibotk' && printf "\n\n---\n*This is an automated release. See [#${CI_JOB_ID}]($CI_JOB_URL) for details.*")"
|
2021-03-05 13:59:26 +01:00
|
|
|
script:
|
|
|
|
- >
|
|
|
|
release-cli create --name "$INFRA_RELEASE_NAME" --description "$INFRA_RELEASE_DESCRIPTION"
|
|
|
|
--tag-name "v${INFRA_RELEASE_VERSION}" --ref $CI_COMMIT_SHA
|
2021-03-05 13:38:40 +01:00
|
|
|
rules:
|
|
|
|
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $INFRA_RELEASE_NOW == "true" && $CI_COMMIT_TAG == null'
|