Skip to content

Commit ab069b4

Browse files
authored
Merge pull request #18 from cloudalchemy/skeleton
2 parents 52c11f1 + 56a7cb0 commit ab069b4

File tree

7 files changed

+34
-89
lines changed

7 files changed

+34
-89
lines changed

.ansible-lint

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
---
22
skip_list:
3-
- '106'
4-
- '204'
3+
- '106'
4+
- '204'

.circleci/config.yml

Lines changed: 13 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,16 @@ executors:
55
python:
66
docker:
77
- image: cimg/python:3.9
8+
publisher:
9+
docker:
10+
- image: quay.io/cloudalchemy/publisher:latest
811

912
jobs:
1013
lint:
1114
executor: python
1215
steps:
1316
- checkout
14-
- run: pip install ansible ansible-lint yamllint flake8 ansible
17+
- run: pip install ansible ansible-lint yamllint flake8
1518
- run: mkdir -p .cache/roles && ln -s ../.. .cache/roles/${CIRCLE_PROJECT_REPONAME}
1619
- run: ansible-lint
1720
- run: yamllint .
@@ -22,77 +25,34 @@ jobs:
2225
parameters:
2326
ansible:
2427
type: string
25-
environment:
26-
ANSIBLE: "<< parameters.ansible >>"
2728
steps:
2829
- checkout
2930
- setup_remote_docker
3031
- run: ln -s ~/project ~/${CIRCLE_PROJECT_REPONAME}
31-
- run: pip install -r test-requirements.txt
3232
- run: pip install "ansible~=<<parameters.ansible >>.0"
33+
- run: pip install -r test-requirements.txt
3334
- run: molecule test -s default --destroy always
3435
- run: |
3536
if [[ -d 'molecule/alternative' ]]; then
36-
molecule test -s alternative --destroy never
37+
molecule test -s alternative --destroy always
3738
else
3839
echo 'No alternative test'
3940
fi
4041
- run: |
41-
if [[ -d 'molecule/services' ]]; then
42-
molecule test -s services --destroy never
43-
else
44-
echo 'No services test'
45-
fi
46-
- run: |
47-
if [[ -z "${CIRCLE_PULL_REQUEST}" ]]; then
48-
molecule test -s latest --destroy never
42+
if [[ -z "${CIRCLE_PULL_REQUEST}" ]] && [[ -d 'molecule/latest' ]]; then
43+
molecule test -s latest --destroy always
4944
else
5045
echo 'Not running latest on PR'
5146
fi
5247
release:
53-
executor: python
54-
environment:
55-
56-
GIT_USER: cloudalchemybot
57-
GIT_COMMIT_DESC: git log --format=%B -n 1 ${CIRCLE_SHA1}
48+
executor: publisher
5849
steps:
5950
- checkout
60-
- setup_remote_docker
61-
- run: pip install git-semver
62-
- run: git config --global user.email "${GIT_MAIL}"
63-
- run: git config --global user.name "${GIT_USER}"
64-
- run: |
65-
GIT_TAG=none
66-
echo "Last commit message: ${GIT_COMMIT_DESC}"
67-
case "${GIT_COMMIT_DESC}" in
68-
*"[patch]"*|*"[fix]"*|*"[bugfix]"* ) GIT_TAG=$(git semver --next-patch) ;;
69-
*"[minor]"*|*"[feat]"*|*"[feature]"* ) GIT_TAG=$(git semver --next-minor) ;;
70-
*"[major]"*|*"[breaking change]"* ) GIT_TAG=$(git semver --next-major) ;;
71-
*) echo "Keyword not detected. Doing nothing" && circleci-agent step halt ;;
72-
esac
73-
echo "GIT_TAG=${GIT_TAG}" >> $BASH_ENV
7451
- run: |
75-
docker run -it --rm \
76-
-v "${CIRCLE_WORKING_DIRECTORY}:/role" \
77-
-w "/role" \
78-
ferrarimarco/github-changelog-generator:1.15.2 \
79-
--user "${CIRCLE_PROJECT_USERNAME}" \
80-
--project "${CIRCLE_PROJECT_REPONAME}" \
81-
--token "${GH_TOKEN}" \
82-
--release-url "https://galaxy.ansible.com/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME#ansible-}" \
83-
--unreleased-label "**Next release**" --no-compare-link \
84-
--future-release "${GIT_TAG}"
85-
- run: git add CHANGELOG.md
86-
- run: git commit -m "[ci skip] Automatic changelog update"
87-
- run: git push "https://${GH_TOKEN}:@${GIT_URL}" || circleci-agent step halt
88-
- run: |
89-
ghr \
90-
-t ${GH_TOKEN} \
91-
-u ${CIRCLE_PROJECT_USERNAME} \
92-
-r ${CIRCLE_PROJECT_REPONAME} \
93-
-n ${GIT_TAG} \
94-
-b "$(sed -n -e '/## \[0.22.0\]/,/## \[/ p' CHANGELOG.md | sed -e '$ d')" \
95-
${GIT_TAG}
52+
PROJECT_USERNAME="${CIRCLE_PROJECT_USERNAME}" \
53+
PROJECT_REPONAME="${CIRCLE_PROJECT_REPONAME}" \
54+
create_release
55+
9656
galaxy:
9757
executor: python
9858
steps:

.github/labeler.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,19 @@ area/docs:
44
- meta/*
55
- CHANGELOG.md
66
- CONTRIBUTING.md
7+
- TROUBLESHOOTING.md
78
- LICENSE
89
- README.md
910
area/tests:
1011
- molecule/*
1112
- molecule/**/*
1213
- .ansible-lint
14+
- .yamllint
1315
- test-requirements.txt
14-
- tox.ini
1516
area/automation:
16-
- .travis/*
17+
- .circleci/*
1718
- .github/*
1819
- .github/**/*
19-
- .travis.yml
2020
- .mergify.yml
2121
area/vars:
2222
- defaults/*

.mergify.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,7 @@ pull_request_rules:
1010
merge:
1111
method: squash
1212
strict: true
13+
- name: delete head branch after merge
14+
conditions: []
15+
actions:
16+
delete_head_branch: {}

CONTRIBUTING.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,17 @@ Some great guidelines can be found [here](https://wiki.openstack.org/wiki/GitCom
3434
## Releases
3535

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

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

4444
## Changelog
4545

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

4949
## Expectations
5050

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

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

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

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

95-
- current and at least one previous ansible version (wherever possible we try to support 2 previous ansible versions)
96+
- current and at least one previous ansible version
9697
- systemd as the only available process manager
9798
- at least latest debian and CentOS distributions

README.md

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -105,26 +105,11 @@ You can run the different Cortex modules as separate services by setting
105105

106106
## Local Testing
107107

108-
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.
109-
We are using tox to simplify process of testing on multiple ansible versions. To install tox execute:
110-
```sh
111-
pip3 install tox
112-
```
113-
To run tests on all ansible versions (WARNING: this can take some time)
114-
```sh
115-
tox
116-
```
117-
To run a custom molecule command on custom environment with only default test scenario:
118-
```sh
119-
tox -e py35-ansible28 -- molecule test -s default
120-
```
121-
For more information about molecule go to their [docs](http://molecule.readthedocs.io/en/latest/).
122-
123-
If you would like to run tests on remote docker host just specify `DOCKER_HOST` variable before running tox tests.
108+
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`.
124109

125-
## Travis CI
110+
## Continuous Intergation
126111

127-
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.
112+
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.
128113

129114
## Contributing
130115

molecule/default/molecule.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,6 @@ dependency:
33
name: galaxy
44
driver:
55
name: docker
6-
# lint: |
7-
# set -e
8-
# yamllint .
9-
# ansible-lint
10-
# flake8
116
platforms:
127
- name: bionic
138
pre_build_image: true

0 commit comments

Comments
 (0)