infrastructure/.gitlab-ci.yml

39 lines
1.4 KiB
YAML
Raw Normal View History

2021-01-02 02:40:57 +01:00
---
include:
- template: Security/Secret-Detection.gitlab-ci.yml
image: registry.git.saibotk.de/saibotk.de/infrastructure-ci-container:latest
2021-01-02 02:40:57 +01:00
stages:
- lint
- test
- release
2021-01-02 02:40:57 +01:00
ansible-lint:
stage: lint
script:
- ansible-lint -f codeclimate *.yml > ansible-lint-report.json
artifacts:
reports:
codequality: ansible-lint-report.json
# Automated month-based releases
release-branch:
stage: release
image: registry.gitlab.com/gitlab-org/release-cli
variables:
GIT_STRATEGY: clone
GIT_DEPTH: 0
script:
- apk add --no-cache git
- export INFRA_RELEASE_VERSION="$(date +%y.%m)"
- export INFRA_RELEASE_NAME="Infrastructure $INFRA_RELEASE_VERSION"
- 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 -v 'saibotk' && printf "\n\n---\n*This is an automated release. See [#${CI_JOB_ID}]($CI_JOB_URL) for details.*")"
release:
name: '$INFRA_RELEASE_NAME'
tag_name: 'v${INFRA_RELEASE_VERSION}'
ref: '$CI_COMMIT_SHA'
description: '$INFRA_RELEASE_DESCRIPTION'
rules:
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $INFRA_RELEASE_NOW == "true" && $CI_COMMIT_TAG == null'