pdk 1.14.1 → 1.15.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +27 -0
- data/lib/pdk/answer_file.rb +5 -7
- data/lib/pdk/cli.rb +1 -0
- data/lib/pdk/cli/console.rb +1 -1
- data/lib/pdk/cli/convert.rb +10 -2
- data/lib/pdk/cli/exec.rb +2 -1
- data/lib/pdk/cli/module/build.rb +1 -1
- data/lib/pdk/cli/module/generate.rb +1 -1
- data/lib/pdk/cli/release.rb +192 -0
- data/lib/pdk/cli/release/prep.rb +39 -0
- data/lib/pdk/cli/release/publish.rb +40 -0
- data/lib/pdk/cli/update.rb +12 -0
- data/lib/pdk/config.rb +1 -1
- data/lib/pdk/config/namespace.rb +1 -1
- data/lib/pdk/generate/module.rb +11 -17
- data/lib/pdk/generate/puppet_object.rb +1 -2
- data/lib/pdk/generate/task.rb +1 -1
- data/lib/pdk/module.rb +2 -1
- data/lib/pdk/module/build.rb +15 -25
- data/lib/pdk/module/convert.rb +4 -9
- data/lib/pdk/module/metadata.rb +1 -3
- data/lib/pdk/module/release.rb +260 -0
- data/lib/pdk/module/template_dir.rb +115 -0
- data/lib/pdk/module/template_dir/base.rb +268 -0
- data/lib/pdk/module/template_dir/git.rb +91 -0
- data/lib/pdk/module/template_dir/local.rb +21 -0
- data/lib/pdk/module/update.rb +17 -5
- data/lib/pdk/module/update_manager.rb +1 -1
- data/lib/pdk/report.rb +18 -12
- data/lib/pdk/report/event.rb +6 -3
- data/lib/pdk/template_file.rb +2 -2
- data/lib/pdk/util.rb +17 -6
- data/lib/pdk/util/bundler.rb +8 -9
- data/lib/pdk/util/changelog_generator.rb +115 -0
- data/lib/pdk/util/filesystem.rb +62 -2
- data/lib/pdk/util/git.rb +60 -8
- data/lib/pdk/util/puppet_version.rb +4 -5
- data/lib/pdk/util/ruby_version.rb +3 -3
- data/lib/pdk/util/template_uri.rb +49 -40
- data/lib/pdk/util/version.rb +4 -4
- data/lib/pdk/validate/metadata/metadata_syntax.rb +2 -2
- data/lib/pdk/validate/puppet/puppet_epp.rb +2 -4
- data/lib/pdk/validate/puppet/puppet_syntax.rb +2 -4
- data/lib/pdk/validate/tasks/metadata_lint.rb +2 -2
- data/lib/pdk/validate/yaml/syntax.rb +3 -3
- data/lib/pdk/version.rb +1 -1
- data/locales/pdk.pot +401 -149
- metadata +11 -3
- data/lib/pdk/module/templatedir.rb +0 -391
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d1b4321e6c37cde43ae58cb4ca94cd578254270065c698c87455aa37976cea36
|
4
|
+
data.tar.gz: 054d826aefa38e7697d7b45e6f9c6733f4ad2f36501c9cb34dab7c1c6e47d2af
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ab2eba8dc386d45b6894a4aac0e17ff24208890fd73932cdebc10e9ffa0405e30280de45fc6190f24e3042b2ad7b208714171f581922be1a7bc601d6d212934
|
7
|
+
data.tar.gz: 52da98af48384e23b1fb2ca97dc1ad77d4811aa9f5dc6d9eaa89f9894e6d33a7e533b3b612699a33f9bbb02a3b29bd64a9b9b498cf04130288d16c78399f8b8b
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,33 @@ All changes to this repo will be documented in this file.
|
|
4
4
|
See the [release notes](https://puppet.com/docs/pdk/latest/release_notes.html) for a high-level summary.
|
5
5
|
|
6
6
|
|
7
|
+
## [v1.15.0](https://github.com/puppetlabs/pdk/tree/v1.15.0) (2019-12-13)
|
8
|
+
[Full Changelog](https://github.com/puppetlabs/pdk/compare/v1.14.1...v1.15.0)
|
9
|
+
|
10
|
+
**Implemented enhancements:**
|
11
|
+
|
12
|
+
- \(PDK-1488\) Inform user if updating a pinned module [\#816](https://github.com/puppetlabs/pdk/pull/816) ([rodjek](https://github.com/rodjek))
|
13
|
+
- \(PDK-1487\) Add --default-template flag to pdk convert [\#814](https://github.com/puppetlabs/pdk/pull/814) ([rodjek](https://github.com/rodjek))
|
14
|
+
- \(GH-808\) Implement pdk release prep and publish subcommands [\#813](https://github.com/puppetlabs/pdk/pull/813) ([glennsarti](https://github.com/glennsarti))
|
15
|
+
- \(GH-808\) Implement pdk release subcommand [\#809](https://github.com/puppetlabs/pdk/pull/809) ([glennsarti](https://github.com/glennsarti))
|
16
|
+
- \(PDK-1364\) Allow non-git template directories to be used [\#803](https://github.com/puppetlabs/pdk/pull/803) ([glennsarti](https://github.com/glennsarti))
|
17
|
+
|
18
|
+
**Fixed bugs:**
|
19
|
+
|
20
|
+
- \(UI\) Remove UTF-8 "smart quotes" from PDK output [\#806](https://github.com/puppetlabs/pdk/issues/806)
|
21
|
+
- \(GH-808\) Fix prompt for pdk release [\#812](https://github.com/puppetlabs/pdk/pull/812) ([glennsarti](https://github.com/glennsarti))
|
22
|
+
- \(PDK-1169\) Add VMWare fallback to PDK::Util::Filesystem.mv [\#802](https://github.com/puppetlabs/pdk/pull/802) ([rodjek](https://github.com/rodjek))
|
23
|
+
|
24
|
+
**Closed issues:**
|
25
|
+
|
26
|
+
- Implement `pdk release` command as per RFC \(part 1\) [\#808](https://github.com/puppetlabs/pdk/issues/808)
|
27
|
+
- Cannot install pdk 1.14.1.0-1xenial deb - Operation not permitted [\#798](https://github.com/puppetlabs/pdk/issues/798)
|
28
|
+
|
29
|
+
**Merged pull requests:**
|
30
|
+
|
31
|
+
- \(\#806\) Use ASCII quotes instead of Unicode quotes [\#807](https://github.com/puppetlabs/pdk/pull/807) ([rodjek](https://github.com/rodjek))
|
32
|
+
- \(PDK-1523\) Refactor filesystem operations to use PDK::Util::Filesystem [\#799](https://github.com/puppetlabs/pdk/pull/799) ([rodjek](https://github.com/rodjek))
|
33
|
+
|
7
34
|
## [v1.14.1](https://github.com/puppetlabs/pdk/tree/v1.14.1) (2019-11-01)
|
8
35
|
[Full Changelog](https://github.com/puppetlabs/pdk/compare/v1.14.0...v1.14.1)
|
9
36
|
|
data/lib/pdk/answer_file.rb
CHANGED
@@ -6,8 +6,6 @@ module PDK
|
|
6
6
|
attr_reader :answers
|
7
7
|
attr_reader :answer_file_path
|
8
8
|
|
9
|
-
include PDK::Util::Filesystem
|
10
|
-
|
11
9
|
# Initialises the AnswerFile object, which stores the responses to certain
|
12
10
|
# interactive questions.
|
13
11
|
#
|
@@ -64,15 +62,15 @@ module PDK
|
|
64
62
|
#
|
65
63
|
# @return [Hash{String => Object}] The existing questions and answers.
|
66
64
|
def read_from_disk
|
67
|
-
return {} if !
|
65
|
+
return {} if !PDK::Util::Filesystem.file?(answer_file_path) || PDK::Util::Filesystem.zero?(answer_file_path)
|
68
66
|
|
69
|
-
unless
|
67
|
+
unless PDK::Util::Filesystem.readable?(answer_file_path)
|
70
68
|
raise PDK::CLI::FatalError, _("Unable to open '%{file}' for reading") % {
|
71
69
|
file: answer_file_path,
|
72
70
|
}
|
73
71
|
end
|
74
72
|
|
75
|
-
answers = JSON.parse(
|
73
|
+
answers = JSON.parse(PDK::Util::Filesystem.read_file(answer_file_path))
|
76
74
|
if answers.is_a?(Hash)
|
77
75
|
answers
|
78
76
|
else
|
@@ -92,9 +90,9 @@ module PDK
|
|
92
90
|
#
|
93
91
|
# @raise [PDK::CLI::FatalError] if the answer file can not be written to.
|
94
92
|
def save_to_disk
|
95
|
-
|
93
|
+
PDK::Util::Filesystem.mkdir_p(File.dirname(answer_file_path))
|
96
94
|
|
97
|
-
write_file(answer_file_path, JSON.pretty_generate(answers))
|
95
|
+
PDK::Util::Filesystem.write_file(answer_file_path, JSON.pretty_generate(answers))
|
98
96
|
rescue SystemCallError, IOError => e
|
99
97
|
raise PDK::CLI::FatalError, _("Unable to write '%{file}': %{msg}") % {
|
100
98
|
file: answer_file_path,
|
data/lib/pdk/cli.rb
CHANGED
data/lib/pdk/cli/console.rb
CHANGED
@@ -84,7 +84,7 @@ EOF
|
|
84
84
|
|
85
85
|
def check_fixtures_dir
|
86
86
|
existing_path = base_module_path.split(':').find do |path|
|
87
|
-
|
87
|
+
PDK::Util::Filesystem.directory?(path) && Dir.entries(path).length > 2
|
88
88
|
end
|
89
89
|
PDK.logger.warn _('Module fixtures not found, please run pdk bundle exec rake spec_prep.') unless existing_path
|
90
90
|
end
|
data/lib/pdk/cli/convert.rb
CHANGED
@@ -11,6 +11,7 @@ module PDK::CLI
|
|
11
11
|
flag nil, :noop, _('Do not convert the module, just output what would be done.')
|
12
12
|
flag nil, :force, _('Convert the module automatically, with no prompts.')
|
13
13
|
flag nil, :'add-tests', _('Add any missing tests while converting the module.')
|
14
|
+
flag nil, :'default-template', _('Convert the module to use the default PDK template.')
|
14
15
|
|
15
16
|
run do |opts, _args, _cmd|
|
16
17
|
require 'pdk/module/convert'
|
@@ -22,12 +23,19 @@ module PDK::CLI
|
|
22
23
|
log_level: :info,
|
23
24
|
)
|
24
25
|
|
25
|
-
PDK::CLI::Util.validate_template_opts(opts)
|
26
|
-
|
27
26
|
if opts[:noop] && opts[:force]
|
28
27
|
raise PDK::CLI::ExitWithError, _('You can not specify --noop and --force when converting a module')
|
29
28
|
end
|
30
29
|
|
30
|
+
if opts[:'default-template']
|
31
|
+
raise PDK::CLI::ExitWithError, _('You can not specify --template-url and --default-template.') if opts[:'template-url']
|
32
|
+
|
33
|
+
opts[:'template-url'] = PDK::Util::TemplateURI.default_template_addressable_uri.to_s
|
34
|
+
PDK.answers.update!('template-url' => nil)
|
35
|
+
end
|
36
|
+
|
37
|
+
PDK::CLI::Util.validate_template_opts(opts)
|
38
|
+
|
31
39
|
PDK::CLI::Util.analytics_screen_view('convert', opts)
|
32
40
|
|
33
41
|
if opts[:'skip-interview'] && opts[:'full-interview']
|
data/lib/pdk/cli/exec.rb
CHANGED
@@ -67,7 +67,8 @@ module PDK
|
|
67
67
|
|
68
68
|
vendored_bin_full_path = File.join(PDK::Util.pdk_package_basedir, vendored_bin_path)
|
69
69
|
|
70
|
-
|
70
|
+
require 'pdk/util/filesystem'
|
71
|
+
unless PDK::Util::Filesystem.exist?(vendored_bin_full_path)
|
71
72
|
PDK.logger.debug(_("Could not find '%{vendored_bin}' in PDK package. Trying '%{fallback}' from the system PATH instead.") % {
|
72
73
|
fallback: fallback,
|
73
74
|
vendored_bin: vendored_bin_full_path,
|
data/lib/pdk/cli/module/build.rb
CHANGED
@@ -5,7 +5,7 @@ module PDK::CLI
|
|
5
5
|
summary _('This command is now \'pdk build\'.')
|
6
6
|
|
7
7
|
run do |_opts, _args, _cmd|
|
8
|
-
PDK.logger.warn(_(
|
8
|
+
PDK.logger.warn(_("Modules are built using the 'pdk build' command."))
|
9
9
|
exit 1
|
10
10
|
end
|
11
11
|
end
|
@@ -21,7 +21,7 @@ module PDK::CLI
|
|
21
21
|
|
22
22
|
PDK::CLI::Util.validate_template_opts(opts)
|
23
23
|
|
24
|
-
PDK.logger.info(_(
|
24
|
+
PDK.logger.info(_("New modules are created using the 'pdk new module' command."))
|
25
25
|
prompt = TTY::Prompt.new(help_color: :cyan)
|
26
26
|
redirect = PDK::CLI::Util::CommandRedirector.new(prompt)
|
27
27
|
redirect.target_command('pdk new module')
|
@@ -0,0 +1,192 @@
|
|
1
|
+
require 'pdk/cli/util'
|
2
|
+
require 'pdk/validate'
|
3
|
+
require 'pdk/util/bundler'
|
4
|
+
require 'pdk/cli/util/interview'
|
5
|
+
require 'pdk/util/changelog_generator'
|
6
|
+
require 'pdk/module/build'
|
7
|
+
|
8
|
+
module PDK::CLI
|
9
|
+
@release_cmd = @base_cmd.define_command do
|
10
|
+
name 'release'
|
11
|
+
usage _('release [options]')
|
12
|
+
summary _('(Experimental) Release a module to the Puppet Forge.')
|
13
|
+
|
14
|
+
flag nil, :force, _('Release the module automatically, with no prompts.')
|
15
|
+
flag nil, :'skip-validation', _('Skips the module validation check.')
|
16
|
+
flag nil, :'skip-changelog', _('Skips the automatic changelog generation.')
|
17
|
+
flag nil, :'skip-dependency', _('Skips the module dependency check.')
|
18
|
+
flag nil, :'skip-documentation', _('Skips the documentation update.')
|
19
|
+
flag nil, :'skip-build', _('Skips module build.')
|
20
|
+
flag nil, :'skip-publish', _('Skips publishing the module to the forge.')
|
21
|
+
|
22
|
+
option nil, :'forge-upload-url', _('Set forge upload url path.'),
|
23
|
+
argument: :required, default: 'https://forgeapi.puppetlabs.com/v3/releases'
|
24
|
+
|
25
|
+
option nil, :'forge-token', _('Set Forge API token.'), argument: :required, default: nil
|
26
|
+
|
27
|
+
option nil, :version, _('Update the module to the specified version prior to release. When not specified, the new version will be computed from the Changelog where possible.'),
|
28
|
+
argument: :required
|
29
|
+
|
30
|
+
option nil, :file, _('Path to the built module to push to the Forge. This option can only be used when --skip-build is also used. Defaults to pkg/<module version>.tar.gz'),
|
31
|
+
argument: :required
|
32
|
+
|
33
|
+
run do |opts, _args, _cmd|
|
34
|
+
# Make sure build is being run in a valid module directory with a metadata.json
|
35
|
+
PDK::CLI::Util.ensure_in_module!(
|
36
|
+
message: _('`pdk release` can only be run from inside a valid module with a metadata.json.'),
|
37
|
+
log_level: :info,
|
38
|
+
)
|
39
|
+
|
40
|
+
Release.prepare_interview(opts) unless opts[:force]
|
41
|
+
|
42
|
+
Release.send_analytics('release', opts)
|
43
|
+
|
44
|
+
release = PDK::Module::Release.new(nil, opts)
|
45
|
+
|
46
|
+
Release.module_compatibility_checks!(release, opts)
|
47
|
+
|
48
|
+
release.run
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
module Release
|
53
|
+
# Checks whether the module is compatible with PDK release process
|
54
|
+
# @param release PDK::Module::Release Object representing the release
|
55
|
+
# @param opts Options Hash from Cri
|
56
|
+
def self.module_compatibility_checks!(release, opts)
|
57
|
+
unless release.module_metadata.forge_ready?
|
58
|
+
if opts[:force]
|
59
|
+
PDK.logger.warn _(
|
60
|
+
'This module is missing the following fields in the metadata.json: %{fields}. ' \
|
61
|
+
'These missing fields may affect the visibility of the module on the Forge.',
|
62
|
+
) % {
|
63
|
+
fields: release.module_metadata.missing_fields.join(', '),
|
64
|
+
}
|
65
|
+
else
|
66
|
+
release.module_metadata.interview_for_forge!
|
67
|
+
release.write_module_metadata!
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
unless release.pdk_compatible? # rubocop:disable Style/GuardClause Nope!
|
72
|
+
if opts[:force]
|
73
|
+
PDK.logger.warn _('This module is not compatible with PDK, so PDK can not validate or test this build.')
|
74
|
+
else
|
75
|
+
PDK.logger.info _('This module is not compatible with PDK, so PDK can not validate or test this build. ' \
|
76
|
+
'Unvalidated modules may have errors when uploading to the Forge. ' \
|
77
|
+
'To make this module PDK compatible and use validate features, cancel the build and run `pdk convert`.')
|
78
|
+
unless PDK::CLI::Util.prompt_for_yes(_('Continue build without converting?'))
|
79
|
+
PDK.logger.info _('Build cancelled; exiting.')
|
80
|
+
PDK::Util.exit_process(1)
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
# Send_analytics for the given command and Cri options
|
87
|
+
def self.send_analytics(command, opts)
|
88
|
+
# Don't pass tokens to analytics
|
89
|
+
PDK::CLI::Util.analytics_screen_view(command, opts.reject { |k, _| k == :'forge-token' })
|
90
|
+
end
|
91
|
+
|
92
|
+
def self.prepare_interview(opts)
|
93
|
+
questions = []
|
94
|
+
|
95
|
+
unless opts[:'skip-validation']
|
96
|
+
questions << {
|
97
|
+
name: 'validation',
|
98
|
+
question: _('Do you want to run the module validation ?'),
|
99
|
+
type: :yes,
|
100
|
+
}
|
101
|
+
end
|
102
|
+
unless opts[:'skip-changelog']
|
103
|
+
questions << {
|
104
|
+
name: 'changelog',
|
105
|
+
question: _('Do you want to run the automatic changelog generation ?'),
|
106
|
+
type: :yes,
|
107
|
+
}
|
108
|
+
end
|
109
|
+
unless opts[:version]
|
110
|
+
questions << {
|
111
|
+
name: 'setversion',
|
112
|
+
question: _('Do you want to set the module version ?'),
|
113
|
+
type: :yes,
|
114
|
+
}
|
115
|
+
end
|
116
|
+
unless opts[:'skip-dependency']
|
117
|
+
questions << {
|
118
|
+
name: 'dependency',
|
119
|
+
question: _('Do you want to run the dependency-checker on this module?'),
|
120
|
+
type: :yes,
|
121
|
+
}
|
122
|
+
end
|
123
|
+
unless opts[:'skip-documentation']
|
124
|
+
questions << {
|
125
|
+
name: 'documentation',
|
126
|
+
question: _('Do you want to update the documentation for this module?'),
|
127
|
+
type: :yes,
|
128
|
+
}
|
129
|
+
end
|
130
|
+
unless opts[:'skip-publish']
|
131
|
+
questions << {
|
132
|
+
name: 'publish',
|
133
|
+
question: _('Do you want to publish the module on the Puppet Forge?'),
|
134
|
+
type: :yes,
|
135
|
+
}
|
136
|
+
end
|
137
|
+
|
138
|
+
prompt = TTY::Prompt.new(help_color: :cyan)
|
139
|
+
interview = PDK::CLI::Util::Interview.new(prompt)
|
140
|
+
interview.add_questions(questions)
|
141
|
+
answers = interview.run
|
142
|
+
|
143
|
+
unless answers.nil?
|
144
|
+
opts[:'skip-validation'] = !answers['validation']
|
145
|
+
opts[:'skip-changelog'] = !answers['changelog']
|
146
|
+
opts[:'skip-dependency'] = !answers['dependency']
|
147
|
+
opts[:'skip-documentation'] = !answers['documentation']
|
148
|
+
|
149
|
+
prepare_version_interview(prompt, opts) if answers['setversion']
|
150
|
+
|
151
|
+
prepare_publish_interview(prompt, opts) if answers['publish']
|
152
|
+
end
|
153
|
+
answers
|
154
|
+
end
|
155
|
+
|
156
|
+
def self.prepare_version_interview(prompt, opts)
|
157
|
+
questions = [
|
158
|
+
{
|
159
|
+
name: 'version',
|
160
|
+
question: _('Please set the module version'),
|
161
|
+
help: _('This value is the version that will be used in the changelog generator and building of the module.'),
|
162
|
+
required: true,
|
163
|
+
validate_pattern: %r{(\*|\d+(\.\d+){0,2}(\.\*)?)$}i,
|
164
|
+
validate_message: _('The version format should be in the format x.y.z where x represents the major version, y the minor version and z the build number.'),
|
165
|
+
},
|
166
|
+
]
|
167
|
+
interview = PDK::CLI::Util::Interview.new(prompt)
|
168
|
+
interview.add_questions(questions)
|
169
|
+
ver_answer = interview.run
|
170
|
+
opts[:version] = ver_answer['version']
|
171
|
+
end
|
172
|
+
|
173
|
+
def self.prepare_publish_interview(prompt, opts)
|
174
|
+
return if opts[:'forge-token']
|
175
|
+
questions = [
|
176
|
+
{
|
177
|
+
name: 'apikey',
|
178
|
+
question: _('Please set the api key(authorization token) to upload on the Puppet Forge'),
|
179
|
+
help: _('This value is used for authentication on the Puppet Forge to upload your module tarball.'),
|
180
|
+
required: true,
|
181
|
+
},
|
182
|
+
]
|
183
|
+
interview = PDK::CLI::Util::Interview.new(prompt)
|
184
|
+
interview.add_questions(questions)
|
185
|
+
api_answer = interview.run
|
186
|
+
opts[:'forge-token'] = api_answer['apikey']
|
187
|
+
end
|
188
|
+
end
|
189
|
+
end
|
190
|
+
|
191
|
+
require 'pdk/cli/release/prep'
|
192
|
+
require 'pdk/cli/release/publish'
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'pdk/cli/release'
|
2
|
+
|
3
|
+
module PDK::CLI
|
4
|
+
@release_prep_cmd = @release_cmd.define_command do
|
5
|
+
name 'prep'
|
6
|
+
usage _('prep [options]')
|
7
|
+
summary _('(Experimental) Performs all the pre-release checks to ensure module is ready to be released')
|
8
|
+
|
9
|
+
flag nil, :force, _('Prepare the module automatically, with no prompts.')
|
10
|
+
flag nil, :'skip-validation', _('Skips the module validation check.')
|
11
|
+
flag nil, :'skip-changelog', _('Skips the automatic changelog generation.')
|
12
|
+
flag nil, :'skip-dependency', _('Skips the module dependency check.')
|
13
|
+
flag nil, :'skip-documentation', _('Skips the documentation update.')
|
14
|
+
|
15
|
+
option nil, :version, _('Update the module to the specified version prior to release. When not specified, the new version will be computed from the Changelog where possible.'),
|
16
|
+
argument: :required
|
17
|
+
|
18
|
+
run do |opts, _args, cmd|
|
19
|
+
# Make sure build is being run in a valid module directory with a metadata.json
|
20
|
+
PDK::CLI::Util.ensure_in_module!(
|
21
|
+
message: _("`pdk release #{cmd.name}` can only be run from inside a valid module with a metadata.json."),
|
22
|
+
log_level: :info,
|
23
|
+
)
|
24
|
+
|
25
|
+
opts[:'skip-build'] = true
|
26
|
+
opts[:'skip-publish'] = true
|
27
|
+
|
28
|
+
Release.prepare_interview(opts) unless opts[:force]
|
29
|
+
|
30
|
+
Release.send_analytics("release #{cmd.name}", opts)
|
31
|
+
|
32
|
+
release = PDK::Module::Release.new(nil, opts)
|
33
|
+
|
34
|
+
Release.module_compatibility_checks!(release, opts)
|
35
|
+
|
36
|
+
release.run
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'pdk/cli/release'
|
2
|
+
|
3
|
+
module PDK::CLI
|
4
|
+
@release_publish_cmd = @release_cmd.define_command do
|
5
|
+
name 'publish'
|
6
|
+
usage _('publish [options] <tarball>')
|
7
|
+
summary _('(Experimental) Publishes the module <tarball> to the Forge.')
|
8
|
+
|
9
|
+
flag nil, :force, _('Publish the module automatically, with no prompts.')
|
10
|
+
|
11
|
+
option nil, :'forge-upload-url', _('Set forge upload url path.'),
|
12
|
+
argument: :required, default: 'https://forgeapi.puppetlabs.com/v3/releases'
|
13
|
+
|
14
|
+
option nil, :'forge-token', _('Set Forge API token.'), argument: :required, default: nil
|
15
|
+
|
16
|
+
run do |opts, _args, cmd|
|
17
|
+
# Make sure build is being run in a valid module directory with a metadata.json
|
18
|
+
PDK::CLI::Util.ensure_in_module!(
|
19
|
+
message: _("`pdk release #{cmd.name}` can only be run from inside a valid module with a metadata.json."),
|
20
|
+
log_level: :info,
|
21
|
+
)
|
22
|
+
|
23
|
+
opts[:'skip-validation'] = true
|
24
|
+
opts[:'skip-changelog'] = true
|
25
|
+
opts[:'skip-dependency'] = true
|
26
|
+
opts[:'skip-documentation'] = true
|
27
|
+
opts[:'skip-build'] = true
|
28
|
+
opts[:'skip-versionset'] = true
|
29
|
+
opts[:force] = true unless PDK::CLI::Util.interactive?
|
30
|
+
|
31
|
+
Release.prepare_publish_interview(TTY::Prompt.new(help_color: :cyan), opts) unless opts[:force]
|
32
|
+
|
33
|
+
Release.send_analytics("release #{cmd.name}", opts)
|
34
|
+
|
35
|
+
release = PDK::Module::Release.new(nil, opts)
|
36
|
+
|
37
|
+
release.run
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
data/lib/pdk/cli/update.rb
CHANGED
@@ -48,6 +48,18 @@ module PDK::CLI
|
|
48
48
|
|
49
49
|
updater = PDK::Module::Update.new(opts)
|
50
50
|
|
51
|
+
if updater.pinned_to_puppetlabs_template_tag?
|
52
|
+
PDK.logger.info _(
|
53
|
+
'This module is currently pinned to version %{current_version} ' \
|
54
|
+
'of the default template. If you would like to update your ' \
|
55
|
+
'module to the latest version of the template, please run `pdk ' \
|
56
|
+
'update --template-ref %{new_version}`.',
|
57
|
+
) % {
|
58
|
+
current_version: updater.template_uri.uri_fragment,
|
59
|
+
new_version: PDK::TEMPLATE_REF,
|
60
|
+
}
|
61
|
+
end
|
62
|
+
|
51
63
|
updater.run
|
52
64
|
end
|
53
65
|
end
|