diff --git a/.circleci/config.yml b/.circleci/config.yml index 078e5d2..d9115e8 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -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 @@ -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~=<>.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}" ]] && [[ -d 'molecule/latest' ]]; then - molecule test -s latest --destroy never + 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: diff --git a/.github/labeler.yml b/.github/labeler.yml index 9b49a1d..a51caa9 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -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/* diff --git a/.mergify.yml b/.mergify.yml index 877a482..b739105 100644 --- a/.mergify.yml +++ b/.mergify.yml @@ -10,3 +10,7 @@ pull_request_rules: merge: method: squash strict: true + - name: delete head branch after merge + conditions: [] + actions: + delete_head_branch: {} diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 897372d..f922673 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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 @@ -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. @@ -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 diff --git a/README.md b/README.md index 7bf9343..8b927a6 100644 --- a/README.md +++ b/README.md @@ -42,26 +42,11 @@ The role will search in the paths defined in `coredns_zone_files_paths` in the A ## 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 diff --git a/molecule/default/molecule.yml b/molecule/default/molecule.yml index 8937ee8..c03bcf2 100644 --- a/molecule/default/molecule.yml +++ b/molecule/default/molecule.yml @@ -3,11 +3,6 @@ dependency: name: galaxy driver: name: docker -# lint: | -# set -e -# yamllint . -# ansible-lint -# flake8 platforms: - name: bionic pre_build_image: true