simp-rake-helpers 6.2.0 → 7.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +24 -0
- data/lib/simp/rake/build/pkg.rb +2 -2
- data/lib/simp/rake/helpers/version.rb +1 -1
- data/lib/simp/rake/pkg.rb +16 -10
- data/lib/simp/rake/pupmod/helpers.rb +0 -177
- data/lib/simp/relchecks.rb +32 -14
- data/spec/lib/simp/rake/pupmod/helpers_spec.rb +0 -43
- data/spec/lib/simp/relchecks_compare_latest_tag_spec.rb +33 -10
- data/spec/lib/simp/relchecks_significant_file_spec.rb +46 -0
- metadata +25 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 17a61d8752d73045b67c31db5865a27333eb179929cbe3547077293196212f9a
|
|
4
|
+
data.tar.gz: 3a207e85eb8c285d67cf1f013db9da5f9ce4bef508eea997d796cd3b08632e99
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: cd50a6943242009704ebb20410c4ed70b14af882268b648d6dd5ffbaf206c2394e2244b93bee220e6b40d96baeb86048dd8b8b0cd026afdc1b6c369d0a6f0f89
|
|
7
|
+
data.tar.gz: 891d1280e437f99c3a8fdba93b20d7931bfb6e3eaa86887a1eb9e5567f241505436a569eb057f805d979d188b84d92d2a312256fd8f43d5f01df4e2900d51ff1
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,27 @@
|
|
|
1
|
+
### 7.0.0 / 2026-10-05
|
|
2
|
+
- Changed
|
|
3
|
+
- **BREAKING:** `pkg:compare_latest_tag` decides whether a Puppet module
|
|
4
|
+
needs a new version from a list of the paths Puppet and Bolt load plus
|
|
5
|
+
`README.md` and `REFERENCE.md`, instead of a list of paths to ignore.
|
|
6
|
+
Changes to those two files now require a version bump; other Markdown
|
|
7
|
+
files and unlisted paths (such as `examples/` and tooling config) no
|
|
8
|
+
longer do
|
|
9
|
+
- **BREAKING:** Removed the `compare_latest_tag` and
|
|
10
|
+
`changelog_annotation` Rake tasks for Puppet modules, deprecated in
|
|
11
|
+
5.12.0; use `pkg:compare_latest_tag` and `pkg:create_tag_changelog`
|
|
12
|
+
|
|
13
|
+
### 6.3.0 / 2026-10-03
|
|
14
|
+
- Changed
|
|
15
|
+
- Allow voxpupuli-test 15, which moves to rubocop 1.91, rubocop-rspec 3.10
|
|
16
|
+
and rspec-puppet 6
|
|
17
|
+
- The OpenVox 9 spec row tests the 9.0.0 release (`~> 9.0`, openfact
|
|
18
|
+
`~> 6.0`) and is blocking
|
|
19
|
+
- Fixed
|
|
20
|
+
- Require `json` < 3. openvox's `Puppet::Util::Json` is incompatible with
|
|
21
|
+
json 3.0, which breaks every rspec-puppet catalog compilation; rubocop
|
|
22
|
+
1.85 used to keep json below 3, but the rubocop 1.91 that voxpupuli-test
|
|
23
|
+
15 brings does not
|
|
24
|
+
|
|
1
25
|
### 6.2.0 / 2026-09-23
|
|
2
26
|
- Added
|
|
3
27
|
- Support for OpenVox 9
|
data/lib/simp/rake/build/pkg.rb
CHANGED
|
@@ -32,8 +32,8 @@ class Simp::Rake::Build::Pkg < Rake::TaskLib
|
|
|
32
32
|
# nil = default not set; use local preference
|
|
33
33
|
@fetch_published_rpm_default = if ENV['SIMP_PKG_fetch_published_rpm']
|
|
34
34
|
(
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
(ENV.fetch('SIMP_PKG_fetch_published_rpm', nil) =~ %r{\A(yes|true)\Z}i) ? true : false
|
|
36
|
+
)
|
|
37
37
|
else
|
|
38
38
|
nil
|
|
39
39
|
end
|
data/lib/simp/rake/pkg.rb
CHANGED
|
@@ -318,9 +318,9 @@ class Simp::Rake::Pkg < Rake::TaskLib
|
|
|
318
318
|
end
|
|
319
319
|
|
|
320
320
|
if latest_rpm && (
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
321
|
+
Gem::Version.new(latest_rpm.full_version) >=
|
|
322
|
+
Gem::Version.new(@spec_info.full_version)
|
|
323
|
+
)
|
|
324
324
|
latest_rpm.rpm_name
|
|
325
325
|
else
|
|
326
326
|
"#{f}-#{@spec_info.full_version}-#{@spec_info.arch}.rpm"
|
|
@@ -550,15 +550,21 @@ class Simp::Rake::Pkg < Rake::TaskLib
|
|
|
550
550
|
CHANGELOG and metadata.json files.
|
|
551
551
|
(3) The latest version is < latest tag.
|
|
552
552
|
|
|
553
|
-
|
|
554
|
-
significant:
|
|
553
|
+
For a Puppet module, only changes to the paths Puppet or Bolt
|
|
554
|
+
load, plus the docs users read, are significant:
|
|
555
|
+
- CHANGELOG, LICENSE, README.md, REFERENCE.md, metadata.json,
|
|
556
|
+
hiera.yaml and bolt_plugin.json
|
|
557
|
+
- SIMP, build, data, facts.d, files, functions, lib, locales,
|
|
558
|
+
manifests, plans, tasks, templates and types directories
|
|
559
|
+
|
|
560
|
+
For any other component, changes to the following
|
|
561
|
+
files/directories are not considered significant:
|
|
555
562
|
- Any hidden file/directory (entry that begins with a '.')
|
|
556
|
-
- Gemfile
|
|
557
|
-
- Gemfile.lock
|
|
563
|
+
- Gemfile*
|
|
558
564
|
- Rakefile
|
|
559
|
-
- rakelib
|
|
560
|
-
-
|
|
561
|
-
-
|
|
565
|
+
- rakelib, spec and doc directories
|
|
566
|
+
- Markdown (*.md) files
|
|
567
|
+
- renovate.json
|
|
562
568
|
EOM
|
|
563
569
|
task :compare_latest_tag, [:tags_source, :verbose] do |_t, args|
|
|
564
570
|
tags_source = args[:tags_source].nil? ? 'origin' : args[:tags_source]
|
|
@@ -34,9 +34,6 @@ end
|
|
|
34
34
|
|
|
35
35
|
# Rake tasks for SIMP Puppet modules
|
|
36
36
|
class Simp::Rake::Pupmod::Helpers < Rake::TaskLib
|
|
37
|
-
# See https://fedoraproject.org/wiki/Packaging:Guidelines?rd=Packaging/Guidelines#Changelogs
|
|
38
|
-
CHANGELOG_ENTRY_REGEX = %r{^\*\s+((?:Mon|Tue|Wed|Thu|Fri|Sat|Sun) (?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) \d{1,2} \d{4})\s+(.+<.+>)(?:\s+|\s*-\s*)?(\d+\.\d+\.\d+)}.freeze
|
|
39
|
-
|
|
40
37
|
def initialize(base_dir = Dir.pwd)
|
|
41
38
|
@base_dir = base_dir
|
|
42
39
|
@temp_fixtures_path = File.join(base_dir, 'spec', 'fixtures', 'simp_rspec')
|
|
@@ -111,49 +108,6 @@ class Simp::Rake::Pupmod::Helpers < Rake::TaskLib
|
|
|
111
108
|
@metadata ||= JSON.parse(File.read(_file))
|
|
112
109
|
end
|
|
113
110
|
|
|
114
|
-
# Generate an appropriate annotated tag entry from the modules' CHANGELOG
|
|
115
|
-
#
|
|
116
|
-
# @note this currently does not support the valid RPM `%changelog` format
|
|
117
|
-
# that places the version number on the next line:
|
|
118
|
-
#
|
|
119
|
-
# * Fri Mar 02 2012 Maintenance
|
|
120
|
-
# 4.0.0-2
|
|
121
|
-
# - Improved test stubs.
|
|
122
|
-
#
|
|
123
|
-
def changelog_annotation(quiet = false, file = nil)
|
|
124
|
-
result = ''
|
|
125
|
-
changelog_file = file || File.join(@base_dir, 'CHANGELOG')
|
|
126
|
-
module_version = metadata['version']
|
|
127
|
-
changelogs = {}
|
|
128
|
-
|
|
129
|
-
_entry = {} # current log entry's metadata (empty unless valid entry)
|
|
130
|
-
File.read(changelog_file).each_line do |line|
|
|
131
|
-
if line =~ %r{^\*}
|
|
132
|
-
if CHANGELOG_ENTRY_REGEX.match(line).nil?
|
|
133
|
-
warn %(WARNING: invalid changelogs entry: "#{line}") unless quiet
|
|
134
|
-
_entry = {}
|
|
135
|
-
else
|
|
136
|
-
_entry = {
|
|
137
|
-
:date => ::Regexp.last_match(1),
|
|
138
|
-
:user => ::Regexp.last_match(2),
|
|
139
|
-
:release => ::Regexp.last_match(3)
|
|
140
|
-
}
|
|
141
|
-
changelogs[_entry[:release]] ||= []
|
|
142
|
-
changelogs[_entry[:release]] << line
|
|
143
|
-
next
|
|
144
|
-
end
|
|
145
|
-
end
|
|
146
|
-
|
|
147
|
-
# Don't add anything to the annotation unless reach the next valid entry
|
|
148
|
-
changelogs[_entry[:release]] << " #{line}" if _entry.fetch(:release, false)
|
|
149
|
-
end
|
|
150
|
-
|
|
151
|
-
raise "Did not find any changelogs entries for version #{module_version}" if changelogs[module_version].nil?
|
|
152
|
-
|
|
153
|
-
result += "\nRelease of #{module_version}\n\n"
|
|
154
|
-
result + changelogs[module_version].join
|
|
155
|
-
end
|
|
156
|
-
|
|
157
111
|
def custom_fixtures_hook(opts = {
|
|
158
112
|
:short_name => nil,
|
|
159
113
|
:puppetfile => nil,
|
|
@@ -264,137 +218,6 @@ class Simp::Rake::Pupmod::Helpers < Rake::TaskLib
|
|
|
264
218
|
custom_fixtures_path
|
|
265
219
|
end
|
|
266
220
|
|
|
267
|
-
desc <<-EOM
|
|
268
|
-
Generate an appropriate annotated tag entry from a CHANGELOG.
|
|
269
|
-
|
|
270
|
-
ARGS:
|
|
271
|
-
* :quiet => Set to 'true' if you want to suppress warning messages
|
|
272
|
-
|
|
273
|
-
NOTES:
|
|
274
|
-
* The entries are extracted from a match with the version from the
|
|
275
|
-
module's metadata.json
|
|
276
|
-
* If no match is found, the task will fail
|
|
277
|
-
* Changelog entries must follow the format:
|
|
278
|
-
* Wed Jul 05 2017 UserName <username@simp.com> - 1.2.3-4
|
|
279
|
-
- The entry must start with *. Any line beginning with * will be
|
|
280
|
-
interpreted as an entry.
|
|
281
|
-
- The dates must be RPM compatible, in chronological order
|
|
282
|
-
- The user email must be contained in < >
|
|
283
|
-
- The entry must be terminated by the release
|
|
284
|
-
* Any entry that does not follow the prescribed format will not be
|
|
285
|
-
annotated properly
|
|
286
|
-
EOM
|
|
287
|
-
# TODO: Hook in a query of the auto-generated specfile:
|
|
288
|
-
# `rpm -q --specfile dist/tmp/*.spec --changelog`
|
|
289
|
-
# That will give Travis a way of warning us if the changelog
|
|
290
|
-
# will prevent the rpm from building.
|
|
291
|
-
task :changelog_annotation, [:quiet] do |_t, args|
|
|
292
|
-
warn('DEPRECATED: use pkg:create_tag_changelog')
|
|
293
|
-
quiet = true if args[:quiet].to_s == 'true'
|
|
294
|
-
puts changelog_annotation(quiet)
|
|
295
|
-
end
|
|
296
|
-
|
|
297
|
-
desc <<-EOM
|
|
298
|
-
Compare to latest tag.
|
|
299
|
-
ARGS:
|
|
300
|
-
* :tags_source => Set to the remote from which the tags for this
|
|
301
|
-
project can be fetched, e.g. 'upstream' for a
|
|
302
|
-
forked project. Defaults to 'origin'.
|
|
303
|
-
* :ignore_owner => Execute comparison even if the project owner
|
|
304
|
-
is not 'simp'.
|
|
305
|
-
* :verbose => Set to 'true' if you want to see detailed messages
|
|
306
|
-
|
|
307
|
-
NOTES:
|
|
308
|
-
Compares mission-impacting (significant) files with the latest
|
|
309
|
-
tag and identifies the relevant files that have changed.
|
|
310
|
-
|
|
311
|
-
Does nothing if the project owner, as specified in the
|
|
312
|
-
metadata.json file, is not 'simp'.
|
|
313
|
-
|
|
314
|
-
When mission-impacting files have changed, fails if
|
|
315
|
-
(1) Latest version cannot be extracted from the top-most
|
|
316
|
-
CHANGELOG entry.
|
|
317
|
-
(2) The latest version in the CHANGELOG (minus the release
|
|
318
|
-
qualifier) does not match the version in the metadata.json
|
|
319
|
-
file.
|
|
320
|
-
(3) A version bump is required but not recorded in both the
|
|
321
|
-
CHANGELOG and metadata.json files.
|
|
322
|
-
(4) The latest version is < latest tag.
|
|
323
|
-
|
|
324
|
-
Changes to the following files/directories are not considered
|
|
325
|
-
significant:
|
|
326
|
-
- Any hidden file/directory (entry that begins with a '.')
|
|
327
|
-
- Gemfile
|
|
328
|
-
- Gemfile.lock
|
|
329
|
-
- Rakefile
|
|
330
|
-
- rakelib directory
|
|
331
|
-
- spec directory
|
|
332
|
-
- doc directory
|
|
333
|
-
EOM
|
|
334
|
-
task :compare_latest_tag, [:tags_source, :ignore_owner, :verbose] do |_t, args|
|
|
335
|
-
warn('DEPRECATED: use pkg:compare_latest_tag')
|
|
336
|
-
require 'json'
|
|
337
|
-
|
|
338
|
-
tags_source = args[:tags_source].nil? ? 'origin' : args[:tags_source]
|
|
339
|
-
ignore_owner = true if args[:ignore_owner].to_s == 'true'
|
|
340
|
-
verbose = true if args[:verbose].to_s == 'true'
|
|
341
|
-
|
|
342
|
-
module_version = metadata['version']
|
|
343
|
-
owner = metadata['name'].split('-')[0]
|
|
344
|
-
|
|
345
|
-
if (owner == 'simp') || ignore_owner
|
|
346
|
-
# determine last tag
|
|
347
|
-
`git fetch -t #{tags_source} 2>/dev/null`
|
|
348
|
-
tags = `git tag -l`.split("\n")
|
|
349
|
-
puts "Available tags from #{tags_source} = #{tags}" if verbose
|
|
350
|
-
tags.delete_if { |tag| tag.include?('-') or (tag =~ %r{^v}) }
|
|
351
|
-
|
|
352
|
-
if tags.empty?
|
|
353
|
-
puts "No tags exist from #{tags_source}"
|
|
354
|
-
else
|
|
355
|
-
last_tag = tags.max { |a, b| Gem::Version.new(a) <=> Gem::Version.new(b) }
|
|
356
|
-
|
|
357
|
-
# determine mission-impacting files that have changed
|
|
358
|
-
files_changed = `git diff tags/#{last_tag} --name-only`.strip.split("\n")
|
|
359
|
-
files_changed.delete_if do |file|
|
|
360
|
-
file[0] == '.' || file =~ %r{^Gemfile} || file == 'Rakefile' || file =~ %r{^spec/} || file =~ %r{^doc/} || file =~ %r{^rakelib/}
|
|
361
|
-
end
|
|
362
|
-
|
|
363
|
-
if files_changed.empty?
|
|
364
|
-
puts " No new tag required: No significant files have changed since '#{last_tag}' tag"
|
|
365
|
-
else
|
|
366
|
-
unless ignore_owner
|
|
367
|
-
# determine latest version from CHANGELOG, which will present
|
|
368
|
-
# for all SIMP Puppet modules
|
|
369
|
-
line = File.readlines('CHANGELOG')[0]
|
|
370
|
-
match = line.match(CHANGELOG_ENTRY_REGEX)
|
|
371
|
-
unless match
|
|
372
|
-
raise("ERROR: Invalid CHANGELOG entry. Unable to extract version from '#{line}'")
|
|
373
|
-
end
|
|
374
|
-
|
|
375
|
-
changelog_version = match[3]
|
|
376
|
-
unless module_version == changelog_version
|
|
377
|
-
raise("ERROR: Version mismatch. module version=#{module_version} changelog version=#{changelog_version}")
|
|
378
|
-
end
|
|
379
|
-
end
|
|
380
|
-
|
|
381
|
-
curr_module_version = Gem::Version.new(module_version)
|
|
382
|
-
last_tag_version = Gem::Version.new(last_tag)
|
|
383
|
-
|
|
384
|
-
if curr_module_version < last_tag_version
|
|
385
|
-
raise("ERROR: Version regression. '#{module_version}' < last tag '#{last_tag}'")
|
|
386
|
-
elsif curr_module_version == last_tag_version
|
|
387
|
-
raise("ERROR: Version update beyond last tag '#{last_tag}' is required for #{files_changed.count} changed files:\n * #{files_changed.join("\n * ")}")
|
|
388
|
-
else
|
|
389
|
-
puts "NOTICE: New tag of version '#{module_version}' is required for #{files_changed.count} changed files:\n * #{files_changed.join("\n * ")}"
|
|
390
|
-
end
|
|
391
|
-
end
|
|
392
|
-
end
|
|
393
|
-
else
|
|
394
|
-
puts " Not evaluating module owned by '#{owner}'"
|
|
395
|
-
end
|
|
396
|
-
end
|
|
397
|
-
|
|
398
221
|
desc 'Run syntax, lint, and spec tests.'
|
|
399
222
|
task :test => [
|
|
400
223
|
:syntax,
|
data/lib/simp/relchecks.rb
CHANGED
|
@@ -9,6 +9,13 @@ module Simp; end
|
|
|
9
9
|
|
|
10
10
|
# Class that provide release-related checks
|
|
11
11
|
class Simp::RelChecks
|
|
12
|
+
# Paths in a Puppet module that Puppet or Bolt load, plus the docs users
|
|
13
|
+
# read; a change to any of them requires a new version
|
|
14
|
+
MODULE_SIGNIFICANT_FILES = %r{
|
|
15
|
+
\A(?:CHANGELOG|LICENSE|README\.md|REFERENCE\.md|metadata\.json|hiera\.yaml|bolt_plugin\.json)\z |
|
|
16
|
+
\A(?:SIMP|build|data|facts\.d|files|functions|lib|locales|manifests|plans|tasks|templates|types)/
|
|
17
|
+
}x.freeze
|
|
18
|
+
|
|
12
19
|
# Check a component's RPM changelog using the 'rpm' command.
|
|
13
20
|
#
|
|
14
21
|
# This task will fail if 'rpm' detects any changelog problems,
|
|
@@ -63,16 +70,8 @@ class Simp::RelChecks
|
|
|
63
70
|
# (2) A version bump is required but not recorded in both the
|
|
64
71
|
# CHANGELOG and metadata.json files.
|
|
65
72
|
# (3) The latest version is < latest tag.
|
|
66
|
-
|
|
67
|
-
#
|
|
68
|
-
# significant:
|
|
69
|
-
# - Any hidden file/directory (entry that begins with a '.')
|
|
70
|
-
# - Gemfile
|
|
71
|
-
# - Gemfile.lock
|
|
72
|
-
# - Rakefile
|
|
73
|
-
# - rakelib directory
|
|
74
|
-
# - spec directory
|
|
75
|
-
# - doc directory
|
|
73
|
+
#
|
|
74
|
+
# Which changed files are significant is decided by significant_file?
|
|
76
75
|
#
|
|
77
76
|
# +component_dir+:: The root directory of the component project.
|
|
78
77
|
# +tags_source+:: The remote from which the tags for this project
|
|
@@ -93,10 +92,8 @@ class Simp::RelChecks
|
|
|
93
92
|
last_tag = tags.max { |a, b| Gem::Version.new(a) <=> Gem::Version.new(b) }
|
|
94
93
|
|
|
95
94
|
# determine mission-impacting files that have changed
|
|
96
|
-
files_changed = `git diff tags/#{last_tag} --name-only`.
|
|
97
|
-
files_changed.
|
|
98
|
-
file[0] == '.' or file == 'Rakefile' or file =~ %r{^Gemfile|^spec/|^doc/|^rakelib/|.*\.md\Z} or file == 'renovate.json'
|
|
99
|
-
end
|
|
95
|
+
files_changed = `git diff -z tags/#{last_tag} --name-only --no-renames`.b.split("\0".b)
|
|
96
|
+
files_changed.select! { |file| significant_file?(file, info.type) }
|
|
100
97
|
|
|
101
98
|
if files_changed.empty?
|
|
102
99
|
puts " No new tag required: No significant files have changed since '#{last_tag}' tag"
|
|
@@ -116,6 +113,27 @@ class Simp::RelChecks
|
|
|
116
113
|
end
|
|
117
114
|
end
|
|
118
115
|
|
|
116
|
+
# Whether a change to a file requires a new version of the component
|
|
117
|
+
#
|
|
118
|
+
# A Puppet module lists the paths Puppet or Bolt load, plus the docs users
|
|
119
|
+
# read (MODULE_SIGNIFICANT_FILES); any other path is not significant.
|
|
120
|
+
#
|
|
121
|
+
# For any other component, every path is significant except:
|
|
122
|
+
# - Any hidden file/directory (entry that begins with a '.')
|
|
123
|
+
# - Gemfile*
|
|
124
|
+
# - Rakefile
|
|
125
|
+
# - rakelib, spec and doc directories
|
|
126
|
+
# - Markdown (*.md) files
|
|
127
|
+
# - renovate.json
|
|
128
|
+
#
|
|
129
|
+
# +file+:: Path relative to the root of the component
|
|
130
|
+
# +type+:: The component type (:module or :asset), from Simp::ComponentInfo
|
|
131
|
+
def self.significant_file?(file, type)
|
|
132
|
+
return file.match?(MODULE_SIGNIFICANT_FILES) if type == :module
|
|
133
|
+
|
|
134
|
+
!(file[0] == '.' or file == 'Rakefile' or file =~ %r{^Gemfile|^spec/|^doc/|^rakelib/|.*\.md\Z} or file == 'renovate.json')
|
|
135
|
+
end
|
|
136
|
+
|
|
119
137
|
# Generate an appropriate changelog for an annotated tag from a
|
|
120
138
|
# component's CHANGELOG or RPM spec file.
|
|
121
139
|
#
|
|
@@ -22,47 +22,4 @@ describe Simp::Rake::Pupmod::Helpers do
|
|
|
22
22
|
expect(@othermod.send(:metadata)['name']).to eq 'other-othermod'
|
|
23
23
|
end
|
|
24
24
|
end
|
|
25
|
-
|
|
26
|
-
describe '::CHANGELOG_ENTRY_REGEX' do
|
|
27
|
-
before :all do
|
|
28
|
-
@rgx = Simp::Rake::Pupmod::Helpers::CHANGELOG_ENTRY_REGEX
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
it 'matches valid one-line CHANGELOG entries' do
|
|
32
|
-
expect("* Mon Jan 1 1970 First Last <email@domain.com> - 0.0.1\n").to match @rgx
|
|
33
|
-
expect("* Mon Jan 1 1970 First Last <email@domain.com> 0.0.1\n").to match @rgx
|
|
34
|
-
expect("* Wed Oct 22 2014 First Middle Last <first.last-a1999@domain.com> - 2.0.0\n").to match @rgx
|
|
35
|
-
expect('* Wed Oct 22 2014 Name <first.last-a1999+gmail.label@domain.com> - 2.0.0').to match @rgx
|
|
36
|
-
expect('* Fri Jul 02 2010 Kamil Dudka <kdudka@redhat.com> 2.1.5-20').to match @rgx
|
|
37
|
-
expect('* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.1.5-21').to match @rgx
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
it "doesn't match invalid one-line CHANGELOG entries" do
|
|
41
|
-
expect("* Foo Jan 1 1970 First Last <email@domain.com> - 0.0.1\n").not_to match @rgx
|
|
42
|
-
expect("* Mon Xxn 1 1970 First Last <email@domain.com> - 0.0.1\n").not_to match @rgx
|
|
43
|
-
expect("* Mon Jan 111 1970 First Last <email@domain.com> - 0.0.1\n").not_to match @rgx
|
|
44
|
-
expect("* Mon Jan 1 1970 <email@domain.com> - 0.0.1\n").not_to match @rgx
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
it 'matches valid two-line CHANGELOG entries' do
|
|
48
|
-
skip 'Not worth implementing right now'
|
|
49
|
-
end
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
describe '#changelog_annotation' do
|
|
53
|
-
it "generates a tag annotation from a valid SIMP module's CHANGELOG" do
|
|
54
|
-
_log = @simpmod.send(:changelog_annotation)
|
|
55
|
-
expect(_log.class).to be String
|
|
56
|
-
expect(_log.size).to be > 0
|
|
57
|
-
expect(_log.scan(%r{^Release of}).size).to eq 1
|
|
58
|
-
end
|
|
59
|
-
|
|
60
|
-
it 'handles multiple CHANGELOG entries for the same release' do
|
|
61
|
-
_log = @simpmod.send(:changelog_annotation)
|
|
62
|
-
expect(_log.scan(%r{^\*.*\d+\.\d+\.\d+$})).to eq [
|
|
63
|
-
'* Tue Jan 2 1970 Second Author <email1@domain.com> - 0.1.0',
|
|
64
|
-
'* Mon Jan 1 1970 First Author <email2@domain.com> - 0.1.0',
|
|
65
|
-
]
|
|
66
|
-
end
|
|
67
|
-
end
|
|
68
25
|
end
|
|
@@ -22,7 +22,7 @@ describe 'Simp::RelChecks.compare_latest_tag' do
|
|
|
22
22
|
it 'reports no new tag required when no files have changed' do
|
|
23
23
|
expect(Simp::RelChecks).to receive(:`).with('git fetch -t origin 2>/dev/null').and_return("\n")
|
|
24
24
|
expect(Simp::RelChecks).to receive(:`).with('git tag -l').and_return("1.0.0-pre\n1.0.0\n1.1.0\n")
|
|
25
|
-
expect(Simp::RelChecks).to receive(:`).with('git diff tags/1.1.0 --name-only').and_return(
|
|
25
|
+
expect(Simp::RelChecks).to receive(:`).with('git diff -z tags/1.1.0 --name-only --no-renames').and_return('')
|
|
26
26
|
|
|
27
27
|
msg = " No new tag required: No significant files have changed since '1.1.0' tag\n"
|
|
28
28
|
expect { Simp::RelChecks.compare_latest_tag(component_dir) }
|
|
@@ -32,8 +32,9 @@ describe 'Simp::RelChecks.compare_latest_tag' do
|
|
|
32
32
|
it 'reports no new tag required when no significant files have changed' do
|
|
33
33
|
expect(Simp::RelChecks).to receive(:`).with('git fetch -t origin 2>/dev/null').and_return("\n")
|
|
34
34
|
expect(Simp::RelChecks).to receive(:`).with('git tag -l').and_return("1.0.0\nv1.0.1\n1.1.0\n")
|
|
35
|
-
expect(Simp::RelChecks).to receive(:`).with('git diff tags/1.1.0 --name-only').and_return(
|
|
36
|
-
".travis.yml\
|
|
35
|
+
expect(Simp::RelChecks).to receive(:`).with('git diff -z tags/1.1.0 --name-only --no-renames').and_return(
|
|
36
|
+
".travis.yml\0Rakefile\0AGENTS.md\0Gemfile.lock\0spec/some_spec.rb\0doc/index.html\0rakelib/mytasks.rake\0renovate.json\0" \
|
|
37
|
+
".github/workflows/pr_tests.yml\0examples/init.pp\0",
|
|
37
38
|
)
|
|
38
39
|
|
|
39
40
|
msg = " No new tag required: No significant files have changed since '1.1.0' tag\n"
|
|
@@ -44,15 +45,15 @@ describe 'Simp::RelChecks.compare_latest_tag' do
|
|
|
44
45
|
it 'reports a new tag is required for significant changes with bumped version' do
|
|
45
46
|
expect(Simp::RelChecks).to receive(:`).with('git fetch -t origin 2>/dev/null').and_return("\n")
|
|
46
47
|
expect(Simp::RelChecks).to receive(:`).with('git tag -l').and_return("1.0.0\n1.1.0-RC01\n")
|
|
47
|
-
expect(Simp::RelChecks).to receive(:`).with('git diff tags/1.0.0 --name-only').and_return(
|
|
48
|
-
"CHANGELOG\
|
|
48
|
+
expect(Simp::RelChecks).to receive(:`).with('git diff -z tags/1.0.0 --name-only --no-renames').and_return(
|
|
49
|
+
"CHANGELOG\0metadata.json\0manifests/init.pp\0",
|
|
49
50
|
)
|
|
50
51
|
|
|
51
52
|
msg = <<-EOM
|
|
52
53
|
NOTICE: New tag of version '1.1.0' is required for 3 changed files:
|
|
53
54
|
* CHANGELOG
|
|
54
55
|
* metadata.json
|
|
55
|
-
*
|
|
56
|
+
* manifests/init.pp
|
|
56
57
|
EOM
|
|
57
58
|
|
|
58
59
|
expect { Simp::RelChecks.compare_latest_tag(component_dir) }
|
|
@@ -64,8 +65,8 @@ NOTICE: New tag of version '1.1.0' is required for 3 changed files:
|
|
|
64
65
|
it 'fails when latest version < latest tag' do
|
|
65
66
|
expect(Simp::RelChecks).to receive(:`).with('git fetch -t origin 2>/dev/null').and_return("\n")
|
|
66
67
|
expect(Simp::RelChecks).to receive(:`).with('git tag -l').and_return("1.0.0\n1.2.0\n")
|
|
67
|
-
expect(Simp::RelChecks).to receive(:`).with('git diff tags/1.2.0 --name-only').and_return(
|
|
68
|
-
"CHANGELOG\
|
|
68
|
+
expect(Simp::RelChecks).to receive(:`).with('git diff -z tags/1.2.0 --name-only --no-renames').and_return(
|
|
69
|
+
"CHANGELOG\0metadata.json\0manifests/init.pp\0",
|
|
69
70
|
)
|
|
70
71
|
|
|
71
72
|
expect { Simp::RelChecks.compare_latest_tag(component_dir) }
|
|
@@ -75,8 +76,30 @@ NOTICE: New tag of version '1.1.0' is required for 3 changed files:
|
|
|
75
76
|
it 'fails when significant file changes need a version bump' do
|
|
76
77
|
expect(Simp::RelChecks).to receive(:`).with('git fetch -t origin 2>/dev/null').and_return("\n")
|
|
77
78
|
expect(Simp::RelChecks).to receive(:`).with('git tag -l').and_return("1.0.0\n1.1.0\n")
|
|
78
|
-
expect(Simp::RelChecks).to receive(:`).with('git diff tags/1.1.0 --name-only').and_return(
|
|
79
|
-
"
|
|
79
|
+
expect(Simp::RelChecks).to receive(:`).with('git diff -z tags/1.1.0 --name-only --no-renames').and_return(
|
|
80
|
+
"manifests/init.pp\0",
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
expect { Simp::RelChecks.compare_latest_tag(component_dir) }
|
|
84
|
+
.to raise_error(%r{ERROR: Version update beyond last tag '1.1.0' is required for 1 changed files:})
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
it 'fails when shipped documentation changes need a version bump' do
|
|
88
|
+
expect(Simp::RelChecks).to receive(:`).with('git fetch -t origin 2>/dev/null').and_return("\n")
|
|
89
|
+
expect(Simp::RelChecks).to receive(:`).with('git tag -l').and_return("1.0.0\n1.1.0\n")
|
|
90
|
+
expect(Simp::RelChecks).to receive(:`).with('git diff -z tags/1.1.0 --name-only --no-renames').and_return(
|
|
91
|
+
"README.md\0REFERENCE.md\0AGENTS.md\0",
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
expect { Simp::RelChecks.compare_latest_tag(component_dir) }
|
|
95
|
+
.to raise_error(%r{ERROR: Version update beyond last tag '1.1.0' is required for 2 changed files:})
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
it 'fails when a significant path has characters git would quote' do
|
|
99
|
+
expect(Simp::RelChecks).to receive(:`).with('git fetch -t origin 2>/dev/null').and_return("\n")
|
|
100
|
+
expect(Simp::RelChecks).to receive(:`).with('git tag -l').and_return("1.0.0\n1.1.0\n")
|
|
101
|
+
expect(Simp::RelChecks).to receive(:`).with('git diff -z tags/1.1.0 --name-only --no-renames').and_return(
|
|
102
|
+
"templates/caf\u00e9.epp\0",
|
|
80
103
|
)
|
|
81
104
|
|
|
82
105
|
expect { Simp::RelChecks.compare_latest_tag(component_dir) }
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'simp/relchecks'
|
|
4
|
+
require 'spec_helper'
|
|
5
|
+
|
|
6
|
+
describe 'Simp::RelChecks.significant_file?' do
|
|
7
|
+
context 'with a Puppet module' do
|
|
8
|
+
[
|
|
9
|
+
'CHANGELOG', 'LICENSE', 'README.md', 'REFERENCE.md', 'metadata.json', 'hiera.yaml', 'bolt_plugin.json',
|
|
10
|
+
'SIMP/compliance_profiles/checks.yaml', 'build/rpm_metadata/requires', 'data/common.yaml',
|
|
11
|
+
'facts.d/x.sh', 'files/x.conf', 'functions/x.pp', 'lib/facter/x.rb', 'locales/config.yaml',
|
|
12
|
+
'manifests/init.pp', 'manifests/README.md', 'plans/x.pp', 'tasks/x.json', 'templates/x.epp', 'types/x.pp'
|
|
13
|
+
].each do |file|
|
|
14
|
+
it "considers #{file} significant" do
|
|
15
|
+
expect(Simp::RelChecks.significant_file?(file, :module)).to be true
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
[
|
|
20
|
+
'AGENTS.md', 'CLAUDE.md', 'Gemfile', 'Gemfile.project', 'Rakefile',
|
|
21
|
+
'renovate.json', '.github/workflows/pr_tests.yml', '.fixtures.yml', 'spec/classes/init_spec.rb',
|
|
22
|
+
'examples/init.pp', 'doc/index.html', 'rakelib/x.rake', 'metadata.json.bak', 'manifest/init.pp'
|
|
23
|
+
].each do |file|
|
|
24
|
+
it "does not consider #{file} significant" do
|
|
25
|
+
expect(Simp::RelChecks.significant_file?(file, :module)).to be false
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
context 'with a non-module component' do
|
|
31
|
+
['build/simp.spec', 'src/x.sh', 'examples/x.conf', 'LICENSE'].each do |file|
|
|
32
|
+
it "considers #{file} significant" do
|
|
33
|
+
expect(Simp::RelChecks.significant_file?(file, :asset)).to be true
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
[
|
|
38
|
+
'.github/workflows/pr_tests.yml', 'Gemfile', 'Gemfile.lock', 'Rakefile', 'README.md',
|
|
39
|
+
'docs/x.md', 'spec/x_spec.rb', 'doc/index.html', 'rakelib/x.rake', 'renovate.json'
|
|
40
|
+
].each do |file|
|
|
41
|
+
it "does not consider #{file} significant" do
|
|
42
|
+
expect(Simp::RelChecks.significant_file?(file, :asset)).to be false
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: simp-rake-helpers
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 7.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Chris Tessmer
|
|
8
8
|
- Trevor Vaughan
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-10-07 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: simp-beaker-helpers
|
|
@@ -84,6 +84,26 @@ dependencies:
|
|
|
84
84
|
- - "<"
|
|
85
85
|
- !ruby/object:Gem::Version
|
|
86
86
|
version: '10.0'
|
|
87
|
+
- !ruby/object:Gem::Dependency
|
|
88
|
+
name: json
|
|
89
|
+
requirement: !ruby/object:Gem::Requirement
|
|
90
|
+
requirements:
|
|
91
|
+
- - ">="
|
|
92
|
+
- !ruby/object:Gem::Version
|
|
93
|
+
version: '2.3'
|
|
94
|
+
- - "<"
|
|
95
|
+
- !ruby/object:Gem::Version
|
|
96
|
+
version: '3'
|
|
97
|
+
type: :runtime
|
|
98
|
+
prerelease: false
|
|
99
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
100
|
+
requirements:
|
|
101
|
+
- - ">="
|
|
102
|
+
- !ruby/object:Gem::Version
|
|
103
|
+
version: '2.3'
|
|
104
|
+
- - "<"
|
|
105
|
+
- !ruby/object:Gem::Version
|
|
106
|
+
version: '3'
|
|
87
107
|
- !ruby/object:Gem::Dependency
|
|
88
108
|
name: puppet-modulebuilder
|
|
89
109
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -173,7 +193,7 @@ dependencies:
|
|
|
173
193
|
version: '14.0'
|
|
174
194
|
- - "<"
|
|
175
195
|
- !ruby/object:Gem::Version
|
|
176
|
-
version: '
|
|
196
|
+
version: '16.0'
|
|
177
197
|
type: :runtime
|
|
178
198
|
prerelease: false
|
|
179
199
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -183,7 +203,7 @@ dependencies:
|
|
|
183
203
|
version: '14.0'
|
|
184
204
|
- - "<"
|
|
185
205
|
- !ruby/object:Gem::Version
|
|
186
|
-
version: '
|
|
206
|
+
version: '16.0'
|
|
187
207
|
- !ruby/object:Gem::Dependency
|
|
188
208
|
name: metadata-json-lint
|
|
189
209
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -623,6 +643,7 @@ files:
|
|
|
623
643
|
- spec/lib/simp/relchecks_check_rpm_changelog_spec.rb
|
|
624
644
|
- spec/lib/simp/relchecks_compare_latest_tag_spec.rb
|
|
625
645
|
- spec/lib/simp/relchecks_create_tag_changelog_spec.rb
|
|
646
|
+
- spec/lib/simp/relchecks_significant_file_spec.rb
|
|
626
647
|
- spec/lib/simp/rpm_signer_spec.rb
|
|
627
648
|
- spec/lib/simp/rpm_spec.rb
|
|
628
649
|
- spec/spec_helper.rb
|