Skip to content

Commit 97c3ec8

Browse files
authored
Merge branch 'master' into patch-1
2 parents bb74ad8 + c37b929 commit 97c3ec8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+120
-120
lines changed

.github/dependabot.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for all configuration options:
4+
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5+
6+
version: 2
7+
updates:
8+
- package-ecosystem: "bundler" # See documentation for possible values
9+
directory: "/" # Location of package manifests
10+
schedule:
11+
interval: "weekly"

.github/workflows/main.yml

Lines changed: 11 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,6 @@
11
name: CI
22
on: [push, pull_request, workflow_dispatch]
33
jobs:
4-
puppet-3-8-7:
5-
env:
6-
PUPPET_VERSIONS: "3.8.7"
7-
PUPPET_VERSION: "3.8.7"
8-
RUBOCOP_TEST: false
9-
RSPEC_TEST: true
10-
runs-on: ubuntu-latest
11-
strategy:
12-
fail-fast: false
13-
matrix:
14-
ruby-version: ["2.0", "2.1"]
15-
steps:
16-
- name: Checkout code
17-
uses: actions/checkout@v1
18-
- name: Build container
19-
run: docker build . --file Dockerfile --tag octocatalog-diff:ruby${{matrix.ruby-version}} --build-arg RUBY_VERSION=${{matrix.ruby-version}}
20-
- name: Tests
21-
run: docker run -e PUPPET_VERSION -e PUPPET_VERSIONS -e RSPEC_TEST -e RUBOCOP_TEST -e ENFORCE_COVERAGE octocatalog-diff:ruby${{matrix.ruby-version}} /app/script/cibuild
22-
234
puppet-4-10-10:
245
env:
256
PUPPET_VERSIONS: "4.10.10"
@@ -30,31 +11,31 @@ jobs:
3011
strategy:
3112
fail-fast: false
3213
matrix:
33-
ruby-version: ["2.1", "2.2", "2.3"]
14+
ruby-version: ["2.6"]
3415
steps:
3516
- name: Checkout code
3617
uses: actions/checkout@v1
3718
- name: Build container
38-
run: docker build . --file Dockerfile --tag octocatalog-diff:ruby${{matrix.ruby-version}} --build-arg RUBY_VERSION=${{matrix.ruby-version}}
19+
run: docker build . --file Dockerfile --tag octocatalog-diff:ruby${{matrix.ruby-version}} --build-arg RUBY_VERSION=${{matrix.ruby-version}} --build-arg PUPPET_VERSION=${{env.PUPPET_VERSION}}
3920
- name: Tests
4021
run: docker run -e PUPPET_VERSION -e PUPPET_VERSIONS -e RSPEC_TEST -e RUBOCOP_TEST -e ENFORCE_COVERAGE octocatalog-diff:ruby${{matrix.ruby-version}} /app/script/cibuild
4122

42-
puppet-5-5-8:
23+
puppet-5-5-22:
4324
env:
44-
PUPPET_VERSIONS: "5.5.8"
45-
PUPPET_VERSION: "5.5.8"
25+
PUPPET_VERSIONS: "5.5.22"
26+
PUPPET_VERSION: "5.5.22"
4627
RUBOCOP_TEST: false
4728
RSPEC_TEST: true
4829
runs-on: ubuntu-latest
4930
strategy:
5031
fail-fast: false
5132
matrix:
52-
ruby-version: ["2.4", "2.5", "2.6"]
33+
ruby-version: ["2.6"]
5334
steps:
5435
- name: Checkout code
5536
uses: actions/checkout@v1
5637
- name: Build container
57-
run: docker build . --file Dockerfile --tag octocatalog-diff:ruby${{matrix.ruby-version}} --build-arg RUBY_VERSION=${{matrix.ruby-version}}-stretch
38+
run: docker build . --file Dockerfile --tag octocatalog-diff:ruby${{matrix.ruby-version}} --build-arg RUBY_VERSION=${{matrix.ruby-version}} --build-arg PUPPET_VERSION=${{env.PUPPET_VERSION}}
5839
- name: Tests
5940
run: docker run -e PUPPET_VERSION -e PUPPET_VERSIONS -e RSPEC_TEST -e RUBOCOP_TEST -e ENFORCE_COVERAGE octocatalog-diff:ruby${{matrix.ruby-version}} /app/script/cibuild
6041

@@ -68,20 +49,14 @@ jobs:
6849
strategy:
6950
fail-fast: false
7051
matrix:
71-
ruby-version: ["2.5", "2.6"]
52+
ruby-version: ["2.6"]
7253
steps:
7354
- name: Checkout code
7455
uses: actions/checkout@v1
7556
- name: Build container
76-
run: docker build . --file Dockerfile --tag octocatalog-diff:ruby${{matrix.ruby-version}} --build-arg RUBY_VERSION=${{matrix.ruby-version}}-stretch
57+
run: docker build . --file Dockerfile --tag octocatalog-diff:ruby${{matrix.ruby-version}} --build-arg RUBY_VERSION=${{matrix.ruby-version}} --build-arg PUPPET_VERSION=${{env.PUPPET_VERSION}}
7758
- name: Tests
7859
run: docker run -e PUPPET_VERSION -e PUPPET_VERSIONS -e RSPEC_TEST -e RUBOCOP_TEST -e ENFORCE_COVERAGE octocatalog-diff:ruby${{matrix.ruby-version}} /app/script/cibuild
79-
- name: Rubocop and Coverage
80-
run: docker run -e PUPPET_VERSION -e PUPPET_VERSIONS -e RSPEC_TEST -e RUBOCOP_TEST -e ENFORCE_COVERAGE octocatalog-diff:ruby${{matrix.ruby-version}} /app/script/cibuild
81-
if: matrix.ruby-version == '2.6'
82-
env:
83-
RUBOCOP_TEST: true
84-
ENFORCE_COVERAGE: true
8560

8661
puppet-7-3-0:
8762
env:
@@ -93,13 +68,11 @@ jobs:
9368
strategy:
9469
fail-fast: false
9570
matrix:
96-
# 2.7 and 3.0 fail at the moment
97-
# ruby-version: ["2.5", "2.6", "2.7", "3.0"]
98-
ruby-version: ["2.5", "2.6"]
71+
ruby-version: ["2.6"]
9972
steps:
10073
- name: Checkout code
10174
uses: actions/checkout@v1
10275
- name: Build container
103-
run: docker build . --file Dockerfile --tag octocatalog-diff:ruby${{matrix.ruby-version}} --build-arg RUBY_VERSION=${{matrix.ruby-version}}-buster
76+
run: docker build . --file Dockerfile --tag octocatalog-diff:ruby${{matrix.ruby-version}} --build-arg RUBY_VERSION=${{matrix.ruby-version}} --build-arg PUPPET_VERSION=${{env.PUPPET_VERSION}}
10477
- name: Tests
10578
run: docker run -e PUPPET_VERSION -e PUPPET_VERSIONS -e RSPEC_TEST -e RUBOCOP_TEST -e ENFORCE_COVERAGE octocatalog-diff:ruby${{matrix.ruby-version}} /app/script/cibuild

.github/workflows/release.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Release
2+
on:
3+
push:
4+
tags:
5+
- '*.*.*'
6+
workflow_dispatch:
7+
8+
jobs:
9+
build:
10+
name: Build and Release
11+
runs-on: ubuntu-latest
12+
permissions:
13+
packages: write
14+
contents: read
15+
steps:
16+
- uses: actions/checkout@v4
17+
- name: Set up Ruby
18+
uses: ruby/setup-ruby@v1
19+
with:
20+
ruby-version: '2.6'
21+
- run: bundle install
22+
23+
- name: Publish to GPR
24+
env:
25+
GEM_HOST_API_KEY: "Bearer ${{secrets.GITHUB_TOKEN}}"
26+
run: |
27+
mkdir -p $HOME/.gem
28+
touch $HOME/.gem/credentials
29+
chmod 0600 $HOME/.gem/credentials
30+
printf -- "---\n:github: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
31+
gem build *.gemspec
32+
if [ ${{ github.ref_type }} == "tag" ]; then
33+
gem push --verbose \
34+
--key github \
35+
--host https://rubygems.pkg.github.com/${{ github.repository_owner }} \
36+
*.gem
37+
fi
38+
- name: Upload gem as action artifact
39+
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce
40+
if: ${{ always() }}
41+
with:
42+
path: ./*.gem

.rubocop.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ Style/Documentation:
5757
Enabled: false
5858

5959
# To fix later
60+
Style/FormatStringToken:
61+
Enabled: false
6062
Style/PercentLiteralDelimiters:
6163
Enabled: false
6264
Style/VariableNumber:
@@ -73,7 +75,13 @@ Style/EmptyMethod:
7375
Enabled: false
7476
Style/SymbolArray:
7577
Enabled: false
76-
Style/IndentHeredoc:
78+
Style/YodaCondition:
79+
Enabled: false
80+
Layout/HeredocIndentation:
81+
Enabled: false
82+
Layout/ExtraSpacing:
83+
Enabled: false
84+
Performance/Caller:
7785
Enabled: false
78-
Style/ExtraSpacing:
86+
Style/WordArray:
7987
Enabled: false

.travis.yml

Lines changed: 0 additions & 26 deletions
This file was deleted.

Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ RUN sed -i'' -e 's/CipherString = DEFAULT@SECLEVEL=2/CipherString = DEFAULT@SECL
88
RUN sed -i'' -e 's/MinProtocol = TLSv1.2/MinProtocol = TLSv1/g' /etc/ssl/openssl.cnf
99

1010
FROM scratch AS app
11+
ARG PUPPET_VERSION
12+
ENV PUPPET_VERSION="${PUPPET_VERSION}"
1113
COPY --from=ruby / /
1214
WORKDIR /app
1315
ENV LANG="C.UTF-8"

config/puppet-versions.json

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,4 @@
11
[
2-
{
3-
"minimum_version": "3.0.0",
4-
"maximum_version": "3.99.99",
5-
"additional_gems": [
6-
{ "name": "safe_yaml", "version": "~> 1.0.4" },
7-
{ "name": "puppetdb-terminus", "version": "3.2.4" }
8-
]
9-
},
102
{
113
"minimum_version": "4.0.0",
124
"maximum_version": "4.99.99",

lib/octocatalog-diff/api/v1/override.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def convert_to_data_type(datatype, value)
7474
return value if datatype == 'string'
7575
return parse_json(value) if datatype == 'json'
7676
return nil if datatype == 'nil'
77-
if datatype == 'fixnum' || datatype == 'integer'
77+
if ['fixnum', 'integer'].include? datatype
7878
return Regexp.last_match(1).to_i if value =~ /^(-?\d+)$/
7979
raise ArgumentError, "Illegal integer '#{value}'"
8080
end

lib/octocatalog-diff/catalog-diff/differ.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ def filter_and_cleanup(catalog_resources)
262262
# Process each attribute in the resource
263263
resource.each do |k, v|
264264
# Title was pre-processed
265-
next if k == 'title' || k == 'type'
265+
next if ['title', 'type'].include? k
266266

267267
# Handle parameters
268268
if k == 'parameters'
@@ -272,7 +272,7 @@ def filter_and_cleanup(catalog_resources)
272272
# The order of tags is unimportant. Sort this array to avoid false diffs if order changes.
273273
# Also if tags is empty, don't add.
274274
hsh[k] = v.sort if v.is_a?(Array) && v.any?
275-
elsif k == 'file' || k == 'line'
275+
elsif ['file', 'line'].include? k
276276
# We don't care, for the purposes of catalog-diff, from which manifest and line this resource originated.
277277
# However, we may report this to the user, so we will keep it in here for now.
278278
hsh[k] = v
@@ -354,7 +354,7 @@ def attr_match_rule?(rule, attrib, old_val, new_val)
354354
elsif operator == '=->'
355355
# String equality test only of the old value
356356
matcher = ->(x, _y) { x == value }
357-
elsif operator == '=~>' || operator == '=&>'
357+
elsif ['=~>', '=&>'].include? operator
358358
begin
359359
my_regex = Regexp.new(value, Regexp::IGNORECASE)
360360
rescue RegexpError => exc

lib/octocatalog-diff/catalog-diff/display/text.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ def self.class_name_for_diffy(class_name)
457457
def self.stringify_for_diffy(obj)
458458
return JSON.pretty_generate(obj) if OctocatalogDiff::Util::Util.object_is_any_of?(obj, [Hash, Array])
459459
return '""' if obj.is_a?(String) && obj == ''
460-
return obj if OctocatalogDiff::Util::Util.object_is_any_of?(obj, [String, Fixnum, Integer, Float])
460+
return obj if OctocatalogDiff::Util::Util.object_is_any_of?(obj, [String, Integer, Float])
461461
"#{class_name_for_diffy(obj.class)}: #{obj.inspect}"
462462
end
463463

0 commit comments

Comments
 (0)