Skip to content

Commit

Permalink
Merge branch 'main' into install_amtool_when_installation_disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
tvenieris authored Aug 26, 2023
2 parents 85ad132 + 2711027 commit f194fec
Show file tree
Hide file tree
Showing 191 changed files with 3,800 additions and 551 deletions.
13 changes: 5 additions & 8 deletions .config/molecule/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,20 +46,14 @@ platforms:
privileged: true
cgroup_parent: docker.slice
command: /lib/systemd/systemd
- name: fedora-36
image: dokken/fedora-36
pre_build_image: true
privileged: true
cgroup_parent: docker.slice
command: /lib/systemd/systemd
- name: fedora-37
image: dokken/fedora-37
pre_build_image: true
privileged: true
cgroup_parent: docker.slice
command: /lib/systemd/systemd
- name: ubuntu-18.04
image: dokken/ubuntu-18.04
- name: fedora-38
image: dokken/fedora-38
pre_build_image: true
privileged: true
cgroup_parent: docker.slice
Expand All @@ -78,3 +72,6 @@ platforms:
command: /lib/systemd/systemd
verifier:
name: testinfra
provisioner:
playbooks:
converge: "${MOLECULE_PROJECT_DIRECTORY}/../../.config/molecule/converge.yml"
8 changes: 8 additions & 0 deletions .config/molecule/converge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
- name: Converge
hosts: all
any_errors_fatal: true
tasks:
- name: "Run role"
ansible.builtin.include_role:
name: "prometheus.prometheus.{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"
22 changes: 22 additions & 0 deletions .github/scripts/lint_arguments_spec.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env bash
#
# Description: Lint the defaults/main.yml against the meta/arguments_spec.yml

lint_diff() {
diff -u \
<(yq 'keys | .[]' "${role}/defaults/main.yml" | sort -u) \
<(yq '.argument_specs.main.options | keys | .[] ' "${role}/meta/argument_specs.yml" | sort -u)
return $?
}

error=0

for role in roles/* ; do
echo "Checking ${role}"
if ! lint_diff ; then
echo "ERROR: ${role}: meta/argument_specs.yml doesn't match defaults/main.yml"
error=1
fi
done

exit "${error}"
14 changes: 12 additions & 2 deletions .github/workflows/ansible-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,16 @@ jobs:
- uses: actions/checkout@v3

- name: Lint collection
uses: ansible/ansible-lint-action@main
uses: ansible/ansible-lint@main

arguments-spec-lint:
runs-on: ubuntu-latest
container:
image: quay.io/prometheus/golang-builder:base
steps:
- uses: actions/checkout@v3
- name: Lint arguments spec
run: ./.github/scripts/lint_arguments_spec.sh

discover-ansible-versions:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -69,7 +78,7 @@ jobs:
env:
LABELS: ${{ toJson(github.event.pull_request.labels.*.name) }}
run: |
roles=$(echo $LABELS | jq -r '.[]')
roles=$(echo $LABELS | jq -r '.[]' | grep '^roles/' | sed 's|^roles/||')
echo tests="[`for role in $roles; do
for test in $(find tests/integration/targets -maxdepth 1 -mindepth 1 -type d -iname "molecule-${role}-*" -printf "%f\n"); do
echo '{"test":\"'"${test}"'\","name":\"'"${test#*-}\"'"}';
Expand All @@ -93,6 +102,7 @@ jobs:
with:
targets: ${{ needs.discover-ansible-tests.outputs.molecule-tests }}
ansible-core-versions: ${{ needs.discover-ansible-versions.outputs.versions }}
coverage: never

ansible-test-integration:
uses: ./.github/workflows/ansible-test-integration.yml
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/ansible-test-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ on:
required: false
default: '["default"]'
type: string
coverage:
required: false
default: auto
type: string

jobs:
ansible-test-integration:
Expand All @@ -36,6 +40,6 @@ jobs:
docker-image: "--docker-privileged" # Workaround because ansible-test action doesn't support setting privileged flag
testing-type: integration
target: ${{ matrix.targets.test }}
# coverage: never # https://github.com/ansible-community/ansible-test-gh-action/pull/50
coverage: ${{ inputs.coverage }}
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
2 changes: 1 addition & 1 deletion .github/workflows/conventional-label.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ jobs:
steps.changed-roles.outputs.all_changed_and_modified_files
with:
script: |
const labels = '${{ steps.changed-roles.outputs.all_changed_and_modified_files }}'.split(' ');
const labels = '${{ steps.changed-roles.outputs.all_changed_and_modified_files }}'.split(' ').map(i => 'roles/' + i);
github.rest.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
Expand Down
37 changes: 37 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,43 @@ Prometheus.Prometheus Release Notes
.. contents:: Topics


v0.6.1
======

Bugfixes
--------

- fix: blackbox_exporter ansible-lint risky-octal (https://github.com/prometheus-community/ansible/pull/174)

v0.6.0
======

Minor Changes
-------------

- feat: Add chrony_exporter role (https://github.com/prometheus-community/ansible/pull/159)
- feat: Add pushgateway role (https://github.com/prometheus-community/ansible/pull/127)
- feat: Add role smokeping_prober (https://github.com/prometheus-community/ansible/pull/128)
- feature: Agent mode support (https://github.com/prometheus-community/ansible/pull/198)
- feature: Make config installation dir configurable (https://github.com/prometheus-community/ansible/pull/173)
- feature: blackbox exporter user/group configurable (https://github.com/prometheus-community/ansible/pull/172)
- minor: support fedora 38 (https://github.com/prometheus-community/ansible/pull/202)

Removed Features (previously deprecated)
----------------------------------------

- removed: Drop fedora 36 support as it is EOL (https://github.com/prometheus-community/ansible/pull/200)
- removed: Drop ubuntu 18.04 support as it is EOL (https://github.com/prometheus-community/ansible/pull/199)

Bugfixes
--------

- fix(alertmanager): add routes before match_re (https://github.com/prometheus-community/ansible/pull/194)
- fix(node_exporter): Fix ProtectHome for textfiles (https://github.com/prometheus-community/ansible/pull/184)
- fix: Add test for argument_specs matching (https://github.com/prometheus-community/ansible/pull/177)
- fix: Make binary installs consistent (https://github.com/prometheus-community/ansible/pull/204)
- fix: mysqld_exporter should actually respect the mysqld_exporter_host variable (https://github.com/prometheus-community/ansible/pull/88)

v0.5.2
======

Expand Down
2 changes: 1 addition & 1 deletion changelogs/.plugin-cache.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ plugins:
shell: {}
strategy: {}
vars: {}
version: 0.5.2
version: 0.6.1
48 changes: 44 additions & 4 deletions changelogs/changelog.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,51 @@ releases:
- 'fix: mysqld_exporter should actually respect the mysqld_exporter_host variable
(https://github.com/prometheus-community/ansible/pull/88)'
trivial:
- 'patch: New prometheus/snmp_exporter upstream release! (https://github.com/prometheus-community/ansible/pull/146)'
- Fix mysqld_exporter world-readable secrets (https://github.com/prometheus-community/ansible/pull/169)
- 'Fix: rename collector flags (https://github.com/prometheus-community/ansible/pull/167)'
- 'patch: New prometheus/mysqld_exporter upstream release! (https://github.com/prometheus-community/ansible/pull/153)'
- 'patch: New prometheus/prometheus upstream release! (https://github.com/prometheus-community/ansible/pull/152)'
- 'patch: New prometheus/node_exporter upstream release! (https://github.com/prometheus-community/ansible/pull/162)'
- 'Fix: rename collector flags (https://github.com/prometheus-community/ansible/pull/167)'
- 'patch: New prometheus/prometheus upstream release! (https://github.com/prometheus-community/ansible/pull/152)'
- 'patch: New prometheus/prometheus upstream release! (https://github.com/prometheus-community/ansible/pull/168)'
- Fix mysqld_exporter world-readable secrets (https://github.com/prometheus-community/ansible/pull/169)
- 'patch: New prometheus/snmp_exporter upstream release! (https://github.com/prometheus-community/ansible/pull/146)'
release_date: '2023-06-24'
0.6.0:
changes:
bugfixes:
- 'fix(alertmanager): add routes before match_re (https://github.com/prometheus-community/ansible/pull/194)'
- 'fix(node_exporter): Fix ProtectHome for textfiles (https://github.com/prometheus-community/ansible/pull/184)'
- 'fix: Add test for argument_specs matching (https://github.com/prometheus-community/ansible/pull/177)'
- 'fix: Make binary installs consistent (https://github.com/prometheus-community/ansible/pull/204)'
- 'fix: mysqld_exporter should actually respect the mysqld_exporter_host variable
(https://github.com/prometheus-community/ansible/pull/88)'
minor_changes:
- 'feat: Add chrony_exporter role (https://github.com/prometheus-community/ansible/pull/159)'
- 'feat: Add pushgateway role (https://github.com/prometheus-community/ansible/pull/127)'
- 'feat: Add role smokeping_prober (https://github.com/prometheus-community/ansible/pull/128)'
- 'feature: Agent mode support (https://github.com/prometheus-community/ansible/pull/198)'
- 'feature: Make config installation dir configurable (https://github.com/prometheus-community/ansible/pull/173)'
- 'feature: blackbox exporter user/group configurable (https://github.com/prometheus-community/ansible/pull/172)'
- 'minor: support fedora 38 (https://github.com/prometheus-community/ansible/pull/202)'
removed_features:
- 'removed: Drop fedora 36 support as it is EOL (https://github.com/prometheus-community/ansible/pull/200)'
- 'removed: Drop ubuntu 18.04 support as it is EOL (https://github.com/prometheus-community/ansible/pull/199)'
trivial:
- Fix mysqld_exporter world-readable secrets (https://github.com/prometheus-community/ansible/pull/169)
- 'Fix: rename collector flags (https://github.com/prometheus-community/ansible/pull/167)'
- 'docs(smokeping_prober): Update arguments specs (https://github.com/prometheus-community/ansible/pull/190)'
- 'docs: Fix node_exporter 404 TLS auth links (https://github.com/prometheus-community/ansible/pull/154)'
- 'fix ansible-lint: risky-octal & no-same-owner (https://github.com/prometheus-community/ansible/pull/171)'
- 'patch: New prometheus/alertmanager upstream release! (https://github.com/prometheus-community/ansible/pull/206)'
- 'patch: New prometheus/mysqld_exporter upstream release! (https://github.com/prometheus-community/ansible/pull/153)'
- 'patch: New prometheus/node_exporter upstream release! (https://github.com/prometheus-community/ansible/pull/162)'
- 'patch: New prometheus/prometheus upstream release! (https://github.com/prometheus-community/ansible/pull/152)'
- 'patch: New prometheus/prometheus upstream release! (https://github.com/prometheus-community/ansible/pull/168)'
- 'patch: New prometheus/snmp_exporter upstream release! (https://github.com/prometheus-community/ansible/pull/146)'
- 'patch: New prometheus/snmp_exporter upstream release! (https://github.com/prometheus-community/ansible/pull/188)'
- 'patch: New superq/smokeping_prober upstream release! (https://github.com/prometheus-community/ansible/pull/196)'
release_date: '2023-07-29'
0.6.1:
changes:
bugfixes:
- 'fix: blackbox_exporter ansible-lint risky-octal (https://github.com/prometheus-community/ansible/pull/174)'
release_date: '2023-08-26'
2 changes: 1 addition & 1 deletion galaxy.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
namespace: prometheus
name: prometheus
version: 0.5.2
version: 0.6.1

Check warning on line 4 in galaxy.yml

View workflow job for this annotation

GitHub Actions / ansible-lint

galaxy[version-incorrect]

collection version should be greater than or equal to 1.0.0
readme: README.md
authors:
- "Ben Kochie (https://github.com/SuperQ)"
Expand Down
3 changes: 2 additions & 1 deletion roles/alertmanager/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
alertmanager_version: 0.25.0
alertmanager_version: 0.26.0
alertmanager_binary_local_dir: ''
alertmanager_binary_url: "https://github.com/{{ _alertmanager_repo }}/releases/download/v{{ alertmanager_version }}/\
alertmanager-{{ alertmanager_version }}.linux-{{ go_arch }}.tar.gz"
Expand Down Expand Up @@ -86,6 +86,7 @@ alertmanager_route: {}
# receiver: slack
# # This routes performs a regular expression match on alert labels to
# # catch alerts that are related to a list of services.
# routes:
# - match_re:
# service: ^(foo1|foo2|baz)$
# receiver: team-X-mails
Expand Down
2 changes: 1 addition & 1 deletion roles/alertmanager/meta/argument_specs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ argument_specs:
options:
alertmanager_version:
description: "Alertmanager package version. Also accepts `latest` as parameter."
default: 0.25.0
default: 0.26.0
alertmanager_skip_install:
description: "Alertmanager installation tasks gets skipped when set to true."
type: bool
Expand Down
3 changes: 1 addition & 2 deletions roles/alertmanager/meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ galaxy_info:
platforms:
- name: "Ubuntu"
versions:
- "bionic"
- "focal"
- "jammy"
- name: "Debian"
Expand All @@ -21,8 +20,8 @@ galaxy_info:
- "9"
- name: "Fedora"
versions:
- "36"
- "37"
- '38'
galaxy_tags:
- "monitoring"
- "prometheus"
Expand Down
35 changes: 0 additions & 35 deletions roles/alertmanager/molecule/alternative/converge.yml

This file was deleted.

33 changes: 33 additions & 0 deletions roles/alertmanager/molecule/alternative/molecule.yml
Original file line number Diff line number Diff line change
@@ -1 +1,34 @@
---
provisioner:
inventory:
group_vars:
all:
alertmanager_binary_local_dir: '/tmp/alertmanager-linux-amd64'
alertmanager_config_dir: /opt/am/etc
alertmanager_db_dir: /opt/am/lib
alertmanager_web_listen_address: '127.0.0.1:9093'
alertmanager_web_external_url: 'http://localhost:9093/alertmanager'
alertmanager_resolve_timeout: 10m
alertmanager_slack_api_url: "http://example.com"
alertmanager_receivers:
- name: slack
slack_configs:
- send_resolved: true
api_url: 'https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX'
channel: '#alerts'
alertmanager_route:
group_by: ['alertname', 'cluster', 'service']
group_wait: 30s
group_interval: 5m
repeat_interval: 3h
receiver: slack
routes:
- match_re:
service: ^(foo1|foo2|baz)$$
receiver: slack
alertmanager_mesh:
listen-address: "127.0.0.1:6783"
peers:
- "127.0.0.1:6783"
- "alertmanager.demo.do.prometheus.io:6783"
version: 0.19.0
8 changes: 3 additions & 5 deletions roles/alertmanager/molecule/alternative/prepare.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
---
- name: Prepare
- name: Run localhost preparation
hosts: localhost
gather_facts: false
vars:
# Version needs to be specified here as molecule doesn't have access to ansible_version at this stage
version: 0.19.0
tasks:
- name: Download alertmanager binary to local folder
become: false
ansible.builtin.get_url:
url: "https://github.com/prometheus/alertmanager/releases/download/v{{ version }}/alertmanager-{{ version }}.linux-amd64.tar.gz"
url: "https://github.com/prometheus/alertmanager/releases/download/v{{ version\
\ }}/alertmanager-{{ version }}.linux-amd64.tar.gz"
dest: "/tmp/alertmanager-{{ version }}.linux-amd64.tar.gz"
mode: 0644
register: _download_archive
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,15 @@ def test_files(host, files):

def test_service(host):
s = host.service("alertmanager")
# assert s.is_enabled
assert s.is_running
try:
assert s.is_running
except AssertionError:
# Capture service logs
journal_output = host.run('journalctl -u alertmanager --since "1 hour ago"')
print("\n==== journalctl -u alertmanager Output ====\n")
print(journal_output)
print("\n============================================\n")
raise # Re-raise the original assertion error


@pytest.mark.parametrize("sockets", [
Expand Down
Loading

0 comments on commit f194fec

Please sign in to comment.