Skip to content

Commit

Permalink
Bug when running in check mode (#8)
Browse files Browse the repository at this point in the history
* update dependency to bodsch-core 2.5.0
* add check_mode for trickster role
* add check_mode for ssl_exporter role
* add check_mode for redis_exporter role
* add check_mode for pushgateway role
* add check_mode for prometheus role
* add check_mode for promcheck role
* add check_mode for node_exporter role
* add check_mode for nginx_exporter role
* add check_mode for mysql_exporter role
* add check_mode for mongodb_exporter role
* add check_mode for json_exporter role
* add check_mode for docker_sd role
* add check_mode for blackbox_exporter role
* add check_mode for alertmanager role
* add check_mode for am_silencer role
* small side updates
  • Loading branch information
bodsch authored Dec 10, 2024
1 parent f4917ec commit 5adf943
Show file tree
Hide file tree
Showing 200 changed files with 6,438 additions and 268 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/alertmanager.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ on:
- "!Makefile"
- "!README.md"
- 'roles/alertmanager/**'
- '.github/workflows/test_role_alertmanager.yml'
- '.github/workflows/alertmanager.yml'
- '.config/ansible-lint.yml'
- '.yamllint'
pull_request:
Expand All @@ -37,7 +37,7 @@ on:
- "!Makefile"
- "!README.md"
- 'roles/alertmanager/**'
- '.github/workflows/test_role_alertmanager.yml'
- '.github/workflows/alertmanager.yml'
- '.config/ansible-lint.yml'
- '.yamllint'

Expand Down Expand Up @@ -171,6 +171,7 @@ jobs:
- configured
- latest
- custom_alert_template
- check_mode
collection_role:
- alertmanager

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/am_silence.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ on:
- "!Makefile"
- "!README.md"
- 'roles/am_silence/**'
- '.github/workflows/test_role_am_silence.yml'
- '.github/workflows/am_silence.yml'
- '.config/ansible-lint.yml'
- '.yamllint'
pull_request:
Expand All @@ -37,7 +37,7 @@ on:
- "!Makefile"
- "!README.md"
- 'roles/am_silence/**'
- '.github/workflows/test_role_am_silence.yml'
- '.github/workflows/am_silence.yml'
- '.config/ansible-lint.yml'
- '.yamllint'

Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/blackbox_exporter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ on:
- "!Makefile"
- "!README.md"
- 'roles/blackbox_exporter/**'
- '.github/workflows/test_role_blackbox_exporter.yml'
- '.github/workflows/blackbox_exporter.yml'
- '.config/ansible-lint.yml'
- '.yamllint'
pull_request:
Expand All @@ -37,7 +37,7 @@ on:
- "!Makefile"
- "!README.md"
- 'roles/blackbox_exporter/**'
- '.github/workflows/test_role_blackbox_exporter.yml'
- '.github/workflows/blackbox_exporter.yml'
- '.config/ansible-lint.yml'
- '.yamllint'

Expand Down Expand Up @@ -170,6 +170,7 @@ jobs:
scenario:
- configured
- latest
- check_mode
collection_role:
- blackbox_exporter

Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/docker_sd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ on:
- "!Makefile"
- "!README.md"
- 'roles/docker_sd/**'
- '.github/workflows/test_role_docker_sd.yml'
- '.github/workflows/docker_sd.yml'
- '.config/ansible-lint.yml'
- '.yamllint'
pull_request:
Expand All @@ -37,7 +37,7 @@ on:
- "!Makefile"
- "!README.md"
- 'roles/docker_sd/**'
- '.github/workflows/test_role_docker_sd.yml'
- '.github/workflows/docker_sd.yml'
- '.config/ansible-lint.yml'
- '.yamllint'

Expand Down Expand Up @@ -168,6 +168,7 @@ jobs:
scenario:
- configured
- latest
- check_mode
collection_role:
- docker_sd

Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/json_exporter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ on:
- "!Makefile"
- "!README.md"
- 'roles/json_exporter/**'
- '.github/workflows/test_role_json_exporter.yml'
- '.github/workflows/json_exporter.yml'
- '.config/ansible-lint.yml'
- '.yamllint'
pull_request:
Expand All @@ -37,7 +37,7 @@ on:
- "!Makefile"
- "!README.md"
- 'roles/json_exporter/**'
- '.github/workflows/test_role_json_exporter.yml'
- '.github/workflows/json_exporter.yml'
- '.config/ansible-lint.yml'
- '.yamllint'

Expand Down Expand Up @@ -170,6 +170,7 @@ jobs:
scenario:
- configured
- latest
- check_mode
collection_role:
- json_exporter

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ on:
paths:
- 'plugins/**'
- '!roles/**'
- '!.github/workflows/test_role*.yml'
- '!.github/workflows/*.yml'
- '.config/pycodestyle.cfg'
pull_request:
branches:
Expand All @@ -32,7 +32,7 @@ on:
paths:
- 'plugins/**'
- '!roles/**'
- '!.github/workflows/test_role*.yml'
- '!.github/workflows/*.yml'
- '.config/pycodestyle.cfg'

jobs:
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/mongodb_exporter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ on:
- "!Makefile"
- "!README.md"
- 'roles/mongodb_exporter/**'
- '.github/workflows/test_role_mongodb_exporter.yml'
- '.github/workflows/mongodb_exporter.yml'
- '.config/ansible-lint.yml'
- '.yamllint'
pull_request:
Expand All @@ -37,7 +37,7 @@ on:
- "!Makefile"
- "!README.md"
- 'roles/mongodb_exporter/**'
- '.github/workflows/test_role_mongodb_exporter.yml'
- '.github/workflows/mongodb_exporter.yml'
- '.config/ansible-lint.yml'
- '.yamllint'

Expand Down Expand Up @@ -170,6 +170,7 @@ jobs:
scenario:
- configured
- latest
- check_mode
collection_role:
- mongodb_exporter

Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/mysql_exporter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ on:
- "!Makefile"
- "!README.md"
- 'roles/mysql_exporter/**'
- '.github/workflows/test_role_mysql_exporter.yml'
- '.github/workflows/mysql_exporter.yml'
- '.config/ansible-lint.yml'
- '.yamllint'
pull_request:
Expand All @@ -37,7 +37,7 @@ on:
- "!Makefile"
- "!README.md"
- 'roles/mysql_exporter/**'
- '.github/workflows/test_role_mysql_exporter.yml'
- '.github/workflows/mysql_exporter.yml'
- '.config/ansible-lint.yml'
- '.yamllint'

Expand Down Expand Up @@ -168,6 +168,7 @@ jobs:
scenario:
- configured
- latest
- check_mode
collection_role:
- mysql_exporter

Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/nginx_exporter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ on:
- "!Makefile"
- "!README.md"
- 'roles/nginx_exporter/**'
- '.github/workflows/test_role_nginx_exporter.yml'
- '.github/workflows/nginx_exporter.yml'
- '.config/ansible-lint.yml'
- '.yamllint'
pull_request:
Expand All @@ -37,7 +37,7 @@ on:
- "!Makefile"
- "!README.md"
- 'roles/nginx_exporter/**'
- '.github/workflows/test_role_nginx_exporter.yml'
- '.github/workflows/nginx_exporter.yml'
- '.config/ansible-lint.yml'
- '.yamllint'

Expand Down Expand Up @@ -170,6 +170,7 @@ jobs:
scenario:
- configured
- latest
- check_mode
collection_role:
- nginx_exporter

Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/node_exporter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ on:
- "!Makefile"
- "!README.md"
- 'roles/node_exporter/**'
- '.github/workflows/test_role_node_exporter.yml'
- '.github/workflows/node_exporter.yml'
- '.config/ansible-lint.yml'
- '.yamllint'
pull_request:
Expand All @@ -37,7 +37,7 @@ on:
- "!Makefile"
- "!README.md"
- 'roles/node_exporter/**'
- '.github/workflows/test_role_node_exporter.yml'
- '.github/workflows/node_exporter.yml'
- '.config/ansible-lint.yml'
- '.yamllint'

Expand Down Expand Up @@ -171,6 +171,7 @@ jobs:
- configured
- latest
- upgrade
- check_mode
collection_role:
- node_exporter

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/node_exporter_collectors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ on:
- "!Makefile"
- "!README.md"
- 'roles/node_exporter_textfile_collectors/**'
- '.github/workflows/test_role_node_exporter_collectors.yml'
- '.github/workflows/node_exporter_collectors.yml'
- '.config/ansible-lint.yml'
- '.yamllint'
pull_request:
Expand All @@ -37,7 +37,7 @@ on:
- "!Makefile"
- "!README.md"
- 'roles/node_exporter_textfile_collectors/**'
- '.github/workflows/test_role_node_exporter_collectors.yml'
- '.github/workflows/node_exporter_collectors.yml'
- '.config/ansible-lint.yml'
- '.yamllint'

Expand Down
60 changes: 58 additions & 2 deletions .github/workflows/promcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ on:
- "!Makefile"
- "!README.md"
- 'roles/promcheck/**'
- '.github/workflows/test_role_promcheck.yml'
- '.github/workflows/promcheck.yml'
- '.config/ansible-lint.yml'
- '.yamllint'
pull_request:
Expand All @@ -37,7 +37,7 @@ on:
- "!Makefile"
- "!README.md"
- 'roles/promcheck/**'
- '.github/workflows/test_role_promcheck.yml'
- '.github/workflows/promcheck.yml'
- '.config/ansible-lint.yml'
- '.yamllint'

Expand Down Expand Up @@ -151,3 +151,59 @@ jobs:
-e DISTRIBUTION="${{ matrix.image }}" \
-e COLLECTION_ROLE="${{ matrix.collection_role }}" \
-e COLLECTION_SCENARIO="${{ matrix.scenario }}"
scenarios:
name: "${{ matrix.image }} / ${{ matrix.scenario }} / ${{ matrix.ansible-version }} / ${{ matrix.python_version }}"
runs-on: ubuntu-22.04
needs:
- debian
strategy:
fail-fast: false
matrix:
image:
- debian:12
ansible-version:
- '8.5'
python_version:
- "3.10"
- "3.11"
scenario:
- latest
- check_mode
collection_role:
- promcheck

steps:
- name: check out the codebase.
uses: actions/checkout@v4
with:
ref: ${{ github.event.workflow_run.head_branch }}

- name: 🐍 set up python
uses: actions/setup-python@v5
with:
python-version: "${{ matrix.python_version }}"

- name: install dependencies
run: |
python -m pip install --upgrade pip
pip install -r test-requirements.txt
- name: force reinstall of community.docker
run: |
mkdir -p /home/runner/.ansible/collections
ansible-galaxy collection install community.docker --force
- name: Install collection
run: |
make \
install
- name: test ${{ matrix.collection_role }} - ${{ matrix.scenario }}
run: |
make \
test \
-e TOX_ANSIBLE="ansible_${{ matrix.ansible-version }}" \
-e DISTRIBUTION="${{ matrix.image }}" \
-e COLLECTION_ROLE="${{ matrix.collection_role }}" \
-e COLLECTION_SCENARIO="${{ matrix.scenario }}"
5 changes: 3 additions & 2 deletions .github/workflows/prometheus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ on:
- "!Makefile"
- "!README.md"
- 'roles/prometheus/**'
- '.github/workflows/test_role_prometheus.yml'
- '.github/workflows/prometheus.yml'
- '.config/ansible-lint.yml'
- '.yamllint'
pull_request:
Expand All @@ -37,7 +37,7 @@ on:
- "!Makefile"
- "!README.md"
- 'roles/prometheus/**'
- '.github/workflows/test_role_prometheus.yml'
- '.github/workflows/prometheus.yml'
- '.config/ansible-lint.yml'
- '.yamllint'

Expand Down Expand Up @@ -177,6 +177,7 @@ jobs:
- latest
- upgrade
- federation
- check_mode
collection_role:
- prometheus

Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/pushgateway.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ on:
- "!Makefile"
- "!README.md"
- 'roles/pushgateway/**'
- '.github/workflows/test_role_pushgateway.yml'
- '.github/workflows/pushgateway.yml'
- '.config/ansible-lint.yml'
- '.yamllint'
pull_request:
Expand All @@ -37,7 +37,7 @@ on:
- "!Makefile"
- "!README.md"
- 'roles/pushgateway/**'
- '.github/workflows/test_role_pushgateway.yml'
- '.github/workflows/pushgateway.yml'
- '.config/ansible-lint.yml'
- '.yamllint'

Expand Down Expand Up @@ -170,6 +170,7 @@ jobs:
scenario:
- configured
- latest
- check_mode
collection_role:
- pushgateway

Expand Down
Loading

0 comments on commit 5adf943

Please sign in to comment.