pdk 2.0.0 → 2.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7b0614fb53065a8c2545ffe2bf3839b9d30aaef65d3b9827635ceb5f24d0181e
4
- data.tar.gz: b582b1d8c5622fd2bbbe7facc1676a2c4d2d4c50729b2156667a96eb6bcc73e4
3
+ metadata.gz: 7108ed8889a1ee93bf944b2a35cc1bd527fee723ab8466126e293d621bb033d9
4
+ data.tar.gz: d823aa9385c7f1d0daf86f31a8f338706562aa1df67fe049fa9e393f609d046d
5
5
  SHA512:
6
- metadata.gz: a09558ee0700783e650c8506ee291c768b89567f7c063763652a449c50544e9f31b95173918f8c553bd120742232d542b897c8eaccd23e8153702b7c75609582
7
- data.tar.gz: e93a741e535ffe7bd3f9929cc7464891d0a9bbb04d13e5c4e9faf3ff2fd03434a2e127d7a62be06ad64479994198b0427e172ab9df496d48ce79b8f189079a2f
6
+ metadata.gz: 4a65547c79720dfb12c74c7392844d06dc2e094e97c1812459aa8e055ffb865fea41c6304286dae180600f7182a62b96b7ae1ec295d62e6f09fbb7b3872992c7
7
+ data.tar.gz: 6b3fc743d50509f50e672f397f9de2e27c62c6807870f2daa4f21c4ea88536934adf2dadcac10cd83c9aa9348d49434a239602f9917e6b957479241ab00d5e1e
data/CHANGELOG.md CHANGED
@@ -4,6 +4,58 @@ 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
+ ## [v2.3.0](https://github.com/puppetlabs/pdk/tree/v2.3.0) (2021-10-21)
8
+
9
+ [Full Changelog](https://github.com/puppetlabs/pdk/compare/v2.2.0...v2.3.0)
10
+
11
+ **Merged pull requests:**
12
+
13
+ - Account for Psych API changes [\#1147](https://github.com/puppetlabs/pdk/pull/1147) ([binford2k](https://github.com/binford2k))
14
+
15
+ ## [v2.2.0](https://github.com/puppetlabs/pdk/tree/v2.2.0) (2021-08-02)
16
+
17
+ [Full Changelog](https://github.com/puppetlabs/pdk/compare/v2.1.1...v2.2.0)
18
+
19
+ **Implemented enhancements:**
20
+
21
+ - \(GH-1118\) Add ability to skip validating files [\#1114](https://github.com/puppetlabs/pdk/pull/1114) ([jpogran](https://github.com/jpogran))
22
+
23
+ **Fixed bugs:**
24
+
25
+ - \(GH-1113\) \(GH-917\) Fix forge-token handling [\#1121](https://github.com/puppetlabs/pdk/pull/1121) ([sanfrancrisko](https://github.com/sanfrancrisko))
26
+
27
+ **Merged pull requests:**
28
+
29
+ - \(PDK-1729\) version to 2.2.0.pre2 [\#1106](https://github.com/puppetlabs/pdk/pull/1106) ([da-ar](https://github.com/da-ar))
30
+
31
+ ## [v2.1.1](https://github.com/puppetlabs/pdk/tree/v2.1.1) (2021-06-22)
32
+
33
+ [Full Changelog](https://github.com/puppetlabs/pdk/compare/v2.1.0...v2.1.1)
34
+
35
+ **Fixed bugs:**
36
+
37
+ - \(PDK-1085\) Fail gracefully when no unit tests available [\#1096](https://github.com/puppetlabs/pdk/pull/1096) ([sanfrancrisko](https://github.com/sanfrancrisko))
38
+ - \(GH-1090\) Verify the changelog top most version matches the metadata version [\#1088](https://github.com/puppetlabs/pdk/pull/1088) ([carabasdaniel](https://github.com/carabasdaniel))
39
+ - \(GH-1083\) Bump childprocess to '~\> 4.0.0'; Disable @process.leader [\#1084](https://github.com/puppetlabs/pdk/pull/1084) ([sanfrancrisko](https://github.com/sanfrancrisko))
40
+
41
+ **Merged pull requests:**
42
+
43
+ - \(PDK-1041\) Use diff-lcs 1.4.4 [\#1091](https://github.com/puppetlabs/pdk/pull/1091) ([da-ar](https://github.com/da-ar))
44
+ - Update CODEOWNERS [\#1082](https://github.com/puppetlabs/pdk/pull/1082) ([jpogran](https://github.com/jpogran))
45
+
46
+ ## [v2.1.0](https://github.com/puppetlabs/pdk/tree/v2.1.0) (2021-04-06)
47
+
48
+ [Full Changelog](https://github.com/puppetlabs/pdk/compare/v2.0.0...v2.1.0)
49
+
50
+ **Merged pull requests:**
51
+
52
+ - \(maint\) Mark stale issues [\#1028](https://github.com/puppetlabs/pdk/pull/1028) ([jpogran](https://github.com/jpogran))
53
+ - \(PF-2332\) Add `pdk env` subcommand [\#957](https://github.com/puppetlabs/pdk/pull/957) ([nkanderson](https://github.com/nkanderson))
54
+ - Docs: Install on macOS with brew [\#954](https://github.com/puppetlabs/pdk/pull/954) ([rwaffen](https://github.com/rwaffen))
55
+ - \(MAINT\) Bump version to 2.1.0.pre [\#952](https://github.com/puppetlabs/pdk/pull/952) ([scotje](https://github.com/scotje))
56
+ - \(MAINT\) Fixup some superfluous entries in the 2.0.0 release notes [\#951](https://github.com/puppetlabs/pdk/pull/951) ([scotje](https://github.com/scotje))
57
+ - \(Docs\) Update version number in welcome page [\#950](https://github.com/puppetlabs/pdk/pull/950) ([hestonhoffman](https://github.com/hestonhoffman))
58
+ - \(Docs\) Release notes edits [\#949](https://github.com/puppetlabs/pdk/pull/949) ([hestonhoffman](https://github.com/hestonhoffman))
7
59
  ## [v2.0.0](https://github.com/puppetlabs/pdk/tree/v2.0.0) (2021-02-24)
8
60
 
9
61
  [Full Changelog](https://github.com/puppetlabs/pdk/compare/v1.18.1...v2.0.0)
@@ -58,7 +110,6 @@ See the [release notes](https://puppet.com/docs/pdk/latest/release_notes.html) f
58
110
  - Warning from libhoney when running unit test with PDK 1.17 [\#875](https://github.com/puppetlabs/pdk/issues/875)
59
111
  - 'pdk convert' of a module that's inside a control repo adds boilerplate to the control repo [\#874](https://github.com/puppetlabs/pdk/issues/874)
60
112
  - GemNotFound error for public\_suffix-3.1.1 when using --add-tests [\#869](https://github.com/puppetlabs/pdk/issues/869)
61
- - Scrollback of failed rspec tests in VS code is extremely limited [\#829](https://github.com/puppetlabs/pdk/issues/829)
62
113
  - Running individual rspec tests on Windows requires escaping the path [\#828](https://github.com/puppetlabs/pdk/issues/828)
63
114
  - Generated descriptions for certain test comparisons break JUnit output [\#821](https://github.com/puppetlabs/pdk/issues/821)
64
115
  - Fix PDK release command module validation [\#880](https://github.com/puppetlabs/pdk/pull/880) ([carabasdaniel](https://github.com/carabasdaniel))
@@ -0,0 +1,52 @@
1
+ module PDK::CLI
2
+ @env_cmd = @base_cmd.define_command do
3
+ name 'env'
4
+ usage _('env')
5
+ summary _('(Experimental) Output environment variables for specific Puppet context')
6
+ description _(<<-EOF
7
+ [experimental] Aids in setting a CLI context for a specified version of Puppet by outputting export commands for necessary environment variables.
8
+ EOF
9
+ )
10
+
11
+ PDK::CLI.puppet_version_options(self)
12
+ PDK::CLI.puppet_dev_option(self)
13
+
14
+ run do |opts, _args, _cmd|
15
+ require 'pdk/util'
16
+ require 'pdk/util/ruby_version'
17
+
18
+ PDK::CLI::Util.validate_puppet_version_opts(opts)
19
+
20
+ PDK::CLI::Util.analytics_screen_view('env')
21
+
22
+ # Ensure that the correct Ruby is activated before running command.
23
+ puppet_env = PDK::CLI::Util.puppet_from_opts_or_env(opts)
24
+ PDK::Util::RubyVersion.use(puppet_env[:ruby_version])
25
+
26
+ resolved_env = {
27
+ 'PDK_RESOLVED_PUPPET_VERSION' => puppet_env[:gemset][:puppet],
28
+ 'PDK_RESOLVED_RUBY_VERSION' => puppet_env[:ruby_version],
29
+ }
30
+
31
+ resolved_env['GEM_HOME'] = PDK::Util::RubyVersion.gem_home
32
+ gem_path = PDK::Util::RubyVersion.gem_path
33
+ resolved_env['GEM_PATH'] = gem_path.empty? ? resolved_env['GEM_HOME'] : gem_path
34
+
35
+ # Make sure invocation of Ruby prefers our private installation.
36
+ package_binpath = PDK::Util.package_install? ? File.join(PDK::Util.pdk_package_basedir, 'bin') : nil
37
+
38
+ resolved_env['PATH'] = [
39
+ PDK::Util::RubyVersion.bin_path,
40
+ File.join(resolved_env['GEM_HOME'], 'bin'),
41
+ PDK::Util::RubyVersion.gem_paths_raw.map { |gem_path_raw| File.join(gem_path_raw, 'bin') },
42
+ package_binpath,
43
+ PDK::Util::Env['PATH'],
44
+ ].compact.flatten.join(File::PATH_SEPARATOR)
45
+
46
+ resolved_env.each do |var, val|
47
+ puts "export #{var}=\"#{val}\""
48
+ end
49
+ exit 0
50
+ end
51
+ end
52
+ end
@@ -27,7 +27,17 @@ module PDK
27
27
  @argv = argv
28
28
 
29
29
  @process = ChildProcess.build(*@argv)
30
- @process.leader = true
30
+ # https://github.com/puppetlabs/pdk/issues/1083:
31
+ # When @process.leader is set, childprocess will set the CREATE_BREAKAWAY_FROM_JOB
32
+ # and JOB_OBJECT_LIMIT_BREAKAWAY_OK flags in the Win32 API calls. This will cause
33
+ # issues on systems > Windows 7 / Server 2008, if the JOB_OBJECT_LIMIT_BREAKAWAY_OK
34
+ # flag is set and the Task Scheduler is trying to kick off a job, it can sometimes
35
+ # result in ACCESS_DENIED being returned by the Win32 API, depending on the permission
36
+ # levels / user account this user.
37
+ # The resolution for pdk/issues/1083 is to ensure @process.leader is not set.
38
+ # This will potentially cause issues on older Windows systems, in which case we may
39
+ # need to revisit and conditionally set this param depending on what OS we're on
40
+ # @process.leader = true
31
41
 
32
42
  @stdout = Tempfile.new('stdout', mode: TEMPFILE_MODE).tap { |io| io.sync = true }
33
43
  @stderr = Tempfile.new('stderr', mode: TEMPFILE_MODE).tap { |io| io.sync = true }
@@ -22,7 +22,8 @@ module PDK::CLI
22
22
  option nil, :'forge-upload-url', _('Set forge upload url path.'),
23
23
  argument: :required, default: 'https://forgeapi.puppetlabs.com/v3/releases'
24
24
 
25
- option nil, :'forge-token', _('Set Forge API token.'), argument: :required, default: nil
25
+ option nil, :'forge-token', _('Set Forge API token.'),
26
+ argument: :optional
26
27
 
27
28
  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
29
  argument: :required
@@ -145,6 +146,7 @@ module PDK::CLI
145
146
  opts[:'skip-changelog'] = !answers['changelog']
146
147
  opts[:'skip-dependency'] = !answers['dependency']
147
148
  opts[:'skip-documentation'] = !answers['documentation']
149
+ opts[:'skip-publish'] = !answers['publish']
148
150
 
149
151
  prepare_version_interview(prompt, opts) if answers['setversion']
150
152
 
data/lib/pdk/cli.rb CHANGED
@@ -159,6 +159,7 @@ module PDK::CLI
159
159
  require 'pdk/cli/build'
160
160
  require 'pdk/cli/config'
161
161
  require 'pdk/cli/convert'
162
+ require 'pdk/cli/env'
162
163
  require 'pdk/cli/get'
163
164
  require 'pdk/cli/new'
164
165
  require 'pdk/cli/set'
@@ -13,7 +13,11 @@ module PDK
13
13
 
14
14
  require 'yaml'
15
15
 
16
- data = ::YAML.safe_load(data, [Symbol], [], true)
16
+ data = if Gem::Version.new(Psych::VERSION) >= Gem::Version.new('3.1.0.pre1')
17
+ ::YAML.safe_load(data, permitted_classes: [Symbol], permitted_symbols: [], aliases: true)
18
+ else
19
+ ::YAML.safe_load(data, [Symbol], [], true)
20
+ end
17
21
  return if data.nil?
18
22
 
19
23
  data.each { |k, v| yield k, PDK::Config::Setting.new(k, self, v) }
data/lib/pdk/config.rb CHANGED
@@ -94,6 +94,12 @@ module PDK
94
94
  if context.is_a?(PDK::Context::ControlRepo)
95
95
  mount :environment, PDK::ControlRepo.environment_conf_as_config(File.join(context.root_path, 'environment.conf'))
96
96
  end
97
+
98
+ mount :validate, PDK::Config::YAML.new('validate', file: File.join(context.root_path, 'pdk.yaml'), persistent_defaults: true) do
99
+ setting 'ignore' do
100
+ default_to { [] }
101
+ end
102
+ end
97
103
  end
98
104
  end
99
105
 
@@ -65,6 +65,12 @@ module PDK
65
65
 
66
66
  # Update the changelog with the correct version
67
67
  PDK::Util::ChangelogGenerator.generate_changelog unless skip_changelog?
68
+
69
+ # Check if the versions match
70
+ latest_version = PDK::Util::ChangelogGenerator.latest_version
71
+ unless latest_version
72
+ raise PDK::CLI::ExitWithError, _('%{new_version} does not match %{latest_version}') % { new_version: new_version, latest_version: latest_version } if new_version != latest_version
73
+ end
68
74
  end
69
75
 
70
76
  run_documentation(options) unless skip_documentation?
@@ -110,6 +110,19 @@ module PDK
110
110
  version.join('.')
111
111
  end
112
112
 
113
+ # Returns the top most version from the CHANGELOG file
114
+ def self.latest_version
115
+ latest = nil
116
+ changelog_content.each_line do |line|
117
+ line.strip!
118
+ if line.start_with?('## [')
119
+ latest = line[line.index('[') + 1..line.index(']') - 1].delete('v')
120
+ break # stops after the top version is extracted
121
+ end
122
+ end
123
+ latest
124
+ end
125
+
113
126
  def self.changelog_file
114
127
  # Default Changelog file is CHANGELOG.md, but also search for the .MD prefix as well.
115
128
  @changelog_file ||= ['CHANGELOG.md', 'CHANGELOG.MD'].map { |file| PDK::Util::Filesystem.expand_path(file) }.find { |path| PDK::Util::Filesystem.file?(path) }
@@ -39,6 +39,7 @@ module PDK
39
39
  end
40
40
  end
41
41
 
42
+ return [] if @objects.nil?
42
43
  @objects = @objects.compact
43
44
  end
44
45
 
@@ -213,6 +213,14 @@ module PDK
213
213
  end
214
214
  end
215
215
 
216
+ # block will always be [] because it is intialized in config
217
+ ignore_files = PDK.config.get_within_scopes('validate.ignore')
218
+ unless ignore_files.nil? || ignore_files.empty?
219
+ Array(ignore_files).each do |pattern|
220
+ ignore_pathspec.add(pattern)
221
+ end
222
+ end
223
+
216
224
  ignore_pathspec
217
225
  end
218
226
  end
data/lib/pdk/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module PDK
2
- VERSION = '2.0.0'.freeze
3
- TEMPLATE_REF = VERSION
2
+ VERSION = '2.3.0'.freeze
3
+ TEMPLATE_REF = '2.3.0'.freeze
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet, Inc.
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-02-25 00:00:00.000000000 Z
11
+ date: 2021-10-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -36,14 +36,14 @@ dependencies:
36
36
  requirements:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: 0.7.1
39
+ version: 4.0.0
40
40
  type: :runtime
41
41
  prerelease: false
42
42
  version_requirements: !ruby/object:Gem::Requirement
43
43
  requirements:
44
44
  - - "~>"
45
45
  - !ruby/object:Gem::Version
46
- version: 0.7.1
46
+ version: 4.0.0
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: cri
49
49
  requirement: !ruby/object:Gem::Requirement
@@ -62,16 +62,22 @@ dependencies:
62
62
  name: diff-lcs
63
63
  requirement: !ruby/object:Gem::Requirement
64
64
  requirements:
65
- - - '='
65
+ - - ">="
66
66
  - !ruby/object:Gem::Version
67
- version: '1.3'
67
+ version: 1.4.4
68
+ - - "<"
69
+ - !ruby/object:Gem::Version
70
+ version: '1.5'
68
71
  type: :runtime
69
72
  prerelease: false
70
73
  version_requirements: !ruby/object:Gem::Requirement
71
74
  requirements:
72
- - - '='
75
+ - - ">="
76
+ - !ruby/object:Gem::Version
77
+ version: 1.4.4
78
+ - - "<"
73
79
  - !ruby/object:Gem::Version
74
- version: '1.3'
80
+ version: '1.5'
75
81
  - !ruby/object:Gem::Dependency
76
82
  name: ffi
77
83
  requirement: !ruby/object:Gem::Requirement
@@ -112,14 +118,14 @@ dependencies:
112
118
  requirements:
113
119
  - - '='
114
120
  - !ruby/object:Gem::Version
115
- version: 1.3.0
121
+ version: 2.0.0
116
122
  type: :runtime
117
123
  prerelease: false
118
124
  version_requirements: !ruby/object:Gem::Requirement
119
125
  requirements:
120
126
  - - '='
121
127
  - !ruby/object:Gem::Version
122
- version: 1.3.0
128
+ version: 2.0.0
123
129
  - !ruby/object:Gem::Dependency
124
130
  name: json-schema
125
131
  requirement: !ruby/object:Gem::Requirement
@@ -306,6 +312,7 @@ files:
306
312
  - lib/pdk/cli/config/get.rb
307
313
  - lib/pdk/cli/console.rb
308
314
  - lib/pdk/cli/convert.rb
315
+ - lib/pdk/cli/env.rb
309
316
  - lib/pdk/cli/errors.rb
310
317
  - lib/pdk/cli/exec.rb
311
318
  - lib/pdk/cli/exec/command.rb
@@ -441,7 +448,7 @@ files:
441
448
  homepage: https://github.com/puppetlabs/pdk
442
449
  licenses: []
443
450
  metadata: {}
444
- post_install_message:
451
+ post_install_message:
445
452
  rdoc_options: []
446
453
  require_paths:
447
454
  - lib
@@ -456,9 +463,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
456
463
  - !ruby/object:Gem::Version
457
464
  version: '0'
458
465
  requirements: []
459
- rubyforge_project:
466
+ rubyforge_project:
460
467
  rubygems_version: 2.7.6.2
461
- signing_key:
468
+ signing_key:
462
469
  specification_version: 4
463
470
  summary: A key part of the Puppet Development Kit, the shortest path to better modules
464
471
  test_files: []