Merge pull request #14 from myii/chore/standardise-structure
feat(yamllint): include for this repo and apply rules throughout
This commit is contained in:
commit
a94cd58a0e
13
.travis.yml
13
.travis.yml
@ -3,7 +3,7 @@
|
||||
---
|
||||
stages:
|
||||
- test
|
||||
- commitlint
|
||||
- lint
|
||||
- name: release
|
||||
if: branch = master AND type != pull_request
|
||||
|
||||
@ -45,16 +45,21 @@ script:
|
||||
|
||||
jobs:
|
||||
include:
|
||||
# Define the commitlint stage
|
||||
- stage: commitlint
|
||||
# Define the `lint` stage (runs `yamllint` and `commitlint`)
|
||||
- stage: lint
|
||||
language: node_js
|
||||
node_js: lts/*
|
||||
before_install: skip
|
||||
script:
|
||||
# Install and run `yamllint`
|
||||
- pip install --user yamllint
|
||||
# yamllint disable-line rule:line-length
|
||||
- yamllint -s . .yamllint pillar.example
|
||||
# Install and run `commitlint`
|
||||
- npm install @commitlint/config-conventional -D
|
||||
- npm install @commitlint/travis-cli -D
|
||||
- commitlint-travis
|
||||
# Define the release stage that runs semantic-release
|
||||
# Define the release stage that runs `semantic-release`
|
||||
- stage: release
|
||||
language: node_js
|
||||
node_js: lts/*
|
||||
|
16
.yamllint
Normal file
16
.yamllint
Normal file
@ -0,0 +1,16 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# vim: ft=yaml
|
||||
---
|
||||
# Extend the `default` configuration provided by `yamllint`
|
||||
extends: default
|
||||
|
||||
# Files to ignore completely
|
||||
# 1. All YAML files under directory `node_modules/`, introduced during the Travis run
|
||||
ignore: |
|
||||
node_modules/
|
||||
|
||||
rules:
|
||||
line-length:
|
||||
# Increase from default of `80`
|
||||
# Based on https://github.com/PyCQA/flake8-bugbear#opinionated-warnings (`B950`)
|
||||
max: 88
|
@ -28,10 +28,10 @@ prometheus:
|
||||
prometheus:
|
||||
args:
|
||||
web.listen-address: 0.0.0.0:9090
|
||||
#pushgateway:
|
||||
#args:
|
||||
# web.listen-address: ":9091"
|
||||
# web.telemetry-path: "/metrics"
|
||||
# pushgateway:
|
||||
# args:
|
||||
# web.listen-address: ":9091"
|
||||
# web.telemetry-path: "/metrics"
|
||||
node_exporter:
|
||||
args:
|
||||
web.listen-address: ":9110"
|
||||
@ -54,41 +54,45 @@ prometheus:
|
||||
# dirs:
|
||||
# files: files_alt
|
||||
# default: default_alt
|
||||
# source_files:
|
||||
# prometheus-config-file-file-managed:
|
||||
# - 'example_alt.tmpl'
|
||||
# - 'example_alt.tmpl.jinja'
|
||||
source_files:
|
||||
prometheus-config-file-file-managed:
|
||||
- 'alt_config.yml.jinja'
|
||||
|
||||
# Pillar-based config
|
||||
config:
|
||||
prometheus:
|
||||
# yamllint disable-line rule:line-length
|
||||
# ref https://raw.githubusercontent.com/prometheus/prometheus/release-2.10/config/testdata/conf.good.yml
|
||||
# my global config
|
||||
global:
|
||||
scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
|
||||
evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
|
||||
# Set the scrape interval to every 15 seconds. Default is every 1 minute.
|
||||
scrape_interval: 15s
|
||||
# Evaluate rules every 15 seconds. The default is every 1 minute.
|
||||
evaluation_interval: 15s
|
||||
# scrape_timeout is set to the global default (10s).
|
||||
|
||||
# Alertmanager configuration
|
||||
alerting:
|
||||
alertmanagers:
|
||||
- static_configs:
|
||||
- targets:
|
||||
# - alertmanager:9093
|
||||
- static_configs:
|
||||
- targets:
|
||||
# - alertmanager:9093
|
||||
|
||||
# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
|
||||
# Load rules once and periodically evaluate them according to the global
|
||||
# 'evaluation_interval'.
|
||||
rule_files:
|
||||
# - "first_rules.yml"
|
||||
- "first_rules.yml"
|
||||
# - "second_rules.yml"
|
||||
|
||||
# A scrape configuration containing exactly one endpoint to scrape:
|
||||
scrape_configs:
|
||||
# The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
|
||||
# The job name is added as a label `job=<job_name>` to any timeseries
|
||||
# scraped from this config.
|
||||
- job_name: 'prometheus'
|
||||
# metrics_path defaults to '/metrics'
|
||||
# scheme defaults to 'http'.
|
||||
static_configs:
|
||||
- targets: ['localhost:9090']
|
||||
- targets: ['localhost:9090']
|
||||
|
||||
- job_name: pushgateway
|
||||
scrape_interval: 5s
|
||||
@ -103,9 +107,9 @@ prometheus:
|
||||
module: [http_2xx] # Look for a HTTP 200 response.
|
||||
static_configs:
|
||||
- targets:
|
||||
- http://prometheus.io # Target to probe with http.
|
||||
- https://prometheus.io # Target to probe with https.
|
||||
- http://example.com:8080 # Target to probe with http on port 8080.
|
||||
- http://prometheus.io # Target to probe with http.
|
||||
- https://prometheus.io # Target to probe with https.
|
||||
- http://example.com:8080 # Target to probe with http on port 8080.
|
||||
relabel_configs:
|
||||
- source_labels: [__address__]
|
||||
target_label: __param_target
|
||||
@ -115,6 +119,7 @@ prometheus:
|
||||
replacement: 127.0.0.1:9115 # The blackbox exporter's real hostname:port.
|
||||
|
||||
alertmanager:
|
||||
# yamllint disable-line rule:line-length
|
||||
# ref https://github.com/prometheus/alertmanager/blob/master/config/testdata/conf.good.yml
|
||||
global:
|
||||
smtp_smarthost: 'localhost:25'
|
||||
@ -136,13 +141,13 @@ prometheus:
|
||||
service: ^(foo1|foo2|baz)$
|
||||
receiver: team-X-mails
|
||||
routes:
|
||||
- match:
|
||||
severity: critical
|
||||
receiver: team-X-mails
|
||||
- match:
|
||||
severity: critical
|
||||
receiver: team-X-mails
|
||||
receivers:
|
||||
- name: 'team-X-mails'
|
||||
email_configs:
|
||||
- to: 'team-X+alerts@example.org'
|
||||
- name: 'team-X-mails'
|
||||
email_configs:
|
||||
- to: 'team-X+alerts@example.org'
|
||||
|
||||
inhibit_rules:
|
||||
- name: opsGenie-receiver
|
||||
@ -154,5 +159,6 @@ prometheus:
|
||||
image_url: 'http://some.img.com/img.png'
|
||||
|
||||
linux:
|
||||
#'Alternatives system' priority: zero disables (default)
|
||||
# 'Alternatives system' priority: zero disables (default)
|
||||
# yamllint disable-line rule:braces
|
||||
altpriority: {{ range(1, 9100000) | random }}
|
||||
|
@ -3,10 +3,12 @@
|
||||
---
|
||||
prometheus:
|
||||
rootgroup: root
|
||||
# yamllint disable rule:braces
|
||||
kernel: {{ grains.kernel | lower }}
|
||||
arch: {{ grains.osarch }}
|
||||
use_upstream_repo: False
|
||||
use_upstream_archive: False
|
||||
# yamllint enable rule:braces
|
||||
use_upstream_repo: false
|
||||
use_upstream_archive: false
|
||||
|
||||
wanted:
|
||||
- prometheus
|
||||
@ -100,14 +102,14 @@ prometheus:
|
||||
uri: https://github.com/prometheus
|
||||
suffix: tar.gz
|
||||
kwargs:
|
||||
trim_output: True
|
||||
enforce_toplevel: True
|
||||
trim_output: true
|
||||
enforce_toplevel: true
|
||||
archive_format: tar
|
||||
retry:
|
||||
attempts: 3
|
||||
until: True
|
||||
until: true
|
||||
interval: 60
|
||||
splay: 10
|
||||
|
||||
linux:
|
||||
altpriority: 0 ##'Alternatives system' priority: zero disables (default)
|
||||
altpriority: 0 ## 'Alternatives system' priority: zero disables (default)
|
||||
|
@ -21,6 +21,14 @@
|
||||
{#- Merge the prometheus pillar #}
|
||||
{%- set prometheus = salt['pillar.get']('prometheus', default=defaults, merge=True) %}
|
||||
|
||||
{#- Post-processing for specific non-YAML customisations #}
|
||||
{%- if grains.os == 'MacOS' %}
|
||||
{%- set macos_user = salt['cmd.run']("stat -f '%Su' /dev/console") %}
|
||||
{%- set macos_group = salt['cmd.run']("stat -f '%Sg' /dev/console") %}
|
||||
{%- do prometheus.update({'rootuser': macos_user}) %}
|
||||
{%- do prometheus.update({'rootgroup': macos_group}) %}
|
||||
{%- endif %}
|
||||
|
||||
{#- Contactenate arguments #}
|
||||
{%- macro concat_args(args) %}
|
||||
{%- set args = args|dictsort %}
|
||||
|
@ -10,19 +10,16 @@
|
||||
# you will need to provide at least an empty dict in this file, e.g.
|
||||
# osfamilymap: {}
|
||||
---
|
||||
{%- if grains.os == 'MacOS' %}
|
||||
{% set macos_user = salt['cmd.run']("stat -f '%Su' /dev/console") %}
|
||||
{% set macos_group = salt['cmd.run']("stat -f '%Sg' /dev/console") %}
|
||||
{%- endif %}
|
||||
|
||||
Debian: {}
|
||||
|
||||
RedHat:
|
||||
pkg:
|
||||
prometheus:
|
||||
repo:
|
||||
# yamllint disable rule:line-length
|
||||
baseurl: 'https://packagecloud.io/prometheus-rpm/release/el/$releasever/$basearch'
|
||||
gpgkey: 'https://packagecloud.io/prometheus-rpm/release/gpgkey gpgkey2=https://raw.githubusercontent.com/lest/prometheus-rpm/master/RPM-GPG-KEY-prometheus-rpm'
|
||||
# yamllint enable rule:line-length
|
||||
metadata_expire: 300
|
||||
|
||||
Suse: {}
|
||||
@ -114,8 +111,6 @@ Windows:
|
||||
archive_hash: 9362b7482e74792f111c4bb1a372b18a88f6354c78f24713bacfbcb050883556
|
||||
|
||||
MacOS:
|
||||
rootuser: {{ macos_user | d('') }}
|
||||
rootgroup: {{ macos_group | d('') }}
|
||||
kernel: darwin
|
||||
pkg:
|
||||
prometheus:
|
||||
|
@ -1,3 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# vim: ft=yaml
|
||||
---
|
||||
name: default
|
||||
title: prometheus formula
|
||||
maintainer: SaltStack Formulas
|
||||
|
Loading…
Reference in New Issue
Block a user