Skip to content

Commit a1cf337

Browse files
committed
switch to molecule v3 and circleci
1 parent 47cce73 commit a1cf337

File tree

14 files changed

+154
-234
lines changed

14 files changed

+154
-234
lines changed

.circleci/config.yml

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
---
2+
version: 2.1
3+
4+
executors:
5+
python:
6+
docker:
7+
- image: cimg/python:3.9
8+
9+
jobs:
10+
lint:
11+
executor: python
12+
steps:
13+
- checkout
14+
- run: pip install ansible-lint yamllint flake8
15+
- run: ansible-lint
16+
- run: yamllint .
17+
- run: flake8
18+
19+
test:
20+
executor: python
21+
parameters:
22+
ansible:
23+
type: string
24+
environment:
25+
ANSIBLE: "<< parameters.ansible >>"
26+
steps:
27+
- checkout
28+
- setup_remote_docker
29+
- run: ln -s ~/project ~/${CIRCLE_PROJECT_REPONAME}
30+
- run: pip install -r test-requirements.txt
31+
- run: molecule test -s default --destroy always
32+
- run: |
33+
if [[ -d 'molecule/alternative' ]]; then
34+
molecule test -s alternative --destroy never
35+
else
36+
echo 'No alternative test'
37+
fi
38+
- run: |
39+
if [[ -z "${CIRCLE_PULL_REQUEST}" ]]; then
40+
molecule test -s latest --destroy never
41+
else
42+
echo 'Not running latest on PR'
43+
fi
44+
release:
45+
executor: python
46+
environment:
47+
48+
GIT_USER: cloudalchemybot
49+
GIT_COMMIT_DESC: git log --format=%B -n 1 ${CIRCLE_SHA1}
50+
steps:
51+
- checkout
52+
- setup_remote_docker
53+
- run: pip install git-semver
54+
- run: git config --global user.email "${GIT_MAIL}"
55+
- run: git config --global user.name "${GIT_USER}"
56+
- run: |
57+
GIT_TAG=none
58+
echo "Last commit message: ${GIT_COMMIT_DESC}"
59+
case "${GIT_COMMIT_DESC}" in
60+
*"[patch]"*|*"[fix]"*|*"[bugfix]"* ) GIT_TAG=$(git semver --next-patch) ;;
61+
*"[minor]"*|*"[feat]"*|*"[feature]"* ) GIT_TAG=$(git semver --next-minor) ;;
62+
*"[major]"*|*"[breaking change]"* ) GIT_TAG=$(git semver --next-major) ;;
63+
*) echo "Keyword not detected. Doing nothing" && circleci-agent step halt ;;
64+
esac
65+
echo "GIT_TAG=${GIT_TAG}" >> $BASH_ENV
66+
- run: |
67+
docker run -it --rm \
68+
-v "${CIRCLE_WORKING_DIRECTORY}:/role" \
69+
-w "/role" \
70+
ferrarimarco/github-changelog-generator:1.15.2 \
71+
--user "${CIRCLE_PROJECT_USERNAME}" \
72+
--project "${CIRCLE_PROJECT_REPONAME}" \
73+
--token "${GH_TOKEN}" \
74+
--release-url "https://galaxy.ansible.com/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME#ansible-}" \
75+
--unreleased-label "**Next release**" --no-compare-link \
76+
--future-release "${GIT_TAG}"
77+
- run: git add CHANGELOG.md
78+
- run: git commit -m "[ci skip] Automatic changelog update"
79+
- run: git push "https://${GH_TOKEN}:@${GIT_URL}" || circleci-agent step halt
80+
- run: |
81+
ghr \
82+
-t ${GH_TOKEN} \
83+
-u ${CIRCLE_PROJECT_USERNAME} \
84+
-r ${CIRCLE_PROJECT_REPONAME} \
85+
-n ${GIT_TAG} \
86+
-b "$(sed -n -e '/## \[0.22.0\]/,/## \[/ p' CHANGELOG.md | sed -e '$ d')" \
87+
${GIT_TAG}
88+
galaxy:
89+
executor: python
90+
steps:
91+
- checkout
92+
- run: pip install ansible
93+
- run: ansible-galaxy role import --token "${GALAXY_TOKEN}" "${CIRCLE_PROJECT_USERNAME}" "${CIRCLE_PROJECT_REPONAME}"
94+
95+
workflows:
96+
version: 2
97+
molecule:
98+
jobs:
99+
- lint:
100+
filters:
101+
tags:
102+
only: /.*/
103+
- test:
104+
matrix:
105+
parameters:
106+
ansible:
107+
- "2.9"
108+
- "2.10"
109+
filters:
110+
tags:
111+
only: /.*/
112+
- release:
113+
context: release
114+
requires:
115+
- lint
116+
- test
117+
filters:
118+
branches:
119+
only: master
120+
tags:
121+
ignore: /.*/
122+
- galaxy:
123+
context: galaxy
124+
requires:
125+
- lint
126+
- test
127+
- release
128+
filters:
129+
branches:
130+
only: master

.github/settings.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
_extends: auto-maintenance

.mergify.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,3 @@ 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: {}

.travis.yml

Lines changed: 0 additions & 28 deletions
This file was deleted.

.travis/releaser.sh

Lines changed: 0 additions & 71 deletions
This file was deleted.

.travis/test.sh

Lines changed: 0 additions & 12 deletions
This file was deleted.

.yamllint

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
---
22
extends: default
33
ignore: |
4-
.travis/
5-
.travis.yml
64
.github/
7-
.tox/
85
meta/
96

107
rules:

molecule/alternative/molecule.yml

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,43 +3,44 @@ 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
8+
pre_build_image: true
139
image: quay.io/paulfantom/molecule-systemd:ubuntu-18.04
1410
docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}"
1511
privileged: true
1612
volumes:
1713
- /sys/fs/cgroup:/sys/fs/cgroup:ro
1814
- name: xenial
15+
pre_build_image: true
1916
image: quay.io/paulfantom/molecule-systemd:ubuntu-16.04
2017
docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}"
2118
privileged: true
2219
volumes:
2320
- /sys/fs/cgroup:/sys/fs/cgroup:ro
2421
- name: stretch
22+
pre_build_image: true
2523
image: quay.io/paulfantom/molecule-systemd:debian-9
2624
docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}"
2725
privileged: true
2826
volumes:
2927
- /sys/fs/cgroup:/sys/fs/cgroup:ro
3028
- name: buster
29+
pre_build_image: true
3130
image: quay.io/paulfantom/molecule-systemd:debian-10
3231
docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}"
3332
privileged: true
3433
volumes:
3534
- /sys/fs/cgroup:/sys/fs/cgroup:ro
3635
- name: centos7
36+
pre_build_image: true
3737
image: quay.io/paulfantom/molecule-systemd:centos-7
3838
docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}"
3939
privileged: true
4040
volumes:
4141
- /sys/fs/cgroup:/sys/fs/cgroup:ro
4242
- name: centos8
43+
pre_build_image: true
4344
image: quay.io/paulfantom/molecule-systemd:centos-8
4445
docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}"
4546
privileged: true
@@ -48,6 +49,7 @@ platforms:
4849
groups:
4950
- python3
5051
- name: fedora
52+
pre_build_image: true
5153
image: quay.io/paulfantom/molecule-systemd:fedora-30
5254
docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}"
5355
privileged: true
@@ -57,18 +59,12 @@ platforms:
5759
- python3
5860
provisioner:
5961
name: ansible
60-
lint:
61-
name: ansible-lint
6262
playbooks:
63-
create: ../default/create.yml
6463
prepare: prepare.yml
6564
converge: playbook.yml
66-
destroy: ../default/destroy.yml
6765
inventory:
6866
group_vars:
6967
python3:
7068
ansible_python_interpreter: /usr/bin/python3
71-
scenario:
72-
name: alternative
7369
verifier:
7470
name: testinfra

molecule/default/create.yml

Lines changed: 0 additions & 37 deletions
This file was deleted.

0 commit comments

Comments
 (0)