feat(yamllint): include for this repo and apply rules throughout
* Semi-automated using `ssf-formula` (v0.5.0) * Fix errors shown below: ```bash prometheus-formula$ $(grep "\- yamllint" .travis.yml | sed -e "s:^\s\+-\s\(.*\):\1:") ./prometheus/osfamilymap.yaml 1:89 error line too long (116 > 88 characters) (line-length) 1:24 error trailing spaces (trailing-spaces) 13:2 error syntax error: found character '%' that cannot start any token 24:89 error line too long (90 > 88 characters) (line-length) 25:89 error line too long (167 > 88 characters) (line-length) ./prometheus/defaults.yaml 6:13 error too many spaces inside braces (braces) 6:35 error too many spaces inside braces (braces) 7:11 error too many spaces inside braces (braces) 7:25 error too many spaces inside braces (braces) 8:22 warning truthy value should be one of [false, true] (truthy) 9:25 warning truthy value should be one of [false, true] (truthy) 49:85 error trailing spaces (trailing-spaces) 103:20 warning truthy value should be one of [false, true] (truthy) 104:25 warning truthy value should be one of [false, true] (truthy) 108:16 warning truthy value should be one of [false, true] (truthy) 113:24 warning missing starting space in comment (comments) pillar.example 31:6 warning missing starting space in comment (comments) 32:8 warning missing starting space in comment (comments) 32:7 warning comment not indented like content (comments-indentation) 51:5 warning comment not indented like content (comments-indentation) 65:89 error line too long (110 > 88 characters) (line-length) 68:29 error too many spaces after colon (colons) 68:34 warning too few spaces before comment (comments) 68:89 error line too long (106 > 88 characters) (line-length) 69:34 warning too few spaces before comment (comments) 69:89 error line too long (98 > 88 characters) (line-length) 75:9 error wrong indentation: expected 10 but found 8 (indentation) 76:11 error wrong indentation: expected 12 but found 10 (indentation) 77:13 warning comment not indented like content (comments-indentation) 79:89 error line too long (101 > 88 characters) (line-length) 81:9 warning comment not indented like content (comments-indentation) 86:89 error line too long (103 > 88 characters) (line-length) 91:11 error wrong indentation: expected 12 but found 10 (indentation) 106:15 error wrong indentation: expected 16 but found 14 (indentation) 108:41 warning too few spaces before comment (comments) 118:89 error line too long (96 > 88 characters) (line-length) 139:13 error wrong indentation: expected 14 but found 12 (indentation) 143:7 error wrong indentation: expected 8 but found 6 (indentation) 145:9 error wrong indentation: expected 10 but found 8 (indentation) 157:6 warning missing starting space in comment (comments) 158:20 error too many spaces inside braces (braces) 158:47 error too many spaces inside braces (braces) ```
This commit is contained in:
parent
41a287398f
commit
07dbfc8d63
13
.travis.yml
13
.travis.yml
@ -3,7 +3,7 @@
|
|||||||
---
|
---
|
||||||
stages:
|
stages:
|
||||||
- test
|
- test
|
||||||
- commitlint
|
- lint
|
||||||
- name: release
|
- name: release
|
||||||
if: branch = master AND type != pull_request
|
if: branch = master AND type != pull_request
|
||||||
|
|
||||||
@ -45,16 +45,21 @@ script:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
include:
|
include:
|
||||||
# Define the commitlint stage
|
# Define the `lint` stage (runs `yamllint` and `commitlint`)
|
||||||
- stage: commitlint
|
- stage: lint
|
||||||
language: node_js
|
language: node_js
|
||||||
node_js: lts/*
|
node_js: lts/*
|
||||||
before_install: skip
|
before_install: skip
|
||||||
script:
|
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/config-conventional -D
|
||||||
- npm install @commitlint/travis-cli -D
|
- npm install @commitlint/travis-cli -D
|
||||||
- commitlint-travis
|
- commitlint-travis
|
||||||
# Define the release stage that runs semantic-release
|
# Define the release stage that runs `semantic-release`
|
||||||
- stage: release
|
- stage: release
|
||||||
language: node_js
|
language: node_js
|
||||||
node_js: lts/*
|
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
|
@ -54,19 +54,21 @@ prometheus:
|
|||||||
# dirs:
|
# dirs:
|
||||||
# files: files_alt
|
# files: files_alt
|
||||||
# default: default_alt
|
# default: default_alt
|
||||||
# source_files:
|
source_files:
|
||||||
# prometheus-config-file-file-managed:
|
prometheus-config-file-file-managed:
|
||||||
# - 'example_alt.tmpl'
|
- 'alt_config.yml.jinja'
|
||||||
# - 'example_alt.tmpl.jinja'
|
|
||||||
|
|
||||||
# Pillar-based config
|
# Pillar-based config
|
||||||
config:
|
config:
|
||||||
prometheus:
|
prometheus:
|
||||||
|
# yamllint disable-line rule:line-length
|
||||||
# ref https://raw.githubusercontent.com/prometheus/prometheus/release-2.10/config/testdata/conf.good.yml
|
# ref https://raw.githubusercontent.com/prometheus/prometheus/release-2.10/config/testdata/conf.good.yml
|
||||||
# my global config
|
# my global config
|
||||||
global:
|
global:
|
||||||
scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
|
# 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.
|
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).
|
# scrape_timeout is set to the global default (10s).
|
||||||
|
|
||||||
# Alertmanager configuration
|
# Alertmanager configuration
|
||||||
@ -76,14 +78,16 @@ prometheus:
|
|||||||
- targets:
|
- targets:
|
||||||
# - alertmanager:9093
|
# - 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:
|
rule_files:
|
||||||
# - "first_rules.yml"
|
- "first_rules.yml"
|
||||||
# - "second_rules.yml"
|
# - "second_rules.yml"
|
||||||
|
|
||||||
# A scrape configuration containing exactly one endpoint to scrape:
|
# A scrape configuration containing exactly one endpoint to scrape:
|
||||||
scrape_configs:
|
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'
|
- job_name: 'prometheus'
|
||||||
# metrics_path defaults to '/metrics'
|
# metrics_path defaults to '/metrics'
|
||||||
# scheme defaults to 'http'.
|
# scheme defaults to 'http'.
|
||||||
@ -115,6 +119,7 @@ prometheus:
|
|||||||
replacement: 127.0.0.1:9115 # The blackbox exporter's real hostname:port.
|
replacement: 127.0.0.1:9115 # The blackbox exporter's real hostname:port.
|
||||||
|
|
||||||
alertmanager:
|
alertmanager:
|
||||||
|
# yamllint disable-line rule:line-length
|
||||||
# ref https://github.com/prometheus/alertmanager/blob/master/config/testdata/conf.good.yml
|
# ref https://github.com/prometheus/alertmanager/blob/master/config/testdata/conf.good.yml
|
||||||
global:
|
global:
|
||||||
smtp_smarthost: 'localhost:25'
|
smtp_smarthost: 'localhost:25'
|
||||||
@ -155,4 +160,5 @@ prometheus:
|
|||||||
|
|
||||||
linux:
|
linux:
|
||||||
# 'Alternatives system' priority: zero disables (default)
|
# 'Alternatives system' priority: zero disables (default)
|
||||||
|
# yamllint disable-line rule:braces
|
||||||
altpriority: {{ range(1, 9100000) | random }}
|
altpriority: {{ range(1, 9100000) | random }}
|
||||||
|
@ -3,10 +3,12 @@
|
|||||||
---
|
---
|
||||||
prometheus:
|
prometheus:
|
||||||
rootgroup: root
|
rootgroup: root
|
||||||
|
# yamllint disable rule:braces
|
||||||
kernel: {{ grains.kernel | lower }}
|
kernel: {{ grains.kernel | lower }}
|
||||||
arch: {{ grains.osarch }}
|
arch: {{ grains.osarch }}
|
||||||
use_upstream_repo: False
|
# yamllint enable rule:braces
|
||||||
use_upstream_archive: False
|
use_upstream_repo: false
|
||||||
|
use_upstream_archive: false
|
||||||
|
|
||||||
wanted:
|
wanted:
|
||||||
- prometheus
|
- prometheus
|
||||||
@ -100,12 +102,12 @@ prometheus:
|
|||||||
uri: https://github.com/prometheus
|
uri: https://github.com/prometheus
|
||||||
suffix: tar.gz
|
suffix: tar.gz
|
||||||
kwargs:
|
kwargs:
|
||||||
trim_output: True
|
trim_output: true
|
||||||
enforce_toplevel: True
|
enforce_toplevel: true
|
||||||
archive_format: tar
|
archive_format: tar
|
||||||
retry:
|
retry:
|
||||||
attempts: 3
|
attempts: 3
|
||||||
until: True
|
until: true
|
||||||
interval: 60
|
interval: 60
|
||||||
splay: 10
|
splay: 10
|
||||||
|
|
||||||
|
@ -21,6 +21,14 @@
|
|||||||
{#- Merge the prometheus pillar #}
|
{#- Merge the prometheus pillar #}
|
||||||
{%- set prometheus = salt['pillar.get']('prometheus', default=defaults, merge=True) %}
|
{%- 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 #}
|
{#- Contactenate arguments #}
|
||||||
{%- macro concat_args(args) %}
|
{%- macro concat_args(args) %}
|
||||||
{%- set args = args|dictsort %}
|
{%- set args = args|dictsort %}
|
||||||
|
@ -10,19 +10,16 @@
|
|||||||
# you will need to provide at least an empty dict in this file, e.g.
|
# you will need to provide at least an empty dict in this file, e.g.
|
||||||
# osfamilymap: {}
|
# 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: {}
|
Debian: {}
|
||||||
|
|
||||||
RedHat:
|
RedHat:
|
||||||
pkg:
|
pkg:
|
||||||
prometheus:
|
prometheus:
|
||||||
repo:
|
repo:
|
||||||
|
# yamllint disable rule:line-length
|
||||||
baseurl: 'https://packagecloud.io/prometheus-rpm/release/el/$releasever/$basearch'
|
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'
|
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
|
metadata_expire: 300
|
||||||
|
|
||||||
Suse: {}
|
Suse: {}
|
||||||
@ -114,8 +111,6 @@ Windows:
|
|||||||
archive_hash: 9362b7482e74792f111c4bb1a372b18a88f6354c78f24713bacfbcb050883556
|
archive_hash: 9362b7482e74792f111c4bb1a372b18a88f6354c78f24713bacfbcb050883556
|
||||||
|
|
||||||
MacOS:
|
MacOS:
|
||||||
rootuser: {{ macos_user | d('') }}
|
|
||||||
rootgroup: {{ macos_group | d('') }}
|
|
||||||
kernel: darwin
|
kernel: darwin
|
||||||
pkg:
|
pkg:
|
||||||
prometheus:
|
prometheus:
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# vim: ft=yaml
|
||||||
|
---
|
||||||
name: default
|
name: default
|
||||||
title: prometheus formula
|
title: prometheus formula
|
||||||
maintainer: SaltStack Formulas
|
maintainer: SaltStack Formulas
|
||||||
|
Loading…
Reference in New Issue
Block a user