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

Commit

Permalink
Merge pull request #46 from cloudalchemy/skeleton
Browse files Browse the repository at this point in the history
[REPO SYNC] Merge pull request #9 from cloudalchemy/superq/more_updates
  • Loading branch information
paulfantom authored Apr 25, 2021
2 parents c9c14e4 + 3fc805d commit fbd360e
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 80 deletions.
60 changes: 14 additions & 46 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,17 @@ executors:
python:
docker:
- image: cimg/python:3.9
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: mkdir -p .cache/roles && ln -s ../.. .cache/roles/${CIRCLE_PROJECT_REPONAME}
- run: ansible-lint
- run: yamllint .
- run: flake8
Expand All @@ -21,70 +25,34 @@ jobs:
parameters:
ansible:
type: string
environment:
ANSIBLE: "<< parameters.ansible >>"
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
molecule test -s alternative --destroy always
else
echo 'No alternative test'
fi
- run: |
if [[ -z "${CIRCLE_PULL_REQUEST}" ]]; then
molecule test -s latest --destroy never
if [[ -z "${CIRCLE_PULL_REQUEST}" ]] && [[ -d 'molecule/latest' ]]; then
molecule test -s latest --destroy always
else
echo 'Not running latest on PR'
fi
release:
executor: python
environment:
GIT_MAIL: cloudalchemybot@gmail.com
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 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
4 changes: 4 additions & 0 deletions .mergify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,7 @@ pull_request_rules:
merge:
method: squash
strict: true
- name: delete head branch after merge
conditions: []
actions:
delete_head_branch: {}
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 @@ -42,26 +42,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 Intergation

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

0 comments on commit fbd360e

Please sign in to comment.