puppetlabs-onceover-octocatalog-diff 0.1.10
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 +7 -0
- data/.devcontainer/devcontainer.json +10 -0
- data/.gitattributes +2 -0
- data/.github/dependabot.yml +17 -0
- data/.github/labeler.yml +3 -0
- data/.github/release.yml +40 -0
- data/.github/workflows/ci.yaml +94 -0
- data/.github/workflows/labeler.yaml +15 -0
- data/.github/workflows/mend.yml +14 -0
- data/.github/workflows/nightly.yml +62 -0
- data/.github/workflows/release.yaml +16 -0
- data/.github/workflows/release_prep.yml +20 -0
- data/.gitignore +11 -0
- data/.rubocop.yml +19 -0
- data/.rubocop_todo.yml +197 -0
- data/CHANGELOG.md +61 -0
- data/CODEOWNERS +1 -0
- data/Gemfile +52 -0
- data/LICENSE +21 -0
- data/README.md +36 -0
- data/Rakefile +26 -0
- data/bin/console +15 -0
- data/bin/setup +8 -0
- data/lib/puppetlabs-onceover/octocatalog-diff/cli.rb +163 -0
- data/lib/puppetlabs-onceover/octocatalog-diff/version.rb +9 -0
- data/lib/puppetlabs-onceover/octocatalog-diff.rb +11 -0
- data/puppetlabs-onceover-octocatalog-diff.gemspec +27 -0
- data/templates/change_manifest.rb.erb +22 -0
- metadata +99 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: a6b486e1e67a13d86e5747089b2f9c1693f324554cdf19b3071df3dda8a94eac
|
|
4
|
+
data.tar.gz: 81a700174f35d810220f532a7c012af36ee8cf7e3034419567a160161182967a
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 43dc0769e5c960b7032ff0d777c7ca4cbae024a4b2226fde7fcea4bbc636a4be5054e0c5d55b80a6d2cdff102ae774fe299ef3f48f8b8af2e5ba149e3483aa8b
|
|
7
|
+
data.tar.gz: 75c5171c3db77aeffe7b92d11c84ddedaef68d65dfc5dc2f7c3d8741cb835b44da36e27144382d8297052d73ee6d1bd207e4086db6546416a457f88ade5f2d1e
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
|
|
2
|
+
// README at: https://github.com/devcontainers/templates/tree/main/src/debian
|
|
3
|
+
{
|
|
4
|
+
"name": "Debian",
|
|
5
|
+
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
|
|
6
|
+
"image": "mcr.microsoft.com/devcontainers/ruby:3.2",
|
|
7
|
+
"features": {
|
|
8
|
+
"ghcr.io/devcontainers/features/github-cli:1": {}
|
|
9
|
+
}
|
|
10
|
+
}
|
data/.gitattributes
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
version: 2
|
|
2
|
+
updates:
|
|
3
|
+
# raise PRs for gem updates
|
|
4
|
+
- package-ecosystem: bundler
|
|
5
|
+
directory: "/"
|
|
6
|
+
schedule:
|
|
7
|
+
interval: daily
|
|
8
|
+
time: "13:00"
|
|
9
|
+
open-pull-requests-limit: 10
|
|
10
|
+
|
|
11
|
+
# Maintain dependencies for GitHub Actions
|
|
12
|
+
- package-ecosystem: github-actions
|
|
13
|
+
directory: "/"
|
|
14
|
+
schedule:
|
|
15
|
+
interval: daily
|
|
16
|
+
time: "13:00"
|
|
17
|
+
open-pull-requests-limit: 10
|
data/.github/labeler.yml
ADDED
data/.github/release.yml
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
---
|
|
2
|
+
# https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes
|
|
3
|
+
|
|
4
|
+
changelog:
|
|
5
|
+
exclude:
|
|
6
|
+
labels:
|
|
7
|
+
- duplicate
|
|
8
|
+
- invalid
|
|
9
|
+
- modulesync
|
|
10
|
+
- question
|
|
11
|
+
- skip-changelog
|
|
12
|
+
- wont-fix
|
|
13
|
+
- wontfix
|
|
14
|
+
- github_actions
|
|
15
|
+
|
|
16
|
+
categories:
|
|
17
|
+
- title: Breaking Changes 🛠
|
|
18
|
+
labels:
|
|
19
|
+
- backwards-incompatible
|
|
20
|
+
|
|
21
|
+
- title: New Features 🎉
|
|
22
|
+
labels:
|
|
23
|
+
- enhancement
|
|
24
|
+
|
|
25
|
+
- title: Bug Fixes 🐛
|
|
26
|
+
labels:
|
|
27
|
+
- bug
|
|
28
|
+
|
|
29
|
+
- title: Documentation Updates 📚
|
|
30
|
+
labels:
|
|
31
|
+
- documentation
|
|
32
|
+
- docs
|
|
33
|
+
|
|
34
|
+
- title: Dependency Updates ⬆️
|
|
35
|
+
labels:
|
|
36
|
+
- dependencies
|
|
37
|
+
|
|
38
|
+
- title: Other Changes
|
|
39
|
+
labels:
|
|
40
|
+
- "*"
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "ci"
|
|
3
|
+
|
|
4
|
+
on:
|
|
5
|
+
push:
|
|
6
|
+
branches:
|
|
7
|
+
- "main"
|
|
8
|
+
pull_request:
|
|
9
|
+
branches:
|
|
10
|
+
- "main"
|
|
11
|
+
workflow_dispatch:
|
|
12
|
+
|
|
13
|
+
env:
|
|
14
|
+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
|
15
|
+
|
|
16
|
+
jobs:
|
|
17
|
+
spec:
|
|
18
|
+
strategy:
|
|
19
|
+
fail-fast: false
|
|
20
|
+
matrix:
|
|
21
|
+
ruby_version:
|
|
22
|
+
- "3.2"
|
|
23
|
+
- "4.0"
|
|
24
|
+
include:
|
|
25
|
+
- ruby_version: "3.2"
|
|
26
|
+
puppet_gem_version: "~> 8.0"
|
|
27
|
+
- ruby_version: "4.0"
|
|
28
|
+
puppet_gem_version: "~> 9.0"
|
|
29
|
+
runs_on:
|
|
30
|
+
- "ubuntu-latest"
|
|
31
|
+
- "macos-latest"
|
|
32
|
+
- "ubuntu-24.04-arm"
|
|
33
|
+
# NOTE: windows-latest is a separate, bespoke job below -- see
|
|
34
|
+
# spec-windows for why (matches puppetlabs-onceover's own ci.yml pattern).
|
|
35
|
+
name: "spec (${{ matrix.runs_on }} ruby ${{ matrix.ruby_version }} | puppet ${{ matrix.puppet_gem_version }})"
|
|
36
|
+
uses: "puppetlabs/cat-github-actions/.github/workflows/gem_ci.yml@main"
|
|
37
|
+
secrets: "inherit"
|
|
38
|
+
with:
|
|
39
|
+
rake_task: "spec"
|
|
40
|
+
ruby_version: ${{ matrix.ruby_version }}
|
|
41
|
+
puppet_gem_version: ${{ matrix.puppet_gem_version }}
|
|
42
|
+
runs_on: ${{ matrix.runs_on }}
|
|
43
|
+
|
|
44
|
+
spec-windows:
|
|
45
|
+
strategy:
|
|
46
|
+
fail-fast: false
|
|
47
|
+
matrix:
|
|
48
|
+
ruby_version:
|
|
49
|
+
- "3.2"
|
|
50
|
+
- "4.0"
|
|
51
|
+
include:
|
|
52
|
+
- ruby_version: "3.2"
|
|
53
|
+
puppet_gem_version: "~> 8.0"
|
|
54
|
+
- ruby_version: "4.0"
|
|
55
|
+
puppet_gem_version: "~> 9.0"
|
|
56
|
+
name: "spec (windows-latest ruby ${{ matrix.ruby_version }} | puppet ${{ matrix.puppet_gem_version }})"
|
|
57
|
+
runs-on: "windows-latest"
|
|
58
|
+
env:
|
|
59
|
+
PUPPET_GEM_VERSION: ${{ matrix.puppet_gem_version }}
|
|
60
|
+
PUPPET_FORGE_TOKEN: ${{ secrets.PUPPET_FORGE_TOKEN || secrets.PUPPET_FORGE_TOKEN_PUBLIC }}
|
|
61
|
+
BUNDLE_RUBYGEMS___PUPPETCORE__PUPPET__COM: "forge-key:${{ secrets.PUPPET_FORGE_TOKEN || secrets.PUPPET_FORGE_TOKEN_PUBLIC }}"
|
|
62
|
+
steps:
|
|
63
|
+
- uses: "actions/checkout@v4"
|
|
64
|
+
- uses: "ruby/setup-ruby@v1"
|
|
65
|
+
with:
|
|
66
|
+
ruby-version: ${{ matrix.ruby_version }}
|
|
67
|
+
bundler-cache: true
|
|
68
|
+
- name: "rubocop"
|
|
69
|
+
run: bundle exec rubocop --format github
|
|
70
|
+
- name: "spec"
|
|
71
|
+
run: bundle exec rake spec
|
|
72
|
+
|
|
73
|
+
build:
|
|
74
|
+
needs: "spec"
|
|
75
|
+
runs-on: "ubuntu-latest"
|
|
76
|
+
name: "Verify gem builds"
|
|
77
|
+
steps:
|
|
78
|
+
- uses: "actions/checkout@v4"
|
|
79
|
+
- uses: "ruby/setup-ruby@v1"
|
|
80
|
+
with:
|
|
81
|
+
ruby-version: "3.4"
|
|
82
|
+
bundler-cache: true
|
|
83
|
+
- name: "Verify gem builds"
|
|
84
|
+
run: "gem build --strict --verbose *.gemspec"
|
|
85
|
+
|
|
86
|
+
tests:
|
|
87
|
+
needs:
|
|
88
|
+
- "spec"
|
|
89
|
+
- "spec-windows"
|
|
90
|
+
- "build"
|
|
91
|
+
runs-on: "ubuntu-latest"
|
|
92
|
+
name: "Test suite"
|
|
93
|
+
steps:
|
|
94
|
+
- run: "echo Test suite completed"
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
name: "nightly"
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
schedule:
|
|
5
|
+
- cron: "0 0 * * *"
|
|
6
|
+
workflow_dispatch:
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
spec:
|
|
10
|
+
strategy:
|
|
11
|
+
fail-fast: false
|
|
12
|
+
matrix:
|
|
13
|
+
ruby_version:
|
|
14
|
+
- "3.2"
|
|
15
|
+
- "4.0"
|
|
16
|
+
include:
|
|
17
|
+
- ruby_version: "3.2"
|
|
18
|
+
puppet_gem_version: "~> 8.0"
|
|
19
|
+
- ruby_version: "4.0"
|
|
20
|
+
puppet_gem_version: "~> 9.0"
|
|
21
|
+
runs_on:
|
|
22
|
+
- "ubuntu-latest"
|
|
23
|
+
- "macos-latest"
|
|
24
|
+
- "ubuntu-24.04-arm"
|
|
25
|
+
# See ci.yaml's spec-windows job for the separate Windows lane.
|
|
26
|
+
name: "spec (${{ matrix.runs_on }} ruby ${{ matrix.ruby_version }} | puppet ${{ matrix.puppet_gem_version }})"
|
|
27
|
+
uses: "puppetlabs/cat-github-actions/.github/workflows/gem_ci.yml@main"
|
|
28
|
+
secrets: "inherit"
|
|
29
|
+
with:
|
|
30
|
+
rake_task: "spec"
|
|
31
|
+
ruby_version: ${{ matrix.ruby_version }}
|
|
32
|
+
puppet_gem_version: ${{ matrix.puppet_gem_version }}
|
|
33
|
+
runs_on: ${{ matrix.runs_on }}
|
|
34
|
+
|
|
35
|
+
spec-windows:
|
|
36
|
+
strategy:
|
|
37
|
+
fail-fast: false
|
|
38
|
+
matrix:
|
|
39
|
+
ruby_version:
|
|
40
|
+
- "3.2"
|
|
41
|
+
- "4.0"
|
|
42
|
+
include:
|
|
43
|
+
- ruby_version: "3.2"
|
|
44
|
+
puppet_gem_version: "~> 8.0"
|
|
45
|
+
- ruby_version: "4.0"
|
|
46
|
+
puppet_gem_version: "~> 9.0"
|
|
47
|
+
name: "spec (windows-latest ruby ${{ matrix.ruby_version }} | puppet ${{ matrix.puppet_gem_version }})"
|
|
48
|
+
runs-on: "windows-latest"
|
|
49
|
+
env:
|
|
50
|
+
PUPPET_GEM_VERSION: ${{ matrix.puppet_gem_version }}
|
|
51
|
+
PUPPET_FORGE_TOKEN: ${{ secrets.PUPPET_FORGE_TOKEN || secrets.PUPPET_FORGE_TOKEN_PUBLIC }}
|
|
52
|
+
BUNDLE_RUBYGEMS___PUPPETCORE__PUPPET__COM: "forge-key:${{ secrets.PUPPET_FORGE_TOKEN || secrets.PUPPET_FORGE_TOKEN_PUBLIC }}"
|
|
53
|
+
steps:
|
|
54
|
+
- uses: "actions/checkout@v4"
|
|
55
|
+
- uses: "ruby/setup-ruby@v1"
|
|
56
|
+
with:
|
|
57
|
+
ruby-version: ${{ matrix.ruby_version }}
|
|
58
|
+
bundler-cache: true
|
|
59
|
+
- name: "rubocop"
|
|
60
|
+
run: bundle exec rubocop --format github
|
|
61
|
+
- name: "spec"
|
|
62
|
+
run: bundle exec rake spec
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
name: "release"
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch:
|
|
5
|
+
inputs:
|
|
6
|
+
target:
|
|
7
|
+
description: "The target for the release. This can be a commit sha or a branch."
|
|
8
|
+
required: false
|
|
9
|
+
default: "main"
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
release:
|
|
13
|
+
uses: "puppetlabs/cat-github-actions/.github/workflows/gem_release.yml@main"
|
|
14
|
+
with:
|
|
15
|
+
target: "${{ github.event.inputs.target }}"
|
|
16
|
+
secrets: "inherit"
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
name: "release prep"
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch:
|
|
5
|
+
inputs:
|
|
6
|
+
target:
|
|
7
|
+
description: "The target for the release. This can be a commit sha or a branch."
|
|
8
|
+
required: false
|
|
9
|
+
default: "main"
|
|
10
|
+
version:
|
|
11
|
+
description: "Version of gem to be released."
|
|
12
|
+
required: true
|
|
13
|
+
|
|
14
|
+
jobs:
|
|
15
|
+
release_prep:
|
|
16
|
+
uses: "puppetlabs/cat-github-actions/.github/workflows/gem_release_prep.yml@main"
|
|
17
|
+
with:
|
|
18
|
+
target: "${{ github.event.inputs.target }}"
|
|
19
|
+
version: "${{ github.event.inputs.version }}"
|
|
20
|
+
secrets: "inherit"
|
data/.gitignore
ADDED
data/.rubocop.yml
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
---
|
|
2
|
+
inherit_from: .rubocop_todo.yml
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
AllCops:
|
|
6
|
+
NewCops: enable
|
|
7
|
+
DisplayCopNames: true
|
|
8
|
+
ExtraDetails: true
|
|
9
|
+
DisplayStyleGuide: true
|
|
10
|
+
TargetRubyVersion: 3.2
|
|
11
|
+
Exclude:
|
|
12
|
+
- vendor/**/*
|
|
13
|
+
- .vendor/**/*
|
|
14
|
+
|
|
15
|
+
# .gitattributes forces LF line endings everywhere, including Windows.
|
|
16
|
+
# The default EnforcedStyle is "native", which demands CRLF on Windows --
|
|
17
|
+
# that's incompatible with this repo's own LF-everywhere policy.
|
|
18
|
+
Layout/EndOfLine:
|
|
19
|
+
EnforcedStyle: lf
|
data/.rubocop_todo.yml
ADDED
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
# This configuration was generated by
|
|
2
|
+
# `rubocop --auto-gen-config`
|
|
3
|
+
# on 2026-09-14 19:16:07 UTC using RuboCop version 1.90.0.
|
|
4
|
+
# The point is for the user to remove these configuration records
|
|
5
|
+
# one by one as the offenses are removed from the code base.
|
|
6
|
+
# Note that changes in the inspected code, or installation of new
|
|
7
|
+
# versions of RuboCop, may require this file to be generated again.
|
|
8
|
+
|
|
9
|
+
# Offense count: 1
|
|
10
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
11
|
+
Layout/HeredocIndentation:
|
|
12
|
+
Exclude:
|
|
13
|
+
- 'lib/puppetlabs-onceover/octocatalog-diff/cli.rb'
|
|
14
|
+
|
|
15
|
+
# Offense count: 1
|
|
16
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
17
|
+
# Configuration parameters: AllowDoxygenCommentStyle, AllowGemfileRubyComment, AllowRBSInlineAnnotation, AllowSteepAnnotation, AllowYARDCommentBlockSeparator.
|
|
18
|
+
Layout/LeadingCommentSpace:
|
|
19
|
+
Exclude:
|
|
20
|
+
- 'lib/puppetlabs-onceover/octocatalog-diff/cli.rb'
|
|
21
|
+
|
|
22
|
+
# Offense count: 10
|
|
23
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
24
|
+
Layout/SpaceAfterComma:
|
|
25
|
+
Exclude:
|
|
26
|
+
- 'lib/puppetlabs-onceover/octocatalog-diff/cli.rb'
|
|
27
|
+
|
|
28
|
+
# Offense count: 1
|
|
29
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
30
|
+
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces, SpaceBeforeBlockParameters.
|
|
31
|
+
# SupportedStyles: space, no_space
|
|
32
|
+
# SupportedStylesForEmptyBraces: space, no_space
|
|
33
|
+
Layout/SpaceInsideBlockBraces:
|
|
34
|
+
Exclude:
|
|
35
|
+
- 'lib/puppetlabs-onceover/octocatalog-diff/cli.rb'
|
|
36
|
+
|
|
37
|
+
# Offense count: 2
|
|
38
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
39
|
+
Lint/ErbNewArguments:
|
|
40
|
+
Exclude:
|
|
41
|
+
- 'lib/puppetlabs-onceover/octocatalog-diff/cli.rb'
|
|
42
|
+
|
|
43
|
+
# Offense count: 2
|
|
44
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
45
|
+
# Configuration parameters: IgnoreEmptyBlocks, AllowUnusedKeywordArguments.
|
|
46
|
+
Lint/UnusedBlockArgument:
|
|
47
|
+
Exclude:
|
|
48
|
+
- 'lib/puppetlabs-onceover/octocatalog-diff/cli.rb'
|
|
49
|
+
|
|
50
|
+
# Offense count: 1
|
|
51
|
+
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
|
|
52
|
+
Metrics/AbcSize:
|
|
53
|
+
Max: 188
|
|
54
|
+
|
|
55
|
+
# Offense count: 4
|
|
56
|
+
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
|
|
57
|
+
# AllowedMethods: refine
|
|
58
|
+
# cli_spec.rb's outer `RSpec.describe` block is a narrow, deliberate addition
|
|
59
|
+
# (not machine-generated): it exercises every branch of cli.rb's single
|
|
60
|
+
# 163-line inline `run` block (all three octocatalog-diff exit codes, both
|
|
61
|
+
# r10k exit-status branches, and the module-cache hit/miss branch), which
|
|
62
|
+
# means many small `it` blocks living under one `describe`/`context` nest.
|
|
63
|
+
Metrics/BlockLength:
|
|
64
|
+
Max: 120
|
|
65
|
+
Exclude:
|
|
66
|
+
- 'spec/puppetlabs-onceover/octocatalog-diff/cli_spec.rb'
|
|
67
|
+
|
|
68
|
+
# Offense count: 1
|
|
69
|
+
# Configuration parameters: CountComments, CountAsOne.
|
|
70
|
+
Metrics/ClassLength:
|
|
71
|
+
Max: 124
|
|
72
|
+
|
|
73
|
+
# Offense count: 1
|
|
74
|
+
# Configuration parameters: AllowedMethods, AllowedPatterns.
|
|
75
|
+
Metrics/CyclomaticComplexity:
|
|
76
|
+
Max: 17
|
|
77
|
+
|
|
78
|
+
# Offense count: 1
|
|
79
|
+
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
|
|
80
|
+
Metrics/MethodLength:
|
|
81
|
+
Max: 122
|
|
82
|
+
|
|
83
|
+
# Offense count: 1
|
|
84
|
+
# Configuration parameters: AllowedMethods, AllowedPatterns.
|
|
85
|
+
Metrics/PerceivedComplexity:
|
|
86
|
+
Max: 17
|
|
87
|
+
|
|
88
|
+
# Offense count: 1
|
|
89
|
+
# Configuration parameters: ExpectMatchingDefinition, CheckDefinitionPathHierarchy, CheckDefinitionPathHierarchyRoots, Regex, IgnoreExecutableScripts, AllowedAcronyms.
|
|
90
|
+
# CheckDefinitionPathHierarchyRoots: lib, spec, test, src
|
|
91
|
+
# AllowedAcronyms: CLI, DSL, ACL, API, ASCII, CPU, CSS, DNS, EOF, GUID, HTML, HTTP, HTTPS, ID, IP, JSON, LHS, QPS, RAM, RHS, RPC, SLA, SMTP, SQL, SSH, TCP, TLS, TTL, UDP, UI, UID, UUID, URI, URL, UTF8, VM, XML, XMPP, XSRF, XSS
|
|
92
|
+
# 'lib/puppetlabs-onceover/octocatalog-diff.rb' is a permanent exclusion, not
|
|
93
|
+
# a todo: its filename must literally match puppetlabs-onceover's plugin
|
|
94
|
+
# loader require path (gem_name.sub('puppetlabs-onceover-', 'puppetlabs-onceover/')),
|
|
95
|
+
# so it can never be renamed to snake_case. 'Rakefile.rb' here is just
|
|
96
|
+
# rubocop's own normalized display name for the real 'Rakefile'.
|
|
97
|
+
# 'spec/puppetlabs-onceover/octocatalog-diff_spec.rb' is the same permanent
|
|
98
|
+
# exclusion, mirrored into spec/: rspec's own convention names a lib file's
|
|
99
|
+
# spec by appending '_spec' to its exact basename, so this file's name is
|
|
100
|
+
# forced to inherit the hyphen too.
|
|
101
|
+
Naming/FileName:
|
|
102
|
+
Exclude:
|
|
103
|
+
- 'Rakefile.rb'
|
|
104
|
+
- 'lib/puppetlabs-onceover/octocatalog-diff.rb'
|
|
105
|
+
- 'spec/puppetlabs-onceover/octocatalog-diff_spec.rb'
|
|
106
|
+
|
|
107
|
+
# Offense count: 1
|
|
108
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
109
|
+
# Configuration parameters: EnforcedStyleForLeadingUnderscores.
|
|
110
|
+
# SupportedStylesForLeadingUnderscores: disallowed, required, optional
|
|
111
|
+
Naming/MemoizedInstanceVariableName:
|
|
112
|
+
Exclude:
|
|
113
|
+
- 'lib/puppetlabs-onceover/octocatalog-diff/cli.rb'
|
|
114
|
+
|
|
115
|
+
# Offense count: 1
|
|
116
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
117
|
+
Security/JSONLoad:
|
|
118
|
+
Exclude:
|
|
119
|
+
- 'lib/puppetlabs-onceover/octocatalog-diff/cli.rb'
|
|
120
|
+
|
|
121
|
+
# Offense count: 2
|
|
122
|
+
# Configuration parameters: AllowedConstants.
|
|
123
|
+
Style/Documentation:
|
|
124
|
+
Exclude:
|
|
125
|
+
- 'spec/**/*'
|
|
126
|
+
- 'test/**/*'
|
|
127
|
+
- 'lib/puppetlabs-onceover/octocatalog-diff.rb'
|
|
128
|
+
- 'lib/puppetlabs-onceover/octocatalog-diff/cli.rb'
|
|
129
|
+
|
|
130
|
+
# Offense count: 1
|
|
131
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
132
|
+
Style/FileWrite:
|
|
133
|
+
Exclude:
|
|
134
|
+
- 'lib/puppetlabs-onceover/octocatalog-diff/cli.rb'
|
|
135
|
+
|
|
136
|
+
# Offense count: 2
|
|
137
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
138
|
+
Style/GlobalStdStream:
|
|
139
|
+
Exclude:
|
|
140
|
+
- 'lib/puppetlabs-onceover/octocatalog-diff/cli.rb'
|
|
141
|
+
|
|
142
|
+
# Offense count: 4
|
|
143
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
144
|
+
# Configuration parameters: EnforcedStyle, EnforcedShorthandSyntax, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols.
|
|
145
|
+
# SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys
|
|
146
|
+
# SupportedShorthandSyntax: always, never, either, consistent, either_consistent
|
|
147
|
+
Style/HashSyntax:
|
|
148
|
+
Exclude:
|
|
149
|
+
- 'Rakefile'
|
|
150
|
+
- 'lib/puppetlabs-onceover/octocatalog-diff/cli.rb'
|
|
151
|
+
|
|
152
|
+
# Offense count: 1
|
|
153
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
154
|
+
# Configuration parameters: EnforcedStyle, AllowedMethods, AllowedPatterns.
|
|
155
|
+
# SupportedStyles: predicate, comparison
|
|
156
|
+
Style/NumericPredicate:
|
|
157
|
+
Exclude:
|
|
158
|
+
- 'spec/**/*'
|
|
159
|
+
- 'lib/puppetlabs-onceover/octocatalog-diff/cli.rb'
|
|
160
|
+
|
|
161
|
+
# Offense count: 1
|
|
162
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
163
|
+
Style/StderrPuts:
|
|
164
|
+
Exclude:
|
|
165
|
+
- 'lib/puppetlabs-onceover/octocatalog-diff/cli.rb'
|
|
166
|
+
|
|
167
|
+
# Offense count: 12
|
|
168
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
169
|
+
# Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
|
|
170
|
+
# SupportedStyles: single_quotes, double_quotes
|
|
171
|
+
Style/StringLiterals:
|
|
172
|
+
Exclude:
|
|
173
|
+
- 'lib/puppetlabs-onceover/octocatalog-diff.rb'
|
|
174
|
+
- 'lib/puppetlabs-onceover/octocatalog-diff/cli.rb'
|
|
175
|
+
|
|
176
|
+
# Offense count: 10
|
|
177
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
178
|
+
# Configuration parameters: EnforcedStyle.
|
|
179
|
+
# SupportedStyles: single_quotes, double_quotes
|
|
180
|
+
Style/StringLiteralsInInterpolation:
|
|
181
|
+
Exclude:
|
|
182
|
+
- 'lib/puppetlabs-onceover/octocatalog-diff/cli.rb'
|
|
183
|
+
|
|
184
|
+
# Offense count: 1
|
|
185
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
186
|
+
# Configuration parameters: EnforcedStyleForMultiline.
|
|
187
|
+
# SupportedStylesForMultiline: comma, consistent_comma, diff_comma, no_comma
|
|
188
|
+
Style/TrailingCommaInHashLiteral:
|
|
189
|
+
Exclude:
|
|
190
|
+
- 'lib/puppetlabs-onceover/octocatalog-diff/cli.rb'
|
|
191
|
+
|
|
192
|
+
# Offense count: 3
|
|
193
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
194
|
+
# Configuration parameters: AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, AllowRBSInlineAnnotation, AllowCopDirectives, AllowedPatterns, SplitStrings.
|
|
195
|
+
# URISchemes: http, https
|
|
196
|
+
Layout/LineLength:
|
|
197
|
+
Max: 151
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
<!-- markdownlint-disable MD024 -->
|
|
2
|
+
# Changelog
|
|
3
|
+
|
|
4
|
+
All notable changes to this project will be documented in this file.
|
|
5
|
+
|
|
6
|
+
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).
|
|
7
|
+
|
|
8
|
+
## [v0.1.10](https://github.com/puppetlabs/puppetlabs-onceover-octocatalog-diff/tree/v0.1.10) - 2026-09-14
|
|
9
|
+
|
|
10
|
+
[Full Changelog](https://github.com/puppetlabs/puppetlabs-onceover-octocatalog-diff/compare/v0.1.9...v0.1.10)
|
|
11
|
+
|
|
12
|
+
### Other
|
|
13
|
+
|
|
14
|
+
- Add rspec unit tests and SimpleCov coverage (CAT-2842) [#8](https://github.com/puppetlabs/puppetlabs-onceover-octocatalog-diff/pull/8) ([actowery](https://github.com/actowery))
|
|
15
|
+
- Pin facter to Puppetcore source, matching puppet [#7](https://github.com/puppetlabs/puppetlabs-onceover-octocatalog-diff/pull/7) ([actowery](https://github.com/actowery))
|
|
16
|
+
- Regenerate .rubocop_todo.yml per CAT-2806's literal instruction [#6](https://github.com/puppetlabs/puppetlabs-onceover-octocatalog-diff/pull/6) ([actowery](https://github.com/actowery))
|
|
17
|
+
- Rename default branch to main, fix CI/version/devcontainer gaps missed on first pass (CAT-2800/2801/2805 follow-up) [#5](https://github.com/puppetlabs/puppetlabs-onceover-octocatalog-diff/pull/5) ([actowery](https://github.com/actowery))
|
|
18
|
+
- Remove transitive voxpupuli-test rake dependency from Rakefile [#4](https://github.com/puppetlabs/puppetlabs-onceover-octocatalog-diff/pull/4) ([actowery](https://github.com/actowery))
|
|
19
|
+
- Rename gem to puppetlabs-onceover-octocatalog-diff (CAT-2801/2802/2804) [#3](https://github.com/puppetlabs/puppetlabs-onceover-octocatalog-diff/pull/3) ([actowery](https://github.com/actowery))
|
|
20
|
+
- Add CODEOWNERS (CAT-2799) [#2](https://github.com/puppetlabs/puppetlabs-onceover-octocatalog-diff/pull/2) ([actowery](https://github.com/actowery))
|
|
21
|
+
- CAT-2800: Migrate release workflows to shared cat-github-actions, fix dead ownership guard [#1](https://github.com/puppetlabs/puppetlabs-onceover-octocatalog-diff/pull/1) ([actowery](https://github.com/actowery))
|
|
22
|
+
|
|
23
|
+
## [v0.1.9](https://github.com/puppetlabs/puppetlabs-onceover-octocatalog-diff/tree/v0.1.9) - 2022-05-19
|
|
24
|
+
|
|
25
|
+
[Full Changelog](https://github.com/puppetlabs/puppetlabs-onceover-octocatalog-diff/compare/v0.1.8...v0.1.9)
|
|
26
|
+
|
|
27
|
+
## [v0.1.8](https://github.com/puppetlabs/puppetlabs-onceover-octocatalog-diff/tree/v0.1.8) - 2021-05-25
|
|
28
|
+
|
|
29
|
+
[Full Changelog](https://github.com/puppetlabs/puppetlabs-onceover-octocatalog-diff/compare/v0.1.7...v0.1.8)
|
|
30
|
+
|
|
31
|
+
## [v0.1.7](https://github.com/puppetlabs/puppetlabs-onceover-octocatalog-diff/tree/v0.1.7) - 2017-03-22
|
|
32
|
+
|
|
33
|
+
[Full Changelog](https://github.com/puppetlabs/puppetlabs-onceover-octocatalog-diff/compare/v0.1.6...v0.1.7)
|
|
34
|
+
|
|
35
|
+
## [v0.1.6](https://github.com/puppetlabs/puppetlabs-onceover-octocatalog-diff/tree/v0.1.6) - 2017-03-20
|
|
36
|
+
|
|
37
|
+
[Full Changelog](https://github.com/puppetlabs/puppetlabs-onceover-octocatalog-diff/compare/v0.1.5...v0.1.6)
|
|
38
|
+
|
|
39
|
+
## [v0.1.5](https://github.com/puppetlabs/puppetlabs-onceover-octocatalog-diff/tree/v0.1.5) - 2017-03-15
|
|
40
|
+
|
|
41
|
+
[Full Changelog](https://github.com/puppetlabs/puppetlabs-onceover-octocatalog-diff/compare/v0.1.4...v0.1.5)
|
|
42
|
+
|
|
43
|
+
## [v0.1.4](https://github.com/puppetlabs/puppetlabs-onceover-octocatalog-diff/tree/v0.1.4) - 2017-03-14
|
|
44
|
+
|
|
45
|
+
[Full Changelog](https://github.com/puppetlabs/puppetlabs-onceover-octocatalog-diff/compare/v0.1.3...v0.1.4)
|
|
46
|
+
|
|
47
|
+
## [v0.1.3](https://github.com/puppetlabs/puppetlabs-onceover-octocatalog-diff/tree/v0.1.3) - 2017-03-13
|
|
48
|
+
|
|
49
|
+
[Full Changelog](https://github.com/puppetlabs/puppetlabs-onceover-octocatalog-diff/compare/v0.1.2...v0.1.3)
|
|
50
|
+
|
|
51
|
+
## [v0.1.2](https://github.com/puppetlabs/puppetlabs-onceover-octocatalog-diff/tree/v0.1.2) - 2017-03-13
|
|
52
|
+
|
|
53
|
+
[Full Changelog](https://github.com/puppetlabs/puppetlabs-onceover-octocatalog-diff/compare/v0.1.1...v0.1.2)
|
|
54
|
+
|
|
55
|
+
## [v0.1.1](https://github.com/puppetlabs/puppetlabs-onceover-octocatalog-diff/tree/v0.1.1) - 2017-03-13
|
|
56
|
+
|
|
57
|
+
[Full Changelog](https://github.com/puppetlabs/puppetlabs-onceover-octocatalog-diff/compare/v0.1.0...v0.1.1)
|
|
58
|
+
|
|
59
|
+
## [v0.1.0](https://github.com/puppetlabs/puppetlabs-onceover-octocatalog-diff/tree/v0.1.0) - 2017-03-13
|
|
60
|
+
|
|
61
|
+
[Full Changelog](https://github.com/puppetlabs/puppetlabs-onceover-octocatalog-diff/compare/1e6e0aea6f2fd28209c9c647fba768e139373a3b...v0.1.0)
|
data/CODEOWNERS
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
* @puppetlabs/devx
|
data/Gemfile
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# For puppetcore, set GEM_SOURCE_PUPPETCORE = 'https://rubygems-puppetcore.puppet.com'
|
|
4
|
+
gemsource_default = ENV['GEM_SOURCE'] || 'https://rubygems.org'
|
|
5
|
+
gemsource_puppetcore = if ENV['GEM_SOURCE']
|
|
6
|
+
gemsource_default
|
|
7
|
+
elsif ENV['PUPPET_FORGE_TOKEN'] && !ENV['PUPPET_FORGE_TOKEN'].empty?
|
|
8
|
+
'https://rubygems-puppetcore.puppet.com'
|
|
9
|
+
else
|
|
10
|
+
ENV['GEM_SOURCE_PUPPETCORE'] || gemsource_default
|
|
11
|
+
end
|
|
12
|
+
source gemsource_default
|
|
13
|
+
|
|
14
|
+
# Specify your gem's dependencies in puppetlabs-onceover-octocatalog-diff.gemspec
|
|
15
|
+
gemspec
|
|
16
|
+
|
|
17
|
+
# Route through gemsource_puppetcore so CI can resolve puppet ~> 9.0 from the
|
|
18
|
+
# private Puppetcore registry (public rubygems.org tops out at puppet 8.10.0).
|
|
19
|
+
# When PUPPET_FORGE_TOKEN is unset (e.g. fork PRs, local dev without a token),
|
|
20
|
+
# gemsource_puppetcore falls through to gemsource_default (public rubygems.org)
|
|
21
|
+
# and no auth is attempted against Puppetcore.
|
|
22
|
+
gem 'puppet', ENV['PUPPET_GEM_VERSION'] || '~> 8', source: gemsource_puppetcore
|
|
23
|
+
|
|
24
|
+
# facter is a runtime dependency of puppet, but pinning `puppet`'s own source
|
|
25
|
+
# does NOT pin its transitive dependencies to that same source -- bundler
|
|
26
|
+
# still resolves facter from whichever source(s) declare it, so without this
|
|
27
|
+
# explicit pin facter would silently keep resolving from public rubygems.org
|
|
28
|
+
# (built from the public facter repo) even when puppet itself correctly comes
|
|
29
|
+
# from Puppetcore (built from the private facter-private source). Pin it
|
|
30
|
+
# explicitly so both come from the same place.
|
|
31
|
+
gem 'facter', source: gemsource_puppetcore
|
|
32
|
+
|
|
33
|
+
# Puppet on Ruby 3.3 / 3.4 has some missing dependencies
|
|
34
|
+
gem 'syslog', '~> 0.3' if RUBY_VERSION >= '3.4'
|
|
35
|
+
|
|
36
|
+
# Windows platform runtime deps. The published puppet/openvox rubygems.org
|
|
37
|
+
# artefacts are built on Linux and guard `ffi` / `win32ole` with build-host
|
|
38
|
+
# platform checks, so those deps never make it into the Linux-published
|
|
39
|
+
# artefact. Ruby 3.4+ removed win32ole from default gems, making the missing
|
|
40
|
+
# declaration fatal at require-time on Windows. Declaring them here in the
|
|
41
|
+
# Gemfile is evaluated on the install host at bundle time, so bundler pulls
|
|
42
|
+
# them on Windows only.
|
|
43
|
+
platforms :mingw, :x64_mingw, :mswin do
|
|
44
|
+
gem 'ffi', '>= 1.15.5', '< 1.17.0', '!= 1.16.0', '!= 1.16.1', '!= 1.16.2'
|
|
45
|
+
gem 'win32ole', '>= 1.8', '< 2.0'
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
group :development do
|
|
49
|
+
gem 'rake', '~> 13.3'
|
|
50
|
+
gem 'rubocop'
|
|
51
|
+
gem 'simplecov'
|
|
52
|
+
end
|
data/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2017 Dylan Ratcliffe
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Octocatalog-diff Onceover plugin
|
|
2
|
+
|
|
3
|
+
This plugin adds the `run diff` command to [puppetlabs-onceover](https://github.com/puppetlabs/puppetlabs-onceover). Instead of testing that all if your catalogs compile, it compiles two versions of each catalog and returns you the differences. This is great for ensuring that changed that you were intending to make have had the desired effect and scope.
|
|
4
|
+
|
|
5
|
+
Kudos to Kevin and the team at GitHub for actually building [octocatalog-diff](https://github.com/github/octocatalog-diff)!
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
Add this line to your application's Gemfile:
|
|
10
|
+
|
|
11
|
+
```ruby
|
|
12
|
+
gem 'puppetlabs-onceover-octocatalog-diff'
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
And then execute:
|
|
16
|
+
|
|
17
|
+
$ bundle
|
|
18
|
+
|
|
19
|
+
Or install it yourself as:
|
|
20
|
+
|
|
21
|
+
$ gem install puppetlabs-onceover-octocatalog-diff
|
|
22
|
+
|
|
23
|
+
## Usage
|
|
24
|
+
|
|
25
|
+
`puppetlabs-onceover run diff --from development --to production`
|
|
26
|
+
|
|
27
|
+
All config follows the normal [onceover](https://github.com/puppetlabs/puppetlabs-onceover) configuration.
|
|
28
|
+
|
|
29
|
+
## Contributing
|
|
30
|
+
|
|
31
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/puppetlabs/puppetlabs-onceover-octocatalog-diff.
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
## License
|
|
35
|
+
|
|
36
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'bundler/gem_tasks'
|
|
4
|
+
require 'rspec/core/rake_task'
|
|
5
|
+
require 'rubocop/rake_task'
|
|
6
|
+
|
|
7
|
+
RSpec::Core::RakeTask.new(:spec)
|
|
8
|
+
RuboCop::RakeTask.new(:rubocop)
|
|
9
|
+
|
|
10
|
+
task :default => :spec
|
|
11
|
+
task :test => %i[rubocop spec]
|
|
12
|
+
|
|
13
|
+
begin
|
|
14
|
+
require 'rubygems'
|
|
15
|
+
require 'github_changelog_generator/task'
|
|
16
|
+
rescue LoadError
|
|
17
|
+
# Do nothing if no required gem installed
|
|
18
|
+
else
|
|
19
|
+
GitHubChangelogGenerator::RakeTask.new :changelog do |config|
|
|
20
|
+
config.exclude_labels = %w[duplicate question invalid wontfix wont-fix skip-changelog github_actions]
|
|
21
|
+
config.user = 'puppetlabs'
|
|
22
|
+
config.project = 'puppetlabs-onceover-octocatalog-diff'
|
|
23
|
+
gem_version = Gem::Specification.load("#{config.project}.gemspec").version
|
|
24
|
+
config.future_release = "v#{gem_version}"
|
|
25
|
+
end
|
|
26
|
+
end
|
data/bin/console
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
require 'bundler/setup'
|
|
5
|
+
require 'puppetlabs-onceover/octocatalog-diff'
|
|
6
|
+
|
|
7
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
|
8
|
+
# with your gem easier. You can also use a different console, if you like.
|
|
9
|
+
|
|
10
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
|
11
|
+
# require "pry"
|
|
12
|
+
# Pry.start
|
|
13
|
+
|
|
14
|
+
require 'irb'
|
|
15
|
+
IRB.start
|
data/bin/setup
ADDED
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
class PuppetlabsOnceover
|
|
4
|
+
class CLI
|
|
5
|
+
class Run
|
|
6
|
+
class Diff
|
|
7
|
+
def self.command
|
|
8
|
+
@cmd ||= Cri::Command.define do
|
|
9
|
+
name 'diff'
|
|
10
|
+
usage 'diff'
|
|
11
|
+
summary "Diff two versions of the controlrepo's compiled catalogs"
|
|
12
|
+
description <<-DESCRIPTION
|
|
13
|
+
This uses octocatalog-diff to run diffs on all things in the test matrix
|
|
14
|
+
instead of actually testing them. Requires two branches, tags or
|
|
15
|
+
revisions to compare between.
|
|
16
|
+
DESCRIPTION
|
|
17
|
+
|
|
18
|
+
option :f, :from, 'branch to compare from', argument: :required
|
|
19
|
+
option :t, :to, 'branch to compare to', argument: :required
|
|
20
|
+
|
|
21
|
+
run do |opts, args, cmd|
|
|
22
|
+
require 'facter'
|
|
23
|
+
require 'colored'
|
|
24
|
+
|
|
25
|
+
#TODO: Allow for custom arguments
|
|
26
|
+
repo = PuppetlabsOnceover::Controlrepo.new(opts)
|
|
27
|
+
test_config = PuppetlabsOnceover::TestConfig.new(repo.onceover_yaml, opts)
|
|
28
|
+
num_threads = (Facter.value('processors')['count'] / 2)
|
|
29
|
+
tests = test_config.run_filters(PuppetlabsOnceover::Test.deduplicate(test_config.spec_tests))
|
|
30
|
+
|
|
31
|
+
@queue = tests.inject(Queue.new, :push)
|
|
32
|
+
@results = []
|
|
33
|
+
|
|
34
|
+
@threads = Array.new(num_threads) do
|
|
35
|
+
Thread.new do
|
|
36
|
+
r10k_cache_dir = Dir.mktmpdir('r10k_cache')
|
|
37
|
+
r10k_config = {
|
|
38
|
+
'cachedir' => r10k_cache_dir,
|
|
39
|
+
}
|
|
40
|
+
logger.debug "Creating r10k cache for thread at #{r10k_cache_dir}"
|
|
41
|
+
File.write("#{r10k_cache_dir}/r10k.yaml",r10k_config.to_yaml)
|
|
42
|
+
|
|
43
|
+
until @queue.empty?
|
|
44
|
+
test = @queue.shift
|
|
45
|
+
|
|
46
|
+
logger.info "Preparing environment for #{test.classes[0].name} on #{test.nodes[0].name}"
|
|
47
|
+
logger.debug "Creating temp directory"
|
|
48
|
+
tempdir = Dir.mktmpdir(test.to_s)
|
|
49
|
+
logger.debug "Temp directory created at #{tempdir}"
|
|
50
|
+
|
|
51
|
+
logger.debug "Copying controlrepo to #{tempdir}"
|
|
52
|
+
FileUtils.copy_entry(repo.root,tempdir)
|
|
53
|
+
|
|
54
|
+
# Copy all of the factsets over in reverse order so that
|
|
55
|
+
# local ones override vendored ones
|
|
56
|
+
logger.debug "Deploying vendored factsets"
|
|
57
|
+
deduped_factsets = repo.facts_files.reverse.to_h do |file|
|
|
58
|
+
[File.basename(file), file]
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
deduped_factsets.each_value do |path|
|
|
62
|
+
facts = JSON.load(File.read(path))
|
|
63
|
+
File.open("#{tempdir}/spec/factsets/#{File.basename(path,'.*')}.yaml", 'w') { |f| f.write facts.to_yaml }
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
if File.directory?("#{r10k_cache_dir}/modules")
|
|
67
|
+
logger.debug "Copying modules from thread cache to #{tempdir}"
|
|
68
|
+
FileUtils.copy_entry("#{r10k_cache_dir}/modules","#{tempdir}/modules")
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
logger.info "Deploying Puppetfile for #{test.classes[0].name} on #{test.nodes[0].name}"
|
|
72
|
+
r10k_cmd = "r10k puppetfile install --verbose --color --puppetfile #{repo.puppetfile} --config #{r10k_cache_dir}/r10k.yaml"
|
|
73
|
+
Open3.popen3(r10k_cmd, :chdir => tempdir) do |stdin, stdout, stderr, wait_thr|
|
|
74
|
+
exit_status = wait_thr.value
|
|
75
|
+
if exit_status.exitstatus != 0
|
|
76
|
+
STDOUT.puts stdout.read
|
|
77
|
+
STDERR.puts stderr.read
|
|
78
|
+
abort "R10k encountered an error, see the logs for details"
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
# TODO: Improve the way this works so that it doesn't blat site.pp
|
|
83
|
+
logger.debug "Creating before script that overwrites site.pp"
|
|
84
|
+
class_name = test.classes[0].name
|
|
85
|
+
template_dir = File.expand_path('../../../templates',File.dirname(__FILE__))
|
|
86
|
+
template = File.read(File.expand_path("./change_manifest.rb.erb",template_dir))
|
|
87
|
+
File.write("#{tempdir}/bootstrap_script.rb",ERB.new(template, trim_mode: '-').result(binding))
|
|
88
|
+
FileUtils.chmod("u=rwx","#{tempdir}/bootstrap_script.rb")
|
|
89
|
+
|
|
90
|
+
logger.debug "Getting Puppet binary"
|
|
91
|
+
binary = `which puppet`.chomp
|
|
92
|
+
|
|
93
|
+
logger.debug "Running Octocatalog diff"
|
|
94
|
+
logger.info "Compiling catalogs for #{test.classes[0].name} on #{test.nodes[0].name}"
|
|
95
|
+
|
|
96
|
+
command_prefix = ENV['BUNDLE_GEMFILE'] ? 'bundle exec ' : ''
|
|
97
|
+
bootstrap_env = "--bootstrap-environment GEM_HOME=#{ENV['GEM_HOME']}" if ENV['GEM_HOME']
|
|
98
|
+
|
|
99
|
+
command_args = [
|
|
100
|
+
'--fact-file',
|
|
101
|
+
"#{tempdir}/spec/factsets/#{test.nodes[0].name}.yaml",
|
|
102
|
+
'--from',
|
|
103
|
+
opts[:from],
|
|
104
|
+
'--to',
|
|
105
|
+
opts[:to],
|
|
106
|
+
'--basedir',
|
|
107
|
+
tempdir,
|
|
108
|
+
'--puppet-binary',
|
|
109
|
+
binary,
|
|
110
|
+
'--bootstrap-script',
|
|
111
|
+
"'#{tempdir}/bootstrap_script.rb'",
|
|
112
|
+
'--hiera-config',
|
|
113
|
+
repo.hiera_config_file,
|
|
114
|
+
'--pass-env-vars',
|
|
115
|
+
ENV.keys.keep_if {|k| k =~ /^RUBY|^BUNDLE/ }.join(','),
|
|
116
|
+
bootstrap_env
|
|
117
|
+
]
|
|
118
|
+
|
|
119
|
+
cmd = "#{command_prefix}octocatalog-diff #{command_args.join(' ')}"
|
|
120
|
+
logger.debug "Running: #{cmd}"
|
|
121
|
+
Open3.popen3(cmd) do |stdin, stdout, stderr, wait_thr|
|
|
122
|
+
exit_status = wait_thr.value
|
|
123
|
+
@results << {
|
|
124
|
+
stdout: stdout.read,
|
|
125
|
+
stderr: stderr.read,
|
|
126
|
+
exit_status: exit_status.exitstatus,
|
|
127
|
+
test: test
|
|
128
|
+
}
|
|
129
|
+
end
|
|
130
|
+
logger.info "Storing results for #{test.classes[0].name} on #{test.nodes[0].name}"
|
|
131
|
+
|
|
132
|
+
logger.debug "Backing up modules to thread cache #{tempdir}"
|
|
133
|
+
FileUtils.mv("#{tempdir}/modules","#{r10k_cache_dir}/modules",:force => true)
|
|
134
|
+
|
|
135
|
+
logger.debug "Removing temporary build cache"
|
|
136
|
+
FileUtils.rm_r(tempdir)
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
FileUtils.rm_r(r10k_cache_dir)
|
|
140
|
+
end
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
@threads.each(&:join)
|
|
144
|
+
@results.each do |result|
|
|
145
|
+
puts "#{"Test:".bold} #{result[:test].classes[0].name} on #{result[:test].nodes[0].name}"
|
|
146
|
+
puts "#{"Exit:".bold} #{result[:exit_status]}"
|
|
147
|
+
puts "#{"Status:".bold} #{"changes".yellow}" if result[:exit_status] == 2
|
|
148
|
+
puts "#{"Status:".bold} #{"no differences".green}" if result[:exit_status] == 0
|
|
149
|
+
puts "#{"Status:".bold} #{"failed".red}" if result[:exit_status] == 1
|
|
150
|
+
puts "#{"Results:".bold}\n#{result[:stdout]}\n" if result[:exit_status] == 2
|
|
151
|
+
puts "#{"Errors:".bold}\n#{result[:stderr]}\n" if result[:exit_status] == 1
|
|
152
|
+
puts ""
|
|
153
|
+
end
|
|
154
|
+
end
|
|
155
|
+
end
|
|
156
|
+
end
|
|
157
|
+
end
|
|
158
|
+
end
|
|
159
|
+
end
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
# Register itself
|
|
163
|
+
PuppetlabsOnceover::CLI::Run.command.add_command(PuppetlabsOnceover::CLI::Run::Diff.command)
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
lib = File.expand_path('lib', __dir__)
|
|
4
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
5
|
+
require 'puppetlabs-onceover/octocatalog-diff/version'
|
|
6
|
+
|
|
7
|
+
Gem::Specification.new do |spec| # rubocop:disable Gemspec/RequireMFA
|
|
8
|
+
spec.name = 'puppetlabs-onceover-octocatalog-diff'
|
|
9
|
+
spec.version = PuppetlabsOnceover::Octocatalog::Diff::VERSION
|
|
10
|
+
spec.authors = ['Puppet, Inc.']
|
|
11
|
+
spec.email = ['modules-team@puppet.com']
|
|
12
|
+
|
|
13
|
+
spec.summary = 'Adds octocatalog-diff functionality to onceover'
|
|
14
|
+
spec.description = "Allows Onceover users to use their existing factsets to check what affect given changes will have on a role's compiled catalog"
|
|
15
|
+
spec.homepage = 'https://github.com/puppetlabs/puppetlabs-onceover-octocatalog-diff'
|
|
16
|
+
spec.license = 'MIT'
|
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
|
18
|
+
|
|
19
|
+
spec.bindir = 'exe'
|
|
20
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
21
|
+
spec.require_paths = ['lib']
|
|
22
|
+
|
|
23
|
+
spec.required_ruby_version = Gem::Requirement.new('>= 3.2')
|
|
24
|
+
|
|
25
|
+
spec.add_dependency 'octocatalog-diff', '~> 2.3'
|
|
26
|
+
spec.add_dependency 'puppetlabs-onceover', '~> 5.0'
|
|
27
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require 'puppetlabs-onceover/controlrepo'
|
|
4
|
+
|
|
5
|
+
repo = PuppetlabsOnceover::Controlrepo.new()
|
|
6
|
+
tempdir = Dir.pwd
|
|
7
|
+
|
|
8
|
+
FileUtils.copy_entry("<%= tempdir %>/modules","#{tempdir}/modules")
|
|
9
|
+
system("r10k puppetfile install --verbose --color --puppetfile '<%= repo.puppetfile %>'")
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
if repo.config['manifest']
|
|
13
|
+
manifest_dir = "#{tempdir}/#{repo.config['manifest']}"
|
|
14
|
+
else
|
|
15
|
+
manifest_dir = "#{tempdir}/manifests"
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
FileUtils.rm_r(Dir["#{manifest_dir}/*"])
|
|
19
|
+
|
|
20
|
+
somefile = File.open("#{manifest_dir}/site.pp", "w")
|
|
21
|
+
somefile.puts "include <%= class_name %>"
|
|
22
|
+
somefile.close
|
metadata
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: puppetlabs-onceover-octocatalog-diff
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.10
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Puppet, Inc.
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: exe
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2026-09-15 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: octocatalog-diff
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - "~>"
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '2.3'
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - "~>"
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '2.3'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: puppetlabs-onceover
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - "~>"
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '5.0'
|
|
34
|
+
type: :runtime
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - "~>"
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '5.0'
|
|
41
|
+
description: Allows Onceover users to use their existing factsets to check what affect
|
|
42
|
+
given changes will have on a role's compiled catalog
|
|
43
|
+
email:
|
|
44
|
+
- modules-team@puppet.com
|
|
45
|
+
executables: []
|
|
46
|
+
extensions: []
|
|
47
|
+
extra_rdoc_files: []
|
|
48
|
+
files:
|
|
49
|
+
- ".devcontainer/devcontainer.json"
|
|
50
|
+
- ".gitattributes"
|
|
51
|
+
- ".github/dependabot.yml"
|
|
52
|
+
- ".github/labeler.yml"
|
|
53
|
+
- ".github/release.yml"
|
|
54
|
+
- ".github/workflows/ci.yaml"
|
|
55
|
+
- ".github/workflows/labeler.yaml"
|
|
56
|
+
- ".github/workflows/mend.yml"
|
|
57
|
+
- ".github/workflows/nightly.yml"
|
|
58
|
+
- ".github/workflows/release.yaml"
|
|
59
|
+
- ".github/workflows/release_prep.yml"
|
|
60
|
+
- ".gitignore"
|
|
61
|
+
- ".rubocop.yml"
|
|
62
|
+
- ".rubocop_todo.yml"
|
|
63
|
+
- CHANGELOG.md
|
|
64
|
+
- CODEOWNERS
|
|
65
|
+
- Gemfile
|
|
66
|
+
- LICENSE
|
|
67
|
+
- README.md
|
|
68
|
+
- Rakefile
|
|
69
|
+
- bin/console
|
|
70
|
+
- bin/setup
|
|
71
|
+
- lib/puppetlabs-onceover/octocatalog-diff.rb
|
|
72
|
+
- lib/puppetlabs-onceover/octocatalog-diff/cli.rb
|
|
73
|
+
- lib/puppetlabs-onceover/octocatalog-diff/version.rb
|
|
74
|
+
- puppetlabs-onceover-octocatalog-diff.gemspec
|
|
75
|
+
- templates/change_manifest.rb.erb
|
|
76
|
+
homepage: https://github.com/puppetlabs/puppetlabs-onceover-octocatalog-diff
|
|
77
|
+
licenses:
|
|
78
|
+
- MIT
|
|
79
|
+
metadata: {}
|
|
80
|
+
post_install_message:
|
|
81
|
+
rdoc_options: []
|
|
82
|
+
require_paths:
|
|
83
|
+
- lib
|
|
84
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
85
|
+
requirements:
|
|
86
|
+
- - ">="
|
|
87
|
+
- !ruby/object:Gem::Version
|
|
88
|
+
version: '3.2'
|
|
89
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
90
|
+
requirements:
|
|
91
|
+
- - ">="
|
|
92
|
+
- !ruby/object:Gem::Version
|
|
93
|
+
version: '0'
|
|
94
|
+
requirements: []
|
|
95
|
+
rubygems_version: 3.4.19
|
|
96
|
+
signing_key:
|
|
97
|
+
specification_version: 4
|
|
98
|
+
summary: Adds octocatalog-diff functionality to onceover
|
|
99
|
+
test_files: []
|