Skip to content

Commit

Permalink
Merge pull request #39 from netmanagers/master
Browse files Browse the repository at this point in the history
Allow to use OS packages in Debian family
  • Loading branch information
noelmcloughlin authored Aug 21, 2020
2 parents 0166fbd + 1eeda22 commit 3f15c88
Show file tree
Hide file tree
Showing 12 changed files with 293 additions and 92 deletions.
56 changes: 56 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# -*- coding: utf-8 -*-
# vim: ft=yaml
---
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
default_stages: [commit]
repos:
- repo: https://github.com/dafyddj/commitlint-pre-commit-hook
rev: v2.3.0
hooks:
- id: commitlint
name: Check commit message using commitlint
description: Lint commit message against @commitlint/config-conventional rules
stages: [commit-msg]
additional_dependencies: ['@commitlint/config-conventional@8.3.4']
- id: commitlint-travis
stages: [manual]
additional_dependencies: ['@commitlint/config-conventional@8.3.4']
always_run: true
- repo: https://github.com/jumanjihouse/pre-commit-hooks
rev: 2.1.3
hooks:
- id: rubocop
exclude: ^Gemfile\.lock$
- id: shellcheck
name: Check shell scripts with shellcheck
exclude_types: [zsh]
args: []
- repo: https://github.com/adrienverge/yamllint.git
rev: v1.23.0
hooks:
- id: yamllint
name: Check YAML syntax with yamllint
args: [--strict]
types: [file]
files: >
(?x)^(
\.salt-lint|
\.yamllint|
.*\.example|
test/.*\.sls|
.*\.(yaml|yml)
)$
exclude: ^test/salt/.*/.*\.sls$
- repo: https://github.com/warpnet/salt-lint
rev: v0.3.0
hooks:
- id: salt-lint
name: Check Salt files using salt-lint
files: ^.*\.(sls|jinja|j2|tmpl|tst)$
- repo: https://github.com/myint/rstcheck
rev: 3f929574
hooks:
- id: rstcheck
name: Check reST files using rstcheck
args: [--report=warning]
3 changes: 3 additions & 0 deletions .rstcheck.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[rstcheck]
report=error
ignore_language=rst
31 changes: 26 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ jobs:
# Run all of the linters in a single job
- language: 'node_js'
node_js: 'lts/*'
cache:
directories:
- $HOME/.cache/pre-commit
env: 'Lint'
name: 'Lint: salt-lint, yamllint, rubocop, shellcheck & commitlint'
before_install: 'skip'
Expand All @@ -54,6 +57,10 @@ jobs:
- npm i -D @commitlint/config-conventional
@commitlint/travis-cli
- commitlint-travis
# Install and run `pre-commit`
- pip install pre-commit
- pre-commit run --all-files --verbose
- pre-commit run --hook-stage manual --verbose commitlint-travis

## Define the rest of the matrix based on Kitchen testing
# Make sure the instances listed below match up with
Expand All @@ -69,11 +76,10 @@ jobs:
# to allow for comprehensive local testing
# Ref: https://github.com/saltstack-formulas/template-formula/issues/118
# Ref: https://github.com/saltstack-formulas/template-formula/issues/121
- env: INSTANCE=default-debian-10-master-py3
# env: INSTANCE=default-ubuntu-2004-master-py3
- env: INSTANCE=default-ubuntu-2004-master-py3
# - env: INSTANCE=default-ubuntu-1804-master-py3
- env: INSTANCE=default-centos-8-master-py3
# env: INSTANCE=default-fedora-32-master-py3
- env: INSTANCE=default-fedora-32-master-py3
# - env: INSTANCE=default-fedora-31-master-py3
# - env: INSTANCE=default-opensuse-leap-152-master-py3
# - env: INSTANCE=default-amazonlinux-2-master-py3
Expand All @@ -83,8 +89,8 @@ jobs:
# - env: INSTANCE=default-centos-8-3000-3-py3
# - env: INSTANCE=default-centos-7-3000-3-py3
# - env: INSTANCE=default-fedora-31-3000-3-py3
# env: INSTANCE=default-opensuse-leap-152-3000-3-py3
# env: INSTANCE=default-amazonlinux-2-3000-3-py3
- env: INSTANCE=default-opensuse-leap-152-3000-3-py3
- env: INSTANCE=default-amazonlinux-2-3000-3-py3
# - env: INSTANCE=default-ubuntu-1804-3000-3-py2
# - env: INSTANCE=default-ubuntu-1604-3000-3-py2
# - env: INSTANCE=default-arch-base-latest-3000-3-py2
Expand All @@ -100,6 +106,9 @@ jobs:
# - env: INSTANCE=default-centos-6-2019-2-py2
# - env: INSTANCE=default-amazonlinux-1-2019-2-py2
- env: INSTANCE=default-arch-base-latest-2019-2-py2
# REPO
- env: INSTANCE=repo-debian-10-3000-3-py3
- env: INSTANCE=repo-centos-7-3000-3-py3

## Define the release stage that runs `semantic-release`
- stage: 'release'
Expand All @@ -126,3 +135,15 @@ jobs:
edge: true
# Run `semantic-release`
script: 'npx semantic-release@15.14'

# Notification options: `always`, `never` or `change`
notifications:
webhooks:
if: 'repo = saltstack-formulas/prometheus-formula'
urls:
- https://saltstack-formulas.zulipchat.com/api/v1/external/travis?api_key=HsIq3o5QmLxdnVCKF9is0FUIpkpAY79P&stream=CI&topic=saltstack-formulas%2Fprometheus-formula&ignore_pull_requests=true
on_success: always # default: always
on_failure: always # default: always
on_start: always # default: never
on_cancel: always # default: always
on_error: always # default: always
3 changes: 1 addition & 2 deletions .yamllint
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ extends: default
# 3. Any YAML files under directory `.kitchen/`, introduced during local testing
ignore: |
node_modules/
test/**/states/**/*.sls
test/**/*.sls
.kitchen/
bin/kitchen
prometheus/osfamilymap.yaml
Expand All @@ -24,7 +24,6 @@ yaml-files:
- .yamllint
# SaltStack Formulas additional settings
- '*.example'
- test/**/*.sls

rules:
empty-values:
Expand Down
135 changes: 68 additions & 67 deletions kitchen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,121 +15,118 @@ platforms:
- name: debian-10-master-py3
driver:
image: saltimages/salt-master-py3:debian-10
- name: ubuntu-2004-master-py3
driver:
image: saltimages/salt-master-py3:ubuntu-20.04
- name: ubuntu-1804-master-py3
driver:
image: saltimages/salt-master-py3:ubuntu-18.04
- name: centos-8-master-py3
driver:
image: saltimages/salt-master-py3:centos-8
- name: fedora-32-master-py3
driver:
image: saltimages/salt-master-py3:fedora-32
- name: fedora-31-master-py3
driver:
image: saltimages/salt-master-py3:fedora-31
- name: opensuse-leap-151-master-py3
- name: opensuse-leap-152-master-py3
driver:
image: netmanagers/salt-master-py3:opensuse-leap-15.1
image: saltimages/salt-master-py3:opensuse-leap-15.2
run_command: /usr/lib/systemd/systemd
# Workaround to avoid intermittent failures on `opensuse-leap-15.1`:
# Workaround to avoid intermittent failures on `opensuse-leap-15.2`:
# => SCP did not finish successfully (255): (Net::SCP::Error)
transport:
max_ssh_sessions: 1
- name: amazonlinux-2-master-py3
driver:
image: saltimages/salt-master-py3:amazonlinux-2

## SALT `2019.2`
- name: debian-10-2019-2-py3
## SALT `3000.3`
- name: debian-10-3000-3-py3
driver:
image: saltimages/salt-2019.2-py3:debian-10
- name: debian-9-2019-2-py3
image: saltimages/salt-3000.3-py3:debian-10
- name: debian-9-3000-3-py3
driver:
image: saltimages/salt-2019.2-py3:debian-9
- name: ubuntu-1804-2019-2-py3
image: saltimages/salt-3000.3-py3:debian-9
- name: ubuntu-1804-3000-3-py3
driver:
image: saltimages/salt-2019.2-py3:ubuntu-18.04
- name: centos-8-2019-2-py3
image: saltimages/salt-3000.3-py3:ubuntu-18.04
- name: centos-8-3000-3-py3
driver:
image: saltimages/salt-2019.2-py3:centos-8
- name: fedora-31-2019-2-py3
image: saltimages/salt-3000.3-py3:centos-8
- name: centos-7-3000-3-py3
driver:
image: saltimages/salt-2019.2-py3:fedora-31
- name: opensuse-leap-151-2019-2-py3
image: saltimages/salt-3000.3-py3:centos-7
- name: fedora-31-3000-3-py3
driver:
image: netmanagers/salt-2019.2-py3:opensuse-leap-15.1
image: saltimages/salt-3000.3-py3:fedora-31
- name: opensuse-leap-152-3000-3-py3
driver:
image: saltimages/salt-3000.3-py3:opensuse-leap-15.2
run_command: /usr/lib/systemd/systemd
# Workaround to avoid intermittent failures on `opensuse-leap-15.1`:
# Workaround to avoid intermittent failures on `opensuse-leap-15.2`:
# => SCP did not finish successfully (255): (Net::SCP::Error)
transport:
max_ssh_sessions: 1
- name: centos-7-2019-2-py2
- name: amazonlinux-2-3000-3-py3
driver:
image: netmanagers/salt-2019.2-py2:centos-7
- name: amazonlinux-2-2019-2-py3
image: saltimages/salt-3000.3-py3:amazonlinux-2
- name: ubuntu-1804-3000-3-py2
driver:
image: saltimages/salt-2019.2-py3:amazonlinux-2
- name: arch-base-latest-2019-2-py2
image: saltimages/salt-3000.3-py2:ubuntu-18.04
- name: ubuntu-1604-3000-3-py2
driver:
image: saltimages/salt-2019.2-py2:arch-base-latest
image: saltimages/salt-3000.3-py2:ubuntu-16.04
- name: arch-base-latest-3000-3-py2
driver:
image: saltimages/salt-3000.3-py2:arch-base-latest
run_command: /usr/lib/systemd/systemd

## SALT `2018.3`
- name: fedora-30-2018-3-py3
driver:
image: netmanagers/salt-2018.3-py3:fedora-30
- name: debian-9-2018-3-py2
driver:
image: netmanagers/salt-2018.3-py2:debian-9
- name: ubuntu-1604-2018-3-py2
driver:
image: netmanagers/salt-2018.3-py2:ubuntu-16.04
- name: centos-7-2018-3-py2
driver:
image: netmanagers/salt-2018.3-py2:centos-7
- name: opensuse-leap-151-2018-3-py2
## SALT `2019.2`
- name: debian-10-2019-2-py3
driver:
image: netmanagers/salt-2018.3-py2:opensuse-leap-15.1
run_command: /usr/lib/systemd/systemd
# Workaround to avoid intermittent failures on `opensuse-leap-15.1`:
# => SCP did not finish successfully (255): (Net::SCP::Error)
transport:
max_ssh_sessions: 1
- name: amazonlinux-1-2018-3-py2
image: saltimages/salt-2019.2-py3:debian-10
- name: debian-9-2019-2-py3
driver:
image: netmanagers/salt-2018.3-py2:amazonlinux-1
run_command: /sbin/init
- name: arch-base-latest-2018-3-py2
image: saltimages/salt-2019.2-py3:debian-9
- name: ubuntu-1804-2019-2-py3
driver:
image: netmanagers/salt-2018.3-py2:arch-base-latest
run_command: /usr/lib/systemd/systemd

## SALT `2017.7`
- name: debian-8-2017-7-py2
image: saltimages/salt-2019.2-py3:ubuntu-18.04
- name: ubuntu-1604-2019-2-py3
driver:
image: netmanagers/salt-2017.7-py2:debian-8
- name: ubuntu-1604-2017-7-py2
image: saltimages/salt-2019.2-py3:ubuntu-16.04
- name: centos-8-2019-2-py3
driver:
image: netmanagers/salt-2017.7-py2:ubuntu-16.04
- name: centos-6-2017-7-py2
image: saltimages/salt-2019.2-py3:centos-8
- name: centos-7-2019-2-py3
driver:
image: netmanagers/salt-2017.7-py2:centos-6
run_command: /sbin/init
- name: fedora-30-2017-7-py2
image: saltimages/salt-2019.2-py3:centos-7
- name: fedora-31-2019-2-py3
driver:
image: netmanagers/salt-2017.7-py2:fedora-30
- name: opensuse-leap-151-2017-7-py2
image: saltimages/salt-2019.2-py3:fedora-31
- name: opensuse-leap-152-2019-2-py3
driver:
image: netmanagers/salt-2017.7-py2:opensuse-leap-15.1
image: saltimages/salt-2019.2-py3:opensuse-leap-15.2
run_command: /usr/lib/systemd/systemd
# Workaround to avoid intermittent failures on `opensuse-leap-15.1`:
# Workaround to avoid intermittent failures on `opensuse-leap-15.2`:
# => SCP did not finish successfully (255): (Net::SCP::Error)
transport:
max_ssh_sessions: 1
- name: amazonlinux-1-2017-7-py2
- name: amazonlinux-2-2019-2-py3
driver:
image: netmanagers/salt-2017.7-py2:amazonlinux-1
image: saltimages/salt-2019.2-py3:amazonlinux-2
- name: centos-6-2019-2-py2
driver:
image: saltimages/salt-2019.2-py2:centos-6
run_command: /sbin/init
- name: amazonlinux-1-2019-2-py2
driver:
image: saltimages/salt-2019.2-py2:amazonlinux-1
run_command: /sbin/init
- name: arch-base-latest-2017-7-py2
- name: arch-base-latest-2019-2-py2
driver:
image: netmanagers/salt-2017.7-py2:arch-base-latest
image: saltimages/salt-2019.2-py2:arch-base-latest
run_command: /usr/lib/systemd/systemd

provisioner:
Expand All @@ -152,6 +149,8 @@ verifier:

suites:
- name: default
excludes:
- centos-6-2018-3-py2
provisioner:
state_top:
base:
Expand All @@ -169,6 +168,8 @@ suites:
inspec_tests:
- path: test/integration/default
- name: repo
excludes:
- centos-6-2018-3-py2
provisioner:
state_top:
base:
Expand Down
12 changes: 11 additions & 1 deletion pillar.example
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ prometheus:
- haskell
- rust
component:
# List components (ie, exporters) using underscores and
# removing the 'prometheus' prefix
- prometheus
- alertmanager # not in debian repo, only archive
- alertmanager
- node_exporter
# - memcached_exporter # not in upstream repo, only archive

Expand Down Expand Up @@ -37,6 +39,14 @@ prometheus:
golang:
version: v1.6.0
component:
# If you use OS packages in Debian's family, components should have
# a 'name' variable stating the name of the package (it's generally
# something like `prometheus-component-with-dashes-replacing-underscores`
# ie,
# node_exporter:
# name: prometheus-node-exporter
#
# See prometheus/osfamilymap.yaml for more examples
alertmanager:
config:
# yamllint disable-line rule:line-length
Expand Down
2 changes: 1 addition & 1 deletion prometheus/map.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@
{%- set uri = '%s/%s/releases/download/%s/%s'|format(p.pkg.uri, name, v.version, name) %}
{%- set url = '%s-%s.%s-%s.tar.gz'|format(uri, v.version|replace('v',''), p.kernel, p.arch) %}
{%- set dir = '%s-%s'|format(name, v.version) %}
{%- endif %}
{%- do p.pkg.component[name].update({'path': p.dir.archive ~ '/' + dir }) %}
{%- do p.pkg.component[name]['archive'].update({'name': p.dir.archive + '/' + dir, 'source': url}) %}
{%- endif %}
{%- endfor %}
{%- endif %}

Expand Down
Loading

0 comments on commit 3f15c88

Please sign in to comment.