Skip to content
This repository has been archived by the owner on Mar 6, 2023. It is now read-only.

Commit

Permalink
🤖 sync with cloudalchemy/skeleton (SHA: e8ab4aa4): Merge pull request #…
Browse files Browse the repository at this point in the history
…12 from cloudalchemy/superq/update_mergify
  • Loading branch information
cloudalchemybot committed Feb 7, 2022
1 parent e42e7ef commit fbcc39d
Show file tree
Hide file tree
Showing 7 changed files with 76 additions and 96 deletions.
89 changes: 31 additions & 58 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,88 +3,55 @@ version: 2.1

executors:
python:
docker:
- image: cimg/python:3.10
python_large:
docker:
- image: cimg/python:3.9
resource_class: large
publisher:
docker:
- image: quay.io/cloudalchemy/publisher:latest

jobs:
lint:
executor: python
steps:
- checkout
- run: pip install ansible-lint yamllint flake8
- run: pip install ansible ansible-lint yamllint flake8
- run: ansible-lint
- run: yamllint .
- run: flake8

test:
executor: python
executor: python_large
parameters:
ansible:
type: string
environment:
ANSIBLE: "<< parameters.ansible >>"
scenario:
type: string
steps:
- checkout
- setup_remote_docker
- run: ln -s ~/project ~/${CIRCLE_PROJECT_REPONAME}
- run: pip install "ansible~=<< parameters.ansible >>.0"
- run: pip install -r test-requirements.txt
- run: molecule test -s default --destroy always
- run: |
if [[ -d 'molecule/alternative' ]]; then
molecule test -s alternative --destroy never
else
echo 'No alternative test'
fi
- run: |
if [[ -z "${CIRCLE_PULL_REQUEST}" ]]; then
molecule test -s latest --destroy never
else
echo 'Not running latest on PR'
fi
- run:
no_output_timeout: 60m
command: |
if [[ -n "${CIRCLE_PULL_REQUEST}" ]] && [[ '<< parameters.scenario >>' == 'latest' ]]; then
echo 'Not running latest on PR'
else
molecule test -s '<< parameters.scenario >>' --destroy always
fi
release:
executor: python
environment:
GIT_MAIL: [email protected]
GIT_USER: cloudalchemybot
GIT_COMMIT_DESC: git log --format=%B -n 1 ${CIRCLE_SHA1}
executor: publisher
steps:
- checkout
- setup_remote_docker
- run: pip install git-semver
- run: git config --global user.email "${GIT_MAIL}"
- run: git config --global user.name "${GIT_USER}"
- run: |
GIT_TAG=none
echo "Last commit message: ${GIT_COMMIT_DESC}"
case "${GIT_COMMIT_DESC}" in
*"[patch]"*|*"[fix]"*|*"[bugfix]"* ) GIT_TAG=$(git semver --next-patch) ;;
*"[minor]"*|*"[feat]"*|*"[feature]"* ) GIT_TAG=$(git semver --next-minor) ;;
*"[major]"*|*"[breaking change]"* ) GIT_TAG=$(git semver --next-major) ;;
*) echo "Keyword not detected. Doing nothing" && circleci-agent step halt ;;
esac
echo "GIT_TAG=${GIT_TAG}" >> $BASH_ENV
- run: |
docker run -it --rm \
-v "${CIRCLE_WORKING_DIRECTORY}:/role" \
-w "/role" \
ferrarimarco/github-changelog-generator:1.15.2 \
--user "${CIRCLE_PROJECT_USERNAME}" \
--project "${CIRCLE_PROJECT_REPONAME}" \
--token "${GH_TOKEN}" \
--release-url "https://galaxy.ansible.com/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME#ansible-}" \
--unreleased-label "**Next release**" --no-compare-link \
--future-release "${GIT_TAG}"
- run: git add CHANGELOG.md
- run: git commit -m "[ci skip] Automatic changelog update"
- run: git push "https://${GH_TOKEN}:@${GIT_URL}" || circleci-agent step halt
- run: |
ghr \
-t ${GH_TOKEN} \
-u ${CIRCLE_PROJECT_USERNAME} \
-r ${CIRCLE_PROJECT_REPONAME} \
-n ${GIT_TAG} \
-b "$(sed -n -e '/## \[0.22.0\]/,/## \[/ p' CHANGELOG.md | sed -e '$ d')" \
${GIT_TAG}
PROJECT_USERNAME="${CIRCLE_PROJECT_USERNAME}" \
PROJECT_REPONAME="${CIRCLE_PROJECT_REPONAME}" \
create_release
galaxy:
executor: python
steps:
Expand All @@ -106,6 +73,12 @@ workflows:
ansible:
- "2.9"
- "2.10"
- "4.10"
- "5.1"
scenario:
- default
- alternative
- latest
filters:
tags:
only: /.*/
Expand Down
6 changes: 3 additions & 3 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@ area/docs:
- meta/*
- CHANGELOG.md
- CONTRIBUTING.md
- TROUBLESHOOTING.md
- LICENSE
- README.md
area/tests:
- molecule/*
- molecule/**/*
- .ansible-lint
- .yamllint
- test-requirements.txt
- tox.ini
area/automation:
- .travis/*
- .circleci/*
- .github/*
- .github/**/*
- .travis.yml
- .mergify.yml
area/vars:
- defaults/*
Expand Down
29 changes: 26 additions & 3 deletions .mergify.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,35 @@
---
queue_rules:
- name: default
conditions:
# These need to stay in sync with auto-maintenance/.github/settings.yml.
- "check-success=/circleci: lint"
- "check-success=/circleci: test-2.9-default"
- "check-success=/circleci: test-2.9-alternative"
- "check-success=/circleci: test-2.10-default"
- "check-success=/circleci: test-2.10-alternative"
- "check-success=/circleci: test-4.10-default"
- "check-success=/circleci: test-4.10-alternative"
- "check-success=/circleci: test-5.1-default"
- "check-success=/circleci: test-5.1-alternative"

pull_request_rules:
- name: automatic merge and new release from cloudalchemybot
conditions:
- "status-success=Travis CI - Pull Request"
- status-success=WIP
- head~=autoupdate|skeleton
- author=cloudalchemybot
# These need to stay in sync with auto-maintenance/.github/settings.yml.
- "check-success=/circleci: lint"
- "check-success=/circleci: test-2.9-default"
- "check-success=/circleci: test-2.9-alternative"
- "check-success=/circleci: test-2.10-default"
- "check-success=/circleci: test-2.10-alternative"
- "check-success=/circleci: test-4.10-default"
- "check-success=/circleci: test-4.10-alternative"
- "check-success=/circleci: test-5.1-default"
- "check-success=/circleci: test-5.1-alternative"
actions:
merge:
queue:
method: squash
strict: true
name: default
17 changes: 9 additions & 8 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,17 @@ Some great guidelines can be found [here](https://wiki.openstack.org/wiki/GitCom
## Releases

We try to stick to semantic versioning and our releases are automated. Release is created by assigning a keyword (in a
way similar to travis [`[ci skip]`](https://docs.travis-ci.com/user/customizing-the-build#Skipping-a-build)) to a
commit with merge request. Available keywords are (square brackets are important!):
way similar to circle ci keyword [`[ci skip]`](https://docs.travis-ci.com/user/customizing-the-build#Skipping-a-build))
to a commit with merge request. Available keywords are (square brackets are important!):

* `[patch]`, `[fix]` - for PATCH version release
* `[patch]`, `[fix]`, `[bugfix]` - for PATCH version release
* `[minor]`, `[feature]`, `[feat]` - for MINOR version release
* `[major]`, `[breaking change]` - for MAJOR version release

## Changelog

Changelog is generateg automatically on every merged Pull Request and all information is taken from github issues, PRs
and labels.
Changelog is generated automatically during release process and all information is taken from github issues, PRs and
labels.

## Expectations

Expand Down Expand Up @@ -78,8 +78,9 @@ More information about:
Please follow [ansible best practices](http://docs.ansible.com/ansible/latest/playbooks_best_practices.html) and
especially provide meaningful names to tasks and even comments where needed.

Our test framework automatically lints code with [`yamllint`](https://yamllint.readthedocs.io) and
[`ansible-lint`](https://github.com/willthames/ansible-lint) programs so be sure to follow their rules.
Our test framework automatically lints code with [`yamllint`](https://github.com/adrienverge/yamllint),
[`ansible-lint`](https://github.com/willthames/ansible-lint), and [`flake8`](https://gitlab.com/pycqa/flake8) programs
so be sure to follow their rules.

Remember: Code is generally read much more often than written.

Expand All @@ -92,6 +93,6 @@ Wherever possible, please refrain from any other formats and stick to simple mar
We are trying to create the best and most secure installation method for non-containerized prometheus stack components.
To accomplish this all roles need to support:

- current and at least one previous ansible version (wherever possible we try to support 2 previous ansible versions)
- current and at least one previous ansible version
- systemd as the only available process manager
- at least latest debian and CentOS distributions
21 changes: 3 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,26 +85,11 @@ We provide demo site for full monitoring solution based on prometheus and grafan
## Local Testing
The preferred way of locally testing the role is to use Docker and [molecule](https://github.com/metacloud/molecule) (v2.x). You will have to install Docker on your system. See "Get started" for a Docker package suitable to for your system.
We are using tox to simplify process of testing on multiple ansible versions. To install tox execute:
```sh
pip3 install tox
```
To run tests on all ansible versions (WARNING: this can take some time)
```sh
tox
```
To run a custom molecule command on custom environment with only default test scenario:
```sh
tox -e py35-ansible28 -- molecule test -s default
```
For more information about molecule go to their [docs](http://molecule.readthedocs.io/en/latest/).

If you would like to run tests on remote docker host just specify `DOCKER_HOST` variable before running tox tests.
The preferred way of locally testing the role is to use Docker and [molecule](https://github.com/ansible-community/molecule) (v3.x). You will have to install Docker on your system. See "Get started" for a Docker package suitable to for your system. Running your tests is as simple as executing `molecule test`.

## Travis CI
## Continuous Integration

Combining molecule and travis CI allows us to test how new PRs will behave when used with multiple ansible versions and multiple operating systems. This also allows use to create test scenarios for different role configurations. As a result we have a quite large test matrix which will take more time than local testing, so please be patient.
Combining molecule and circle CI allows us to test how new PRs will behave when used with multiple ansible versions and multiple operating systems. This also allows use to create test scenarios for different role configurations. As a result we have a quite large test matrix which can take more time than local testing, so please be patient.

## Contributing

Expand Down
5 changes: 0 additions & 5 deletions molecule/default/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@ dependency:
name: galaxy
driver:
name: docker
# lint: |
# set -e
# yamllint .
# ansible-lint
# flake8
platforms:
- name: bionic
pre_build_image: true
Expand Down
5 changes: 4 additions & 1 deletion test-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
molecule>=3.0.0
# temporarily lock versions of molecule and ansible-compat to avoid a bug:
# https://github.com/ansible-community/ansible-compat/issues/114
ansible-compat==0.5.0
molecule==3.5.2
molecule-docker
docker
ansible-lint>=3.4.0
Expand Down

0 comments on commit fbcc39d

Please sign in to comment.