modulesync 4.5.0 → 4.6.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/.github/workflows/ci.yml +5 -5
- data/.github/workflows/labeler.yml +1 -1
- data/.github/workflows/release.yml +3 -3
- data/CHANGELOG.md +10 -2
- data/README.md +17 -0
- data/features/cli.feature +5 -0
- data/lib/modulesync/cli.rb +8 -0
- data/lib/modulesync/puppet_module.rb +2 -2
- data/lib/modulesync/repository.rb +16 -5
- data/lib/modulesync/version.rb +1 -1
- data/lib/modulesync.rb +3 -2
- data/spec/unit/module_sync/repository_spec.rb +31 -0
- data/spec/unit/module_sync_spec.rb +12 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 42cf2d8364d939be480302cbb0856e69df96468c5b35a460c29380dbb1455049
|
|
4
|
+
data.tar.gz: 93ee25b205bd960afe750188b5e1bf7c640aace8bdb91aac8345aed93d980a23
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: de6493978a435981fdc1b28bb0d937df4631f8eea6cdfe820bfb543b829a1c51d77672f31e510caaf18ef62754ead0988beab47040ad1ecc8c6e75723517d3fa
|
|
7
|
+
data.tar.gz: 46094244ce217f1e3dfbfd57d87b6aba64d0533dfe42b94d96ef48a66d2ef17dcc0cae9e24e08d54344bb0b9fa1553f1eb8898170489b0b79bfc9fab9acb5081
|
data/.github/workflows/ci.yml
CHANGED
|
@@ -16,16 +16,16 @@ jobs:
|
|
|
16
16
|
outputs:
|
|
17
17
|
ruby: ${{ steps.ruby.outputs.versions }}
|
|
18
18
|
steps:
|
|
19
|
-
- uses: actions/checkout@
|
|
19
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
20
20
|
- name: Setup ruby
|
|
21
|
-
uses: ruby/setup-ruby@
|
|
21
|
+
uses: ruby/setup-ruby@95ef2b042f9d7a56d8268cba8559e2842e2ad01b # v1.321.0
|
|
22
22
|
with:
|
|
23
23
|
ruby-version: "3.4"
|
|
24
24
|
bundler-cache: true
|
|
25
25
|
- name: Run linter
|
|
26
26
|
run: bundle exec rake rubocop
|
|
27
27
|
- id: ruby
|
|
28
|
-
uses: voxpupuli/ruby-version@
|
|
28
|
+
uses: voxpupuli/ruby-version@be0467ce7366d206b2e87f5b7a032a030120b7cb # 2.0.0
|
|
29
29
|
|
|
30
30
|
test:
|
|
31
31
|
name: "Ruby ${{ matrix.ruby }}"
|
|
@@ -36,9 +36,9 @@ jobs:
|
|
|
36
36
|
matrix:
|
|
37
37
|
ruby: ${{ fromJSON(needs.rubocop_and_matrix.outputs.ruby) }}
|
|
38
38
|
steps:
|
|
39
|
-
- uses: actions/checkout@
|
|
39
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
40
40
|
- name: Install Ruby ${{ matrix.ruby }}
|
|
41
|
-
uses: ruby/setup-ruby@
|
|
41
|
+
uses: ruby/setup-ruby@95ef2b042f9d7a56d8268cba8559e2842e2ad01b # v1.321.0
|
|
42
42
|
with:
|
|
43
43
|
ruby-version: ${{ matrix.ruby }}
|
|
44
44
|
bundler-cache: true
|
|
@@ -15,9 +15,9 @@ jobs:
|
|
|
15
15
|
name: Build the gem
|
|
16
16
|
runs-on: ubuntu-24.04
|
|
17
17
|
steps:
|
|
18
|
-
- uses: actions/checkout@
|
|
18
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
19
19
|
- name: Install Ruby
|
|
20
|
-
uses: ruby/setup-ruby@
|
|
20
|
+
uses: ruby/setup-ruby@95ef2b042f9d7a56d8268cba8559e2842e2ad01b # v1.321.0
|
|
21
21
|
with:
|
|
22
22
|
ruby-version: 'ruby'
|
|
23
23
|
- name: Build gem
|
|
@@ -96,7 +96,7 @@ jobs:
|
|
|
96
96
|
with:
|
|
97
97
|
name: gem-artifact
|
|
98
98
|
- name: Install Ruby
|
|
99
|
-
uses: ruby/setup-ruby@
|
|
99
|
+
uses: ruby/setup-ruby@95ef2b042f9d7a56d8268cba8559e2842e2ad01b # v1.321.0
|
|
100
100
|
with:
|
|
101
101
|
ruby-version: 'ruby'
|
|
102
102
|
- name: Wait for release to propagate
|
data/CHANGELOG.md
CHANGED
|
@@ -2,9 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
|
|
5
|
-
## [4.
|
|
5
|
+
## [4.6.0](https://github.com/voxpupuli/modulesync/tree/4.6.0) (2026-07-31)
|
|
6
6
|
|
|
7
|
-
[Full Changelog](https://github.com/voxpupuli/modulesync/compare/v4.
|
|
7
|
+
[Full Changelog](https://github.com/voxpupuli/modulesync/compare/v4.5.0...4.6.0)
|
|
8
|
+
|
|
9
|
+
**Implemented enhancements:**
|
|
10
|
+
|
|
11
|
+
- feat: add support for cryptographic signing and signoff options in commits and tags [\#368](https://github.com/voxpupuli/modulesync/pull/368) ([rwaffen](https://github.com/rwaffen))
|
|
12
|
+
|
|
13
|
+
## [v4.5.0](https://github.com/voxpupuli/modulesync/tree/v4.5.0) (2026-07-15)
|
|
14
|
+
|
|
15
|
+
[Full Changelog](https://github.com/voxpupuli/modulesync/compare/v4.4.0...v4.5.0)
|
|
8
16
|
|
|
9
17
|
**Implemented enhancements:**
|
|
10
18
|
|
data/README.md
CHANGED
|
@@ -166,6 +166,17 @@ Not required for gerrit.
|
|
|
166
166
|
msync update --amend --force
|
|
167
167
|
```
|
|
168
168
|
|
|
169
|
+
Use `--sign` to cryptographically sign commits and tags with Git's configured signing key and backend.
|
|
170
|
+
ModuleSync only passes Git's signing flags (`git commit --gpg-sign` and `git tag --sign`).
|
|
171
|
+
It does not configure the signing key, format, or backend; users must configure these settings in their Git configuration.
|
|
172
|
+
Use `--signoff` to add Git's `Signed-off-by` trailer.
|
|
173
|
+
The options can be combined and also apply to the release commit created by `--bump`.
|
|
174
|
+
When combined with `--tag`, `--sign` creates signed annotated tags using `git tag --sign`.
|
|
175
|
+
|
|
176
|
+
```shell
|
|
177
|
+
msync update -m "Commit message" --sign --signoff
|
|
178
|
+
```
|
|
179
|
+
|
|
169
180
|
#### Automating Updates
|
|
170
181
|
|
|
171
182
|
You can install a pre-push git hook to automatically clone, update, and push modules upon pushing changes to the configuration directory.
|
|
@@ -365,6 +376,12 @@ If you wish to tag the modified repositories with the newly bumped version, you
|
|
|
365
376
|
msync update -m "Commit message" --bump --tag
|
|
366
377
|
```
|
|
367
378
|
|
|
379
|
+
Add `--sign` to cryptographically sign both the release commit and tag:
|
|
380
|
+
|
|
381
|
+
```shell
|
|
382
|
+
msync update -m "Commit message" --bump --tag --sign
|
|
383
|
+
```
|
|
384
|
+
|
|
368
385
|
#### Setting the tag pattern
|
|
369
386
|
|
|
370
387
|
You can also set the format of the tag to be used (`printf`-formatted) by setting the `tag_pattern` option:
|
data/features/cli.feature
CHANGED
|
@@ -28,6 +28,11 @@ Feature: CLI
|
|
|
28
28
|
msync clone
|
|
29
29
|
"""
|
|
30
30
|
|
|
31
|
+
Scenario: Update help lists commit signing options
|
|
32
|
+
When I successfully run `msync update --help`
|
|
33
|
+
Then the output should match /--sign/
|
|
34
|
+
And the output should match /--signoff/
|
|
35
|
+
|
|
31
36
|
Scenario: When overriding a setting from the config file on the command line
|
|
32
37
|
Given a puppet module "puppet-test" from "fakenamespace"
|
|
33
38
|
And a file named "managed_modules.yml" with:
|
data/lib/modulesync/cli.rb
CHANGED
|
@@ -88,6 +88,14 @@ module ModuleSync
|
|
|
88
88
|
type: :boolean,
|
|
89
89
|
desc: 'Amend previous commit',
|
|
90
90
|
default: false
|
|
91
|
+
option :sign,
|
|
92
|
+
type: :boolean,
|
|
93
|
+
desc: 'Cryptographically sign commits and tags',
|
|
94
|
+
default: false
|
|
95
|
+
option :signoff,
|
|
96
|
+
type: :boolean,
|
|
97
|
+
desc: 'Add a Signed-off-by trailer to commits',
|
|
98
|
+
default: false
|
|
91
99
|
option :force,
|
|
92
100
|
type: :boolean,
|
|
93
101
|
desc: 'Force push amended commit',
|
|
@@ -25,13 +25,13 @@ module ModuleSync
|
|
|
25
25
|
end
|
|
26
26
|
end
|
|
27
27
|
|
|
28
|
-
def bump(message, changelog = false)
|
|
28
|
+
def bump(message, changelog = false, signing_options = {})
|
|
29
29
|
m = Blacksmith::Modulefile.new path('metadata.json')
|
|
30
30
|
new = m.bump!
|
|
31
31
|
puts "Bumped to version #{new}"
|
|
32
32
|
repository.git.add('metadata.json')
|
|
33
33
|
update_changelog(new, message) if changelog
|
|
34
|
-
repository.
|
|
34
|
+
repository.commit_changes("Release version #{new}", signing_options)
|
|
35
35
|
repository.git.push
|
|
36
36
|
new
|
|
37
37
|
end
|
|
@@ -165,10 +165,10 @@ module ModuleSync
|
|
|
165
165
|
end
|
|
166
166
|
end
|
|
167
167
|
|
|
168
|
-
def tag(version, tag_pattern)
|
|
168
|
+
def tag(version, tag_pattern, sign: false)
|
|
169
169
|
tag = tag_pattern % version
|
|
170
170
|
puts "Tagging with #{tag}"
|
|
171
|
-
repo.add_tag(tag)
|
|
171
|
+
repo.add_tag(tag, sign: sign)
|
|
172
172
|
repo.push('origin', tag)
|
|
173
173
|
end
|
|
174
174
|
|
|
@@ -178,6 +178,19 @@ module ModuleSync
|
|
|
178
178
|
selected_branch
|
|
179
179
|
end
|
|
180
180
|
|
|
181
|
+
def commit_changes(message, options)
|
|
182
|
+
commit_options = {}
|
|
183
|
+
commit_options[:amend] = true if options[:amend]
|
|
184
|
+
commit_options[:gpg_sign] = true if options[:sign]
|
|
185
|
+
return repo.commit(message, commit_options) unless options[:signoff]
|
|
186
|
+
|
|
187
|
+
arguments = ["--message=#{message}"]
|
|
188
|
+
arguments.push('--amend', '--no-edit') if options[:amend]
|
|
189
|
+
arguments << '--gpg-sign' if options[:sign]
|
|
190
|
+
arguments << '--signoff'
|
|
191
|
+
repo.lib.send(:command, 'commit', *arguments)
|
|
192
|
+
end
|
|
193
|
+
|
|
181
194
|
# Git add/rm, git commit, git push
|
|
182
195
|
def submit_changes(files, options)
|
|
183
196
|
message = options[:message]
|
|
@@ -190,8 +203,6 @@ module ModuleSync
|
|
|
190
203
|
end
|
|
191
204
|
end
|
|
192
205
|
begin
|
|
193
|
-
opts_commit = {}
|
|
194
|
-
opts_commit = { amend: true } if options[:amend]
|
|
195
206
|
if options[:pre_commit_script]
|
|
196
207
|
script = "#{File.dirname(__FILE__, 3)}/contrib/#{options[:pre_commit_script]}"
|
|
197
208
|
system(script, @directory)
|
|
@@ -200,7 +211,7 @@ module ModuleSync
|
|
|
200
211
|
puts "There were no changes in '#{@directory}'. Not committing."
|
|
201
212
|
return false unless @rebased
|
|
202
213
|
else
|
|
203
|
-
|
|
214
|
+
commit_changes(message, options)
|
|
204
215
|
end
|
|
205
216
|
if options[:remote_branch]
|
|
206
217
|
if @rebased || remote_branch_differ?(branch, options[:remote_branch])
|
data/lib/modulesync/version.rb
CHANGED
data/lib/modulesync.rb
CHANGED
|
@@ -151,8 +151,9 @@ module ModuleSync
|
|
|
151
151
|
pushed = puppet_module.repository.submit_changes(files_to_manage, options)
|
|
152
152
|
# Only bump/tag if pushing didn't fail (i.e. there were changes)
|
|
153
153
|
if pushed && options[:bump]
|
|
154
|
-
|
|
155
|
-
puppet_module.
|
|
154
|
+
signing_options = { sign: options[:sign], signoff: options[:signoff] }
|
|
155
|
+
new = puppet_module.bump(options[:message], options[:changelog], signing_options)
|
|
156
|
+
puppet_module.repository.tag(new, options[:tag_pattern], sign: options[:sign]) if options[:tag]
|
|
156
157
|
end
|
|
157
158
|
options[:pr] && (pushed || puppet_module.pull_request_branch_ready?) && puppet_module.open_pull_request
|
|
158
159
|
end
|
|
@@ -116,4 +116,35 @@ describe ModuleSync::Repository do
|
|
|
116
116
|
expect(result).to be true
|
|
117
117
|
end
|
|
118
118
|
end
|
|
119
|
+
|
|
120
|
+
describe '#commit_changes' do
|
|
121
|
+
it 'signs the commit when requested' do
|
|
122
|
+
expect(git).to receive(:commit).with('Update', { gpg_sign: true })
|
|
123
|
+
|
|
124
|
+
repository.commit_changes('Update', sign: true, signoff: false)
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
it 'uses the Git signoff option when requested' do
|
|
128
|
+
expect(git_lib).to receive(:send)
|
|
129
|
+
.with(:command, 'commit', '--message=Update', '--signoff')
|
|
130
|
+
|
|
131
|
+
repository.commit_changes('Update', sign: false, signoff: true)
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
it 'combines amend, signing, and signoff options' do
|
|
135
|
+
expect(git_lib).to receive(:send)
|
|
136
|
+
.with(:command, 'commit', '--message=Update', '--amend', '--no-edit', '--gpg-sign', '--signoff')
|
|
137
|
+
|
|
138
|
+
repository.commit_changes('Update', amend: true, sign: true, signoff: true)
|
|
139
|
+
end
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
describe '#tag' do
|
|
143
|
+
it 'signs and pushes the tag when requested' do
|
|
144
|
+
expect(git).to receive(:add_tag).with('v1.2.3', sign: true)
|
|
145
|
+
expect(git).to receive(:push).with('origin', 'v1.2.3')
|
|
146
|
+
|
|
147
|
+
repository.tag('1.2.3', 'v%s', sign: true)
|
|
148
|
+
end
|
|
149
|
+
end
|
|
119
150
|
end
|
|
@@ -70,5 +70,17 @@ describe ModuleSync do
|
|
|
70
70
|
|
|
71
71
|
described_class.manage_module(puppet_module, [], {})
|
|
72
72
|
end
|
|
73
|
+
|
|
74
|
+
it 'passes signing options to a release commit and tag' do
|
|
75
|
+
options = described_class.config_defaults.merge(message: 'Update', bump: true, tag: true, sign: true, signoff: true)
|
|
76
|
+
described_class.instance_variable_set(:@options, options)
|
|
77
|
+
allow(repository).to receive(:submit_changes).and_return(true)
|
|
78
|
+
expect(puppet_module).to receive(:bump)
|
|
79
|
+
.with('Update', nil, { sign: true, signoff: true })
|
|
80
|
+
.and_return('1.2.3')
|
|
81
|
+
expect(repository).to receive(:tag).with('1.2.3', '%s', sign: true)
|
|
82
|
+
|
|
83
|
+
described_class.manage_module(puppet_module, [], {})
|
|
84
|
+
end
|
|
73
85
|
end
|
|
74
86
|
end
|