infrastructure/.gitlab-ci.yml
saibotk 8286c3afd3
CI: Fix ansible-lint search space
This patch will allow ansible-lint to search for files on its own instead of *.yml files in the root directory. Since playbooks now reside in their own folder, ansible-lint would not lint any roles anymore.

Also this introduces another small stub ansible-lint related ansible config file, so it does not always try to use the vault password / decrypt files.
2021-09-14 00:44:30 +02:00

38 lines
1.4 KiB
YAML

---
include:
- template: Security/Secret-Detection.gitlab-ci.yml
image: registry.git.saibotk.de/saibotk.de/infrastructure-ci-container:latest
stages:
- lint
- test
- release
ansible-lint:
stage: lint
script:
- ansible-lint --version
- ANSIBLE_CONFIG=ansible.lint.cfg ansible-lint -f codeclimate > 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
before_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 -vi 'saibotk' && printf "\n\n---\n*This is an automated release. See [#${CI_JOB_ID}]($CI_JOB_URL) for details.*")"
script:
- >
release-cli create --name "$INFRA_RELEASE_NAME" --description "$INFRA_RELEASE_DESCRIPTION"
--tag-name "v${INFRA_RELEASE_VERSION}" --ref $CI_COMMIT_SHA
rules:
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $INFRA_RELEASE_NOW == "true" && $CI_COMMIT_TAG == null'