Skip to content

Commit 1b4b35b

Browse files
authored
Merge pull request #23 from genebean/release-prep
Release prep & CI overhaul
2 parents fa8bfbc + 00be50e commit 1b4b35b

File tree

13 files changed

+72
-66
lines changed

13 files changed

+72
-66
lines changed

.github/workflows/ci.yml

Lines changed: 15 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -4,42 +4,27 @@ on:
44
pull_request:
55
branches:
66
- master
7+
push:
78

89
jobs:
910
test:
10-
runs-on: ubuntu-latest
11+
runs-on: ubuntu-18.04
1112
strategy:
1213
matrix:
13-
ruby: [ '2.4.x', '2.5.x' ]
14+
puppet_versions:
15+
- '5'
16+
- '6'
1417

15-
name: Ruby ${{ matrix.ruby }}
18+
name: Puppet ${{ matrix.puppet_versions }}
1619
steps:
1720
- uses: actions/checkout@v1
18-
- name: Set up Ruby
19-
uses: actions/setup-ruby@v1
20-
with:
21-
ruby-version: ${{ matrix.ruby }}
22-
architecture: 'x64'
23-
- name: Run tests
21+
- name: Install the Puppet PDK
2422
run: |
25-
RUBY_MINOR_VERSION=$(ruby --version |cut -f 2 -d ' ' | cut -d '.' -f1,2)
26-
case $RUBY_MINOR_VERSION in
27-
'2.4')
28-
PUPPET_GEM_VERSION='~> 5.0'
29-
;;
30-
'2.5')
31-
PUPPET_GEM_VERSION='~> 6.0'
32-
;;
33-
*)
34-
exit 1
35-
;;
36-
esac
37-
gem install bundler
38-
bundle -v
39-
rm -f Gemfile.lock
40-
gem update --system $RUBYGEMS_VERSION
41-
gem --version
42-
bundle -v
43-
bundle install --jobs=3 --retry=3 --without system_tests
44-
bundle exec rake check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop syntax lint metadata_lint
45-
bundle exec rake parallel_spec
23+
wget https://apt.puppet.com/puppet-tools-release-bionic.deb
24+
sudo dpkg -i puppet-tools-release-bionic.deb
25+
sudo apt-get update
26+
sudo apt-get install pdk
27+
- name: Syntax validation
28+
run: pdk validate --puppet-version ${{ matrix.puppet_versions }}
29+
- name: Unit tests
30+
run: pdk test unit --puppet-version ${{ matrix.puppet_versions }}

.rubocop.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ Style/BlockDelimiters:
4040
Description: Prefer braces for chaining. Mostly an aesthetical choice. Better to
4141
be consistent then.
4242
EnforcedStyle: braces_for_chaining
43+
Style/BracesAroundHashParameters:
44+
Description: Braces are required by Ruby 2.7. Cop removed from RuboCop v0.80.0.
45+
See https://github.com/rubocop-hq/rubocop/pull/7643
46+
Enabled: true
4347
Style/ClassAndModuleChildren:
4448
Description: Compact style reduces the required amount of indentation.
4549
EnforcedStyle: compact

.vscode/extensions.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"recommendations": [
3-
"jpogran.puppet-vscode",
3+
"puppet.puppet-vscode",
44
"rebornix.Ruby"
55
]
66
}

Gemfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ group :development do
2424
gem "json", '= 2.0.4', require: false if Gem::Requirement.create('~> 2.4.2').satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
2525
gem "json", '= 2.1.0', require: false if Gem::Requirement.create(['>= 2.5.0', '< 2.7.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
2626
gem "rb-readline", '= 0.5.5', require: false, platforms: [:mswin, :mingw, :x64_mingw]
27-
gem "puppet-module-posix-default-r#{minor_version}", '~> 0.3', require: false, platforms: [:ruby]
28-
gem "puppet-module-posix-dev-r#{minor_version}", '~> 0.3', require: false, platforms: [:ruby]
29-
gem "puppet-module-win-default-r#{minor_version}", '~> 0.3', require: false, platforms: [:mswin, :mingw, :x64_mingw]
30-
gem "puppet-module-win-dev-r#{minor_version}", '~> 0.3', require: false, platforms: [:mswin, :mingw, :x64_mingw]
27+
gem "puppet-module-posix-default-r#{minor_version}", '~> 0.4', require: false, platforms: [:ruby]
28+
gem "puppet-module-posix-dev-r#{minor_version}", '~> 0.4', require: false, platforms: [:ruby]
29+
gem "puppet-module-win-default-r#{minor_version}", '~> 0.4', require: false, platforms: [:mswin, :mingw, :x64_mingw]
30+
gem "puppet-module-win-dev-r#{minor_version}", '~> 0.4', require: false, platforms: [:mswin, :mingw, :x64_mingw]
3131
gem "github_changelog_generator", '1.15.0', require: false
3232
end
3333

REFERENCE.md

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,29 @@
11
# Reference
2+
23
<!-- DO NOT EDIT: This document was generated by Puppet Strings -->
34

45
## Table of Contents
56

6-
**Classes**
7+
### Classes
78

8-
_Public Classes_
9+
#### Public Classes
910

1011
* [`promtail`](#promtail): promtail's main interface. All interactions should be with this class.
1112

12-
_Private Classes_
13+
#### Private Classes
1314

1415
* `promtail::config`: Creates files and folders associated with promtail's config
1516
* `promtail::install`: Installs promtail
1617
* `promtail::service`: Creates a service defintion for promtail
1718

18-
**Functions**
19+
### Functions
1920

2021
* [`promtail::strip_yaml_header`](#promtailstrip_yaml_header): A function to strip the --- from the beginning of a string
2122
* [`promtail::to_yaml`](#promtailto_yaml): A function to convert a hash into yaml for the promtail config
2223

2324
## Classes
2425

25-
### promtail
26+
### `promtail`
2627

2728
promtail's main interface. All interactions should be with this class. The promtail
2829
module is intended to install and configure Grafana's promtail tool for shipping
@@ -68,7 +69,6 @@ promtail::positions_config_hash:
6869
promtail::scrape_configs_hash:
6970
scrape_configs:
7071
- job_name: system_secure
71-
entry_parser: raw
7272
static_configs:
7373
- targets:
7474
- localhost
@@ -77,7 +77,6 @@ promtail::scrape_configs_hash:
7777
host: "%{facts.networking.fqdn}"
7878
__path__: /var/log/secure
7979
- job_name: system_messages
80-
entry_parser: raw
8180
static_configs:
8281
- targets:
8382
- localhost
@@ -102,6 +101,12 @@ class profile::logging::promtail {
102101

103102
The following parameters are available in the `promtail` class.
104103

104+
##### `service_enable`
105+
106+
Data type: `Boolean`
107+
108+
The value passed to the service resource's enable parameter for promtail's service
109+
105110
##### `service_ensure`
106111

107112
Data type: `Enum['running', 'stopped']`
@@ -163,7 +168,7 @@ is omitted.
163168
See https://github.com/grafana/loki/blob/master/docs/clients/promtail/configuration.md
164169
for all parameters.
165170

166-
Default value: `undef`
171+
Default value: ``undef``
167172

168173
##### `target_config_hash`
169174

@@ -174,15 +179,15 @@ is omitted.
174179
See https://github.com/grafana/loki/blob/master/docs/clients/promtail/configuration.md
175180
for all parameters.
176181

177-
Default value: `undef`
182+
Default value: ``undef``
178183

179184
##### `password_file_path`
180185

181186
Data type: `Optional[Stdlib::Absolutepath]`
182187

183188
The fully qualified path to the file containing the password used for basic auth
184189

185-
Default value: `undef`
190+
Default value: ``undef``
186191

187192
##### `password_file_content`
188193

@@ -191,11 +196,19 @@ Data type: `Optional[Sensitive[String[1]]]`
191196
The value to be placed in the password file. This value is cast to Sensitive via
192197
lookup_options defined in `data/common.yaml`
193198

194-
Default value: `undef`
199+
Default value: ``undef``
200+
201+
##### `source_url`
202+
203+
Data type: `Stdlib::HTTPUrl`
204+
205+
The URL from which promtail packages can be downloaded
206+
207+
Default value: `'https://github.com/grafana/loki/releases/download'`
195208

196209
## Functions
197210

198-
### promtail::strip_yaml_header
211+
### `promtail::strip_yaml_header`
199212

200213
Type: Ruby 4.x API
201214

@@ -237,7 +250,7 @@ Data type: `String`
237250

238251
A string that may start with the ---'s used to denote a YAML file
239252

240-
### promtail::to_yaml
253+
### `promtail::to_yaml`
241254

242255
Type: Ruby 4.x API
243256

Rakefile

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
require 'puppet_litmus/rake_tasks' if Bundler.rubygems.find_name('puppet_litmus').any?
24
require 'puppetlabs_spec_helper/rake_tasks'
35
require 'puppet-syntax/tasks/puppet-syntax'
@@ -51,36 +53,35 @@ if Bundler.rubygems.find_name('github_changelog_generator').any?
5153
config.header = "# Change log\n\nAll notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org)."
5254
config.add_pr_wo_labels = true
5355
config.issues = false
54-
config.merge_prefix = "### UNCATEGORIZED PRS; GO LABEL THEM"
56+
config.merge_prefix = "### UNCATEGORIZED PRS; LABEL THEM ON GITHUB"
5557
config.configure_sections = {
5658
"Changed" => {
5759
"prefix" => "### Changed",
5860
"labels" => ["backwards-incompatible"],
5961
},
6062
"Added" => {
6163
"prefix" => "### Added",
62-
"labels" => ["feature", "enhancement"],
64+
"labels" => ["enhancement", "feature"],
6365
},
6466
"Fixed" => {
6567
"prefix" => "### Fixed",
66-
"labels" => ["bugfix"],
68+
"labels" => ["bug", "documentation", "bugfix"],
6769
},
6870
}
6971
end
7072
else
7173
desc 'Generate a Changelog from GitHub'
7274
task :changelog do
7375
raise <<EOM
74-
The changelog tasks depends on unreleased features of the github_changelog_generator gem.
76+
The changelog tasks depends on recent features of the github_changelog_generator gem.
7577
Please manually add it to your .sync.yml for now, and run `pdk update`:
7678
---
7779
Gemfile:
7880
optional:
7981
':development':
8082
- gem: 'github_changelog_generator'
81-
git: 'https://github.com/skywinder/github-changelog-generator'
82-
ref: '20ee04ba1234e9e83eb2ffb5056e23d641c7a018'
83-
condition: "Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.2.2')"
83+
version: '~> 1.15'
84+
condition: "Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.3.0')"
8485
EOM
8586
end
8687
end

manifests/init.pp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
# module is intended to install and configure Grafana's promtail tool for shipping
55
# logs to Loki.
66
#
7+
# @param [Boolean] service_enable
8+
# The value passed to the service resource's enable parameter for promtail's service
9+
#
710
# @param [Enum['running', 'stopped']] service_ensure
811
# The value passed to the service resource's ensure parameter for promtail's service
912
#
@@ -54,6 +57,9 @@
5457
# The value to be placed in the password file. This value is cast to Sensitive via
5558
# lookup_options defined in `data/common.yaml`
5659
#
60+
# @param [Stdlib::HTTPUrl] source_url
61+
# The URL from which promtail packages can be downloaded
62+
#
5763
# @example
5864
# include promtail
5965
#
@@ -84,7 +90,6 @@
8490
# promtail::scrape_configs_hash:
8591
# scrape_configs:
8692
# - job_name: system_secure
87-
# entry_parser: raw
8893
# static_configs:
8994
# - targets:
9095
# - localhost
@@ -93,7 +98,6 @@
9398
# host: "%{facts.networking.fqdn}"
9499
# __path__: /var/log/secure
95100
# - job_name: system_messages
96-
# entry_parser: raw
97101
# static_configs:
98102
# - targets:
99103
# - localhost
@@ -111,8 +115,8 @@
111115
# }
112116
#
113117
class promtail (
114-
Enum['running', 'stopped'] $service_ensure,
115118
Boolean $service_enable,
119+
Enum['running', 'stopped'] $service_ensure,
116120
Hash $clients_config_hash,
117121
Hash $positions_config_hash,
118122
Hash $scrape_configs_hash,

metadata.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "grafana-promtail",
3-
"version": "0.4.0",
3+
"version": "0.4.1",
44
"author": "grafana",
55
"summary": "Deploy and configure Grafana's Promtail",
66
"license": "Apache-2.0",
@@ -69,7 +69,7 @@
6969
"version_requirement": ">= 4.10.0 < 7.0.0"
7070
}
7171
],
72-
"pdk-version": "1.15.0",
73-
"template-url": "pdk-default#1.15.0",
74-
"template-ref": "tags/1.15.0-0-g0bc522e"
72+
"pdk-version": "1.18.1",
73+
"template-url": "pdk-default#1.18.1",
74+
"template-ref": "tags/1.18.1-0-g3d2e75c"
7575
}

spec/classes/config_spec.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
scrape_configs_hash => {
3333
'scrape_configs' => [{
3434
'job_name' => 'system_secure',
35-
'entry_parser' => 'raw',
3635
'static_configs' => [{
3736
'targets' => [ 'localhost' ],
3837
'labels' => {

spec/classes/install_spec.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
scrape_configs_hash => {
3333
'scrape_configs' => [{
3434
'job_name' => 'system_secure',
35-
'entry_parser' => 'raw',
3635
'static_configs' => [{
3736
'targets' => [ 'localhost' ],
3837
'labels' => {

0 commit comments

Comments
 (0)