diff --git a/.github/workflows/ansible-lint.yml b/.github/workflows/ansible-lint.yml deleted file mode 100644 index 18e788f..0000000 --- a/.github/workflows/ansible-lint.yml +++ /dev/null @@ -1,17 +0,0 @@ -name: ansible lint - -on: [push, pull_request] - -jobs: - ansible-lint: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - - name: Lint Ansible Playbook - uses: ansible/ansible-lint-action@master - with: - targets: | - */*.yml diff --git a/.github/workflows/molecule.yml b/.github/workflows/build.yml similarity index 66% rename from .github/workflows/molecule.yml rename to .github/workflows/build.yml index f41bf52..a497f05 100644 --- a/.github/workflows/molecule.yml +++ b/.github/workflows/build.yml @@ -1,8 +1,19 @@ -name: molecule-test +name: build on: [push, pull_request] jobs: + ansible-lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Lint Ansible Playbook + uses: ansible/ansible-lint-action@master + with: + targets: | + */*.yml + molecule: runs-on: ubuntu-latest steps: @@ -19,10 +30,7 @@ jobs: - name: Install dependencies run: | python -m pip install -U pip - pip install --no-cache-dir molecule - pip install --no-cache-dir molecule[docker,lint] - pip install git+git://github.com/ansible-community/molecule-inspec.git@master - # pip install molecule-inspec + python -m pip install --no-cache-dir -r requirements.txt - name: Molecule test run: | molecule --debug test diff --git a/.github/workflows/md-links.yml b/.github/workflows/md-links.yml index e255982..4084684 100644 --- a/.github/workflows/md-links.yml +++ b/.github/workflows/md-links.yml @@ -5,9 +5,7 @@ on: [push, pull_request] jobs: md-links: - runs-on: ubuntu-latest - steps: - name: Check out code uses: actions/checkout@master diff --git a/README.md b/README.md index 77b215e..da3489a 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,10 @@ # Ansible role prometheus-msteams -[![ansible lint](https://github.com/slashpai/ansible-prometheus-msteams/workflows/ansible%20lint/badge.svg)](https://github.com/slashpai/ansible-prometheus-msteams/actions?query=workflow%3Aansible-lint) +[![build](https://github.com/slashpai/ansible-prometheus-msteams/workflows/build/badge.svg)](https://github.com/slashpai/ansible-prometheus-msteams/actions?query=workflow%3Abuild) [![markdown links](https://github.com/slashpai/ansible-prometheus-msteams/workflows/md-links/badge.svg)](https://github.com/slashpai/ansible-prometheus-msteams/actions?query=workflow%3AMD-links) -[![molecule test](https://github.com/slashpai/ansible-prometheus-msteams/workflows/molecule-test/badge.svg)](https://github.com/slashpai/ansible-prometheus-msteams/actions?query=workflow%3Amolecule-test) [![Ansible Role](https://img.shields.io/badge/ansible%20role-slashpai.ansible_prometheus_msteams-purple.svg)](https://galaxy.ansible.com/slashpai/ansible_prometheus_msteams) [![GitHub tag](https://img.shields.io/github/v/tag/slashpai/ansible-prometheus-msteams.svg?sort=semver)](https://github.com/slashpai/ansible-prometheus-msteams/tags) - ## ansible-prometheus-msteams To install and configure [prometheus-msteams](https://github.com/prometheus-msteams/prometheus-msteams) for sending notifications from [alertmanager](https://prometheus.io/docs/alerting/latest/alertmanager/) to [microsoft teams](https://www.microsoft.com/en-in/microsoft-365/microsoft-teams/group-chat-software) diff --git a/molecule/default/molecule.yml b/molecule/default/molecule.yml index 7044898..0f93ea5 100644 --- a/molecule/default/molecule.yml +++ b/molecule/default/molecule.yml @@ -14,5 +14,6 @@ platforms: - /sys/fs/cgroup:/sys/fs/cgroup:ro provisioner: name: ansible + verifier: name: inspec diff --git a/molecule/default/tests/test_default.rb b/molecule/default/tests/test_default.rb index cc16b23..e7b56e3 100644 --- a/molecule/default/tests/test_default.rb +++ b/molecule/default/tests/test_default.rb @@ -45,6 +45,12 @@ it { should be_running } end +describe processes('prometheus_msteams') do + it { should exist } + its('users') { should eq ['prometheus_msteams'] } + its('commands') { should eq ['/usr/local/bin/prometheus_msteams -teams-request-uri alertmanager -config-file /etc/prometheus_msteams/config.yaml -template-file /etc/prometheus_msteams/default-message-card.tmpl'] } +end + describe command('curl http://localhost:2000') do its('stdout') { should include 'message":"Not Found"' } its('exit_status') { should eq 0 } diff --git a/requirements.txt b/requirements.txt index 0eaf276..2075d97 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,8 @@ -molecule==3.2.1 -molecule-docker==0.2.4 -molecule-inspec==1.0 -ansible==2.9.6 -ansible-lint==4.3.5 -docker==4.4.1 +molecule +molecule-docker +# since this version has bug for log message +# molecule-inspec==1.0 +git+git://github.com/ansible-community/molecule-inspec.git@master +ansible +ansible-lint +docker