Skip to content

Commit 4d07532

Browse files
Different way of testing, simpler.
1 parent 83bb503 commit 4d07532

File tree

8 files changed

+64
-116
lines changed

8 files changed

+64
-116
lines changed

.github/workflows/galaxy.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010
types: [created, edited, published, released]
1111
jobs:
1212
release:
13-
runs-on: ubuntu-20.04
13+
runs-on: ubuntu-latest
1414
steps:
1515
- name: galaxy
1616
uses: robertdebock/galaxy-action@1.2.1

.github/workflows/molecule.yml

+40-96
Original file line numberDiff line numberDiff line change
@@ -15,23 +15,21 @@ on:
1515

1616
jobs:
1717
lint:
18-
runs-on: ubuntu-20.04
18+
runs-on: ubuntu-latest
1919
steps:
2020
- name: checkout
2121
uses: actions/checkout@v4
2222
- name: ansible-lint
2323
uses: ansible-community/ansible-lint-action@main
2424

25-
python-3-9:
25+
molecule:
2626
needs:
2727
- lint
28-
runs-on: ubuntu-20.04
29-
container:
30-
image: python:3.9
28+
runs-on: ubuntu-latest
3129
strategy:
3230
fail-fast: false
3331
matrix:
34-
config:
32+
distro:
3533
- image: "enterpriselinux"
3634
tag: "latest"
3735
- image: "debian"
@@ -42,8 +40,6 @@ jobs:
4240
tag: "40"
4341
- image: "fedora"
4442
tag: "latest"
45-
- image: "fedora"
46-
tag: "rawhide"
4743
- image: "ubuntu"
4844
tag: "latest"
4945
- image: "ubuntu"
@@ -53,98 +49,46 @@ jobs:
5349
steps:
5450
- name: checkout
5551
uses: actions/checkout@v4
52+
with:
53+
path: ansible-role-rundeck
54+
55+
- name: Set up Python
56+
uses: actions/setup-python@v5
57+
with:
58+
python-version: "3.13"
5659

57-
- name: molecule
60+
- name: Configure Docker for systemd
5861
run: |
59-
apt-get update -qq
60-
apt-get -y -qq install yamllint docker.io
61-
pip install --no-cache-dir tox
62-
if [ -f tox.ini ] ; then tox ; fi
63-
if [ ! -f tox.ini ] ; then pip install -r requirements.yml ; pip install ansible-lint ansible-core ; molecule test ; fi
64-
env:
65-
image: ${{ matrix.config.image }}
66-
tag: ${{ matrix.config.tag }}
67-
python-3-10:
68-
needs:
69-
- lint
70-
runs-on: ubuntu-20.04
71-
container:
72-
image: python:3.10
73-
strategy:
74-
fail-fast: false
75-
matrix:
76-
config:
77-
- image: "enterpriselinux"
78-
tag: "latest"
79-
- image: "debian"
80-
tag: "latest"
81-
- image: "debian"
82-
tag: "bullseye"
83-
- image: "fedora"
84-
tag: "40"
85-
- image: "fedora"
86-
tag: "latest"
87-
- image: "fedora"
88-
tag: "rawhide"
89-
- image: "ubuntu"
90-
tag: "latest"
91-
- image: "ubuntu"
92-
tag: "jammy"
93-
- image: "ubuntu"
94-
tag: "focal"
95-
steps:
96-
- name: checkout
97-
uses: actions/checkout@v4
62+
sudo mkdir -p /etc/docker
63+
echo '{
64+
"features": {
65+
"buildkit": true
66+
},
67+
"exec-opts": ["native.cgroupdriver=systemd"]
68+
}' | sudo tee /etc/docker/daemon.json
69+
sudo systemctl restart docker || true
9870
99-
- name: molecule
71+
- name: Install Docker
72+
uses: docker/setup-buildx-action@v3
73+
74+
- name: Install dependencies
10075
run: |
101-
apt-get update -qq
102-
apt-get -y -qq install yamllint docker.io
103-
pip install --no-cache-dir tox
104-
if [ -f tox.ini ] ; then tox ; fi
105-
if [ ! -f tox.ini ] ; then pip install -r requirements.yml ; pip install ansible-lint ansible-core ; molecule test ; fi
106-
env:
107-
image: ${{ matrix.config.image }}
108-
tag: ${{ matrix.config.tag }}
109-
python-3-13:
110-
needs:
111-
- lint
112-
runs-on: ubuntu-20.04
113-
container:
114-
image: python:3.13
115-
strategy:
116-
fail-fast: false
117-
matrix:
118-
config:
119-
- image: "enterpriselinux"
120-
tag: "latest"
121-
- image: "debian"
122-
tag: "latest"
123-
- image: "debian"
124-
tag: "bullseye"
125-
- image: "fedora"
126-
tag: "40"
127-
- image: "fedora"
128-
tag: "latest"
129-
- image: "fedora"
130-
tag: "rawhide"
131-
- image: "ubuntu"
132-
tag: "latest"
133-
- image: "ubuntu"
134-
tag: "jammy"
135-
- image: "ubuntu"
136-
tag: "focal"
137-
steps:
138-
- name: checkout
139-
uses: actions/checkout@v4
76+
python -m pip install --upgrade pip
77+
pip install ansible-lint molecule molecule-plugins[docker] ansible-core
78+
if [ -f ansible-role-rundeck/requirements.txt ]; then pip install -r ansible-role-rundeck/requirements.txt; fi
79+
if [ -f ansible-role-rundeck/requirements.yml ]; then ansible-galaxy install -r ansible-role-rundeck/requirements.yml; fi
80+
81+
# Create proper role directory structure for molecule
82+
mkdir -p ~/.ansible/roles
83+
ln -s ${GITHUB_WORKSPACE}/ansible-role-rundeck ~/.ansible/roles/robertdebock.rundeck
14084
141-
- name: molecule
85+
- name: Test with molecule
14286
run: |
143-
apt-get update -qq
144-
apt-get -y -qq install yamllint docker.io
145-
pip install --no-cache-dir tox
146-
if [ -f tox.ini ] ; then tox ; fi
147-
if [ ! -f tox.ini ] ; then pip install -r requirements.yml ; pip install ansible-lint ansible-core ; molecule test ; fi
87+
cd ansible-role-rundeck
88+
molecule test
14889
env:
149-
image: ${{ matrix.config.image }}
150-
tag: ${{ matrix.config.tag }}
90+
PY_COLORS: 1
91+
ANSIBLE_FORCE_COLOR: 1
92+
ANSIBLE_ROLES_PATH: ~/.ansible/roles:${GITHUB_WORKSPACE}/ansible-role-rundeck
93+
image: ${{ matrix.distro.image }}
94+
tag: ${{ matrix.distro.tag }}

.github/workflows/requirements2png.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ name: Ansible Graphviz
1010

1111
jobs:
1212
build:
13-
runs-on: ubuntu-20.04
13+
runs-on: ubuntu-latest
1414
permissions:
1515
contents: write
1616
steps:

.github/workflows/todo.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010

1111
jobs:
1212
build:
13-
runs-on: "ubuntu-20.04"
13+
runs-on: "ubuntu-latest"
1414
steps:
1515
- uses: actions/checkout@v4
1616
- name: "TODO to Issue"

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44
.tox
55
.cache
66
.DS_Store
7+
.ansible

.gitlab-ci.yml

+18-16
Original file line numberDiff line numberDiff line change
@@ -4,48 +4,50 @@ variables:
44
DEBIAN_FRONTEND: noninteractive
55

66
molecule:
7-
image: $python
7+
image: python:3.13
88
script:
99
- apt-get update -qq
1010
- apt-get -y -qq install yamllint docker.io
11-
- pip install --no-cache-dir tox
12-
- if [ -f tox.ini ] ; then tox ; fi
13-
- if [ ! -f tox.ini ] ; then pip install -r requirements.yml ; pip install ansible-lint ansible-core ; molecule test ; fi
11+
# Configure Docker for systemd
12+
- mkdir -p /etc/docker
13+
- echo '{"features":{"buildkit":true},"exec-opts":["native.cgroupdriver=systemd"]}' > /etc/docker/daemon.json
14+
- service docker restart || true
15+
# Install dependencies and run tests
16+
- pip install --no-cache-dir ansible-lint molecule molecule-plugins[docker] ansible-core
17+
- if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
18+
- if [ -f requirements.yml ]; then ansible-galaxy install -r requirements.yml; fi
19+
# Create proper role directory structure for molecule
20+
- mkdir -p ~/.ansible/roles
21+
- ln -s $CI_PROJECT_DIR ~/.ansible/roles/robertdebock.rundeck
22+
# Run molecule tests
23+
- cd $CI_PROJECT_DIR
24+
- ANSIBLE_ROLES_PATH=~/.ansible/roles:$CI_PROJECT_DIR molecule test
1425
rules:
1526
- if: $CI_COMMIT_REF_NAME == "master"
1627
parallel:
1728
matrix:
1829
- image: "enterpriselinux"
1930
tag: "latest"
20-
python: ['python:3.9', 'python:3.10', 'python:3.13']
2131
- image: "debian"
2232
tag: "latest"
23-
python: ['python:3.9', 'python:3.10', 'python:3.13']
2433
- image: "debian"
2534
tag: "bullseye"
26-
python: ['python:3.9', 'python:3.10', 'python:3.13']
2735
- image: "fedora"
2836
tag: "40"
29-
python: ['python:3.9', 'python:3.10', 'python:3.13']
3037
- image: "fedora"
3138
tag: "latest"
32-
python: ['python:3.9', 'python:3.10', 'python:3.13']
33-
- image: "fedora"
34-
tag: "rawhide"
35-
python: ['python:3.9', 'python:3.10', 'python:3.13']
3639
- image: "ubuntu"
3740
tag: "latest"
38-
python: ['python:3.9', 'python:3.10', 'python:3.13']
3941
- image: "ubuntu"
4042
tag: "jammy"
41-
python: ['python:3.9', 'python:3.10', 'python:3.13']
4243
- image: "ubuntu"
4344
tag: "focal"
44-
python: ['python:3.9', 'python:3.10', 'python:3.13']
4545

4646
galaxy:
47+
image: python:3.13
4748
script:
48-
- apk add ansible-core
49+
- apt-get update -qq
50+
- apt-get -y -qq install ansible-core
4951
- ansible-galaxy role import --api-key ${GALAXY_API_KEY} robertdebock ${CI_PROJECT_NAME}
5052
rules:
5153
- if: $CI_COMMIT_TAG != null

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ This example is taken from [`molecule/default/converge.yml`](https://github.com/
1818
gather_facts: true
1919

2020
roles:
21-
- role: robertdebock.rundeck
21+
- role: ansible-role-rundeck
2222
```
2323
2424
The machine needs to be prepared. In CI this is done using [`molecule/default/prepare.yml`](https://github.com/robertdebock/ansible-role-rundeck/blob/master/molecule/default/prepare.yml):

molecule/default/molecule.yml

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ platforms:
1717
- name: "rundeck-${image:-fedora}-${tag:-latest}${TOX_ENVNAME}"
1818
image: "${namespace:-robertdebock}/${image:-fedora}:${tag:-latest}"
1919
command: /sbin/init
20+
cgroupns_mode: host
2021
volumes:
2122
- /sys/fs/cgroup:/sys/fs/cgroup:rw
2223
privileged: true

0 commit comments

Comments
 (0)