pdksync 0.5.0 → 0.6.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: db56fccacb1a8fd65ffe4179aaad15fecbcd041b199748f08984dbce2a8d5064
4
- data.tar.gz: 25586423e467cf87fa7986237dd954d1be333bbe343eed24f50653627e90385e
3
+ metadata.gz: fb15750eeb297a36837b502c7d29661a13d19ce65211ce5d63f8a544720b5393
4
+ data.tar.gz: 2ebd4e07bf5ac24a0d918cddc33b56e5e93041f6318aacc7a9ff642e27d5345b
5
5
  SHA512:
6
- metadata.gz: bc7e96689dcba3b6c19c5b3f04be7ce8a89f5ec08de728336d20e688d34dd0676a9e26b3a877e373c7b5f89cec352921e58c13e8b017a91b34cdb4f38129a79e
7
- data.tar.gz: b2866e5751b9528062b907b2d1292c17037aa437d4f2e1bab3d2a63c21a6d459a6f35bb8a1517ad98a8c2022ab09a3434f7c13518130cdec1a4363469af13215
6
+ metadata.gz: 14e2f4b50f71803db6e082a92122ab6aa1daef58636be4fde4edfb7ae9a21a27171c5edd76e012000e96c053c9e4388b7f3585fc0852c218710e852e0a6f2fbc
7
+ data.tar.gz: 69bd6f2f2260078aef909b219a3b468d402889b5393c1f30cad5b836e0d85919ae62991617fe81832963f11c3e4b4fd781af5b5d8b092e78c367546f51a4fac0
data/.gitignore CHANGED
@@ -4,3 +4,4 @@ modules/
4
4
  Gemfile.lock
5
5
  .bundle/
6
6
  modules_pdksync/
7
+ .idea/
data/.rubocop.yml CHANGED
@@ -1,28 +1,31 @@
1
1
  ---
2
2
  AllCops:
3
3
  DisplayCopNames: true
4
- TargetRubyVersion: '2.1'
5
4
  Include:
6
- - "./**/*.rb"
5
+ - "./**/*.rb"
7
6
  Exclude:
8
- - bin/*
9
- - ".vendor/**/*"
10
- - Gemfile
11
- - Rakefile
12
- - pkg/**/*
13
- - spec/fixtures/**/*
14
- - vendor/**/*
15
- - modules_pdksync/**/*
7
+ - bin/*
8
+ - ".vendor/**/*"
9
+ - Gemfile
10
+ - Rakefile
11
+ - pkg/**/*
12
+ - spec/fixtures/**/*
13
+ - vendor/**/*
14
+ - modules_pdksync/**/*
16
15
  Metrics/LineLength:
17
16
  Description: People have wide screens, use them.
18
- Max: 200
17
+ Max: 235
19
18
  Style/BlockDelimiters:
20
- Description: Prefer braces for chaining. Mostly an aesthetical choice. Better to
19
+ Description:
20
+ Prefer braces for chaining. Mostly an aesthetical choice. Better to
21
21
  be consistent then.
22
22
  EnforcedStyle: braces_for_chaining
23
23
  Style/ClassAndModuleChildren:
24
+ Enabled: false
24
25
  Description: Compact style reduces the required amount of indentation.
25
26
  EnforcedStyle: compact
27
+ Exclude:
28
+ - lib/pdksync/configuration.rb
26
29
  Style/EmptyElse:
27
30
  Description: Enforce against empty else clauses, but allow `nil` for clarity.
28
31
  EnforcedStyle: empty
@@ -30,7 +33,8 @@ Style/FormatString:
30
33
  Description: Following the main puppet project's style, prefer the % format format.
31
34
  EnforcedStyle: percent
32
35
  Style/FormatStringToken:
33
- Description: Following the main puppet project's style, prefer the simpler template
36
+ Description:
37
+ Following the main puppet project's style, prefer the simpler template
34
38
  tokens over annotated ones.
35
39
  EnforcedStyle: template
36
40
  Style/Lambda:
@@ -40,12 +44,14 @@ Style/RegexpLiteral:
40
44
  Description: Community preference. See https://github.com/voxpupuli/modulesync_config/issues/168
41
45
  EnforcedStyle: percent_r
42
46
  Style/TernaryParentheses:
43
- Description: Checks for use of parentheses around ternary conditions. Enforce parentheses
47
+ Description:
48
+ Checks for use of parentheses around ternary conditions. Enforce parentheses
44
49
  on complex expressions for better readability, but seriously consider breaking
45
50
  it up.
46
51
  EnforcedStyle: require_parentheses_when_complex
47
52
  Style/TrailingCommaInArguments:
48
- Description: Prefer always trailing comma on multiline argument lists. This makes
53
+ Description:
54
+ Prefer always trailing comma on multiline argument lists. This makes
49
55
  diffs, and re-ordering nicer.
50
56
  EnforcedStyleForMultiline: comma
51
57
  Style/SymbolArray:
@@ -82,3 +88,8 @@ Style/IfUnlessModifier:
82
88
  Enabled: false
83
89
  Style/SymbolProc:
84
90
  Enabled: false
91
+ Style/Documentation:
92
+ Exclude:
93
+ - lib/pdksync/utils.rb
94
+ - lib/pdksync/logger.rb
95
+ - lib/pdksync/configuration.rb
data/.travis.yml CHANGED
@@ -1,27 +1,28 @@
1
- sudo: false
2
- dist: trusty
1
+ ---
2
+ os: linux
3
+ dist: xenial
3
4
  language: ruby
4
5
  cache: bundler
5
6
  before_install:
6
- - bundle -v
7
- - rm -f Gemfile.lock
8
- - gem update --system
9
- - gem --version
10
- - bundle -v
7
+ - bundle -v
11
8
  script:
12
- - bundle exec $CHECK
13
- rvm:
14
- - 2.4.1
15
- matrix:
9
+ - SIMPLECOV=yes bundle exec $CHECK
10
+ jobs:
16
11
  fast_finish: true
17
12
  include:
18
- - env: CHECK='rubocop'
19
- - env: CHECK='rspec spec'
13
+ - env: CHECK='rubocop'
14
+ rvm: 2.5
15
+ - env: CHECK='rspec spec'
16
+ rvm: 2.4
17
+ - env: CHECK='rspec spec'
18
+ rvm: 2.5
19
+ - env: CHECK='rspec spec'
20
+ rvm: 2.7
20
21
  branches:
21
22
  only:
22
- - master
23
- - "/^v\\d/"
24
- - release
23
+ - main
24
+ - "/^v\\d/"
25
+ - release
25
26
  env:
26
27
  global:
27
28
  secure: Hk8cxtIHM6kyRBSmcWWUSXUV50E/yo3MGJf3mPphb3ORUfzqjB8FGZLSn1VCIP81y++U6pZAg8/AkvcDNME0at1wWh/ONiOwYKxAyyVfr0/5/i7a+dIj/9MX2kUT6MBKZXipbln/u5brdwBAHJccFHz7doq30Nd108KE5ucqf0ZbptJyDbpsrIturK9Hx+mde9sYd6MyNlzGJkQOhSL22Zd+ppBSf/GDpk2+yWN171oGwHDPWPE47q4nkIrWjnWy0kLCqxoM0zHIPxPES6lhudso4ofbumnRiHcr7DldReC8Rq1CUe/fhG7udGEdPN26JAREyUeD8MOwo2uQohQluHvjOMx9leF7Sbu+tk5E2bqVz5ofm0bksZUIBahUtGP+REvwVruFOH8RsvO3pQBndDKG11691UY55L9qZNaQ82cNOWbfG1nNuglH0GIpJgdhjvWuGw1he4c18u1fgQGM01xO7JEDIpYHrrjBboD3mL/iXMmvxwg35eIrlkfdgl9DTBWqKOoLi79WpkDajI+2B/ABXW4L/WKWlM041UjAs5/r3jgkbcZz1nZVbU4Wa5r/6RvIfrM/FXnaGuZcwx7VdPBmfyhV4rgM4siyJDdhqudTRsq1+Al9q3MhZcyKQLmad8ShEx+dfG9WRBoayE+piD/9xkfriqdMk5YEjH02grE=
data/CHANGELOG.md CHANGED
@@ -2,6 +2,29 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. 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).
4
4
 
5
+ ## [0.6.0](https://github.com/puppetlabs/pdksync/tree/0.6.0) (2021-08-16)
6
+
7
+ [Full Changelog](https://github.com/puppetlabs/pdksync/compare/0.5.0...0.6.0)
8
+
9
+ ### Added
10
+
11
+ - \(FEAT\) Add tasks for updating supported platforms / requirements [\#142](https://github.com/puppetlabs/pdksync/pull/142) ([sanfrancrisko](https://github.com/sanfrancrisko))
12
+ - Add tasks to add / update entries in module's provision.yaml [\#136](https://github.com/puppetlabs/pdksync/pull/136) ([sanfrancrisko](https://github.com/sanfrancrisko))
13
+ - \(MODULES-10379\) Multi Gem testing [\#128](https://github.com/puppetlabs/pdksync/pull/128) ([sheenaajay](https://github.com/sheenaajay))
14
+ - \(maint\) Add bundler tasks and pdk requirement [\#120](https://github.com/puppetlabs/pdksync/pull/120) ([logicminds](https://github.com/logicminds))
15
+ - \(MODULES-9786\) Using pdksync to update the Gemfile [\#114](https://github.com/puppetlabs/pdksync/pull/114) ([sheenaajay](https://github.com/sheenaajay))
16
+ - Major refactor and new features [\#105](https://github.com/puppetlabs/pdksync/pull/105) ([logicminds](https://github.com/logicminds))
17
+
18
+ ### Fixed
19
+
20
+ - \(GH-148\) Fix logging for pdksync:pdk\_validate task [\#150](https://github.com/puppetlabs/pdksync/pull/150) ([sanfrancrisko](https://github.com/sanfrancrisko))
21
+ - \(MODULES-8440\) Ensure pdksync works on windows [\#133](https://github.com/puppetlabs/pdksync/pull/133) ([michaeltlombardi](https://github.com/michaeltlombardi))
22
+ - \(maint\) fix gemfury upload [\#132](https://github.com/puppetlabs/pdksync/pull/132) ([sheenaajay](https://github.com/sheenaajay))
23
+ - fix gemfury testing upload [\#131](https://github.com/puppetlabs/pdksync/pull/131) ([DavidS](https://github.com/DavidS))
24
+ - \(IAC-354\) Fix Gemfile update [\#130](https://github.com/puppetlabs/pdksync/pull/130) ([sheenaajay](https://github.com/sheenaajay))
25
+ - \(maint\) 27x performance improvement [\#123](https://github.com/puppetlabs/pdksync/pull/123) ([DavidS](https://github.com/DavidS))
26
+ - \(maint\) Add Requirements to README.md and fix travis [\#118](https://github.com/puppetlabs/pdksync/pull/118) ([mihaibuzgau](https://github.com/mihaibuzgau))
27
+
5
28
  ## [0.5.0](https://github.com/puppetlabs/pdksync/tree/0.5.0) (2019-08-21)
6
29
 
7
30
  [Full Changelog](https://github.com/puppetlabs/pdksync/compare/0.4.0...0.5.0)
data/CODEOWNERS ADDED
@@ -0,0 +1,2 @@
1
+ # Setting ownership to the modules team
2
+ * @puppetlabs/modules
data/Gemfile CHANGED
@@ -1,9 +1,13 @@
1
1
  source "https://rubygems.org"
2
2
 
3
- git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
3
+ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
4
4
 
5
5
  # Specify your gem's dependencies in pdksync.gemspec
6
6
  gemspec
7
7
 
8
- gem 'github_changelog_generator', git: 'https://github.com/skywinder/github-changelog-generator', ref: 'master'
8
+ gem 'github_changelog_generator', '~> 1.15'
9
9
  gem 'travis'
10
+
11
+ group :development do
12
+ gem 'rb-readline', require: true
13
+ end
data/README.md CHANGED
@@ -4,12 +4,13 @@ Table of Contents
4
4
  -----------------
5
5
 
6
6
  1. [Overview](#overview)
7
- 2. [Usage](#usage)
8
- 3. [How it works](#how-it-works)
9
- 4. [Configuration](#configuration)
10
- 5. [Workflow](#workflow)
11
- 6. [Migrating from modulesync to pdksync](#migrating-from-modulesync-to-pdksync)
12
- 7. [Contributing](#contributing)
7
+ 2. [Requirements](#requirements)
8
+ 3. [Usage](#usage)
9
+ 4. [How it works](#how-it-works)
10
+ 5. [Configuration](#configuration)
11
+ 6. [Workflow](#workflow)
12
+ 7. [Migrating from modulesync to pdksync](#migrating-from-modulesync-to-pdksync)
13
+ 8. [Contributing](#contributing)
13
14
 
14
15
  ### Overview
15
16
  --------
@@ -18,10 +19,15 @@ Pdksync is an efficient way to run a `pdk update` command against the various Pu
18
19
 
19
20
  Pdksync by default expects that your Puppet module repositories live on GitHub and will behave accordingly. It also supports GitLab as an alternative Git hosting platform.
20
21
 
22
+ ### Requirements
23
+ --------
24
+ * Ruby >= 2.4.4
25
+ * Bundler ~> 1.15
26
+
21
27
  ### Usage
22
28
  ----------
23
29
 
24
- > Note: This tool creates a 'live' pull (merge) request against the master branch of the module it is running against — defined in `managed_modules.yml`. Before running this tool, ensure this file reflects the modules you wish it to run against. Additionally make sure that the Pdksync configuration file `$HOME/.pdksync.yml` sets the correct namespace, Git platform and Git base URI for your modules. See section [Configuration](#configuration) for details.
30
+ > Note: This tool creates a 'live' pull (merge) request against the main branch of the module it is running against — defined in `managed_modules.yml`. Before running this tool, ensure this file reflects the modules you wish it to run against. Additionally make sure that the Pdksync configuration file `$HOME/.pdksync.yml` sets the correct namespace, Git platform and Git base URI for your modules. See section [Configuration](#configuration) for details.
25
31
 
26
32
  1. To use pdksync, clone the GitHub repo or install it as a gem. Set up the environment by exporting a GitHub token:
27
33
 
@@ -78,7 +84,7 @@ pdksync.yml:
78
84
  ```yaml
79
85
  ---
80
86
  namespace: 'YOUR GITHUB NAME'
81
- git_base_uri: 'git@github.com:'
87
+ git_base_uri: 'git@github.com'
82
88
  ```
83
89
 
84
90
 
@@ -86,11 +92,66 @@ Run the following commands to check that everything is working as expected:
86
92
 
87
93
  ```shell
88
94
  bundle install --path .bundle/gems/
89
- bundle exec rake -T
90
95
  bundle exec rake git:clone_managed_modules
91
96
  ```
92
97
 
93
- The rake tasks take in a file, `managed_modules.yml`, stored within the local directory that lists all the repositories that need to be updated. It then clones them, one after another, so that a local copy exists. The `pdk update` command is ran against this local copy, with the subsequent changes being added into a commit on a unique branch. It is then pushed back to the remote master where the local copy was originally cloned. A pull request against master is opened, and pdksync begins to clone the next repository.
98
+ pdksync tool is extended with the feature to update the Gemfile. Puppet provides a lot of useful gems to access and manage their functionality between modules. This functionality will help user to perform gem testing prior to release. User is given new rake tasks to update SHA/Version/Branch/line in the Gemfile. Then the changes can be committed, PR can be created which will run the acceptance tests in the PR. If all the tests are executing successfully then the user can close the PRS and release the gem. Below given are the workflows for doing module gem testing with pdksync.
99
+
100
+
101
+ In Workflow 1 we can clone modules, update the gem file, create the commit, push the changes and create the PR using separate rake tasks.
102
+ ```shell
103
+ bundle install --path .bundle/gems/
104
+ bundle exec rake git:clone_managed_modules
105
+ bundle exec rake 'pdksync:gem_file_update[]'
106
+ bundle exec rake 'git:create_commit[]'
107
+ bundle exec rake 'git:push'
108
+ bundle exec rake 'git:create_pr[]'
109
+ ```
110
+
111
+ In Workflow 2 we can clone modules, update the gem file, create the commit, push the changes and create the PR using single rake task
112
+ ```
113
+ Using single rake job
114
+ bundle install --path .bundle/gems/
115
+ bundle exec rake 'gem_testing[]'
116
+ ```
117
+
118
+ In Workflow 3 we can clone modules, update the gem file, run the tests locally for litmus modules without creating commit,pushing or creating the PR
119
+ ```
120
+ Using single rake job
121
+ bundle install --path .bundle/gems/
122
+ bundle exec rake git:clone_managed_modules
123
+ bundle exec rake 'pdksync:gem_file_update[]'
124
+ bundle exec rake 'pdksync:run_tests_locally[]'
125
+ bundle exec rake 'pdksync:fetch_test_results_locally[]'
126
+ ```
127
+
128
+ Once the verified gem is released we can use pdksync to update the the new version of gem released in the .sync.yaml file.
129
+
130
+ pdksync tool is extended with the feature to perform multi gem testing (`puppet-module-gems`). This functionality will identify the current version and bump the version by one. Then it will build and push the gems to gemfury account. Export the GEMFURY_TOKEN to use this rake task.
131
+
132
+ ```shell
133
+ export GEMFURY_TOKEN=<access_token>
134
+ ```
135
+
136
+ Run the following commands to check that everything is working as expected:
137
+
138
+ ```shell
139
+ bundle install --path .bundle/gems/
140
+ bundle exec rake -T
141
+ bundle exec rake 'git:clone_gem['gem_name']'
142
+ ```
143
+ Below given are the workflows for doing multi gem testing with pdksync.
144
+
145
+ In this workflow we can clone gems, update the version, build the gem, push the changes to gemfury and update the gem file of the required modules with the latest gem updated in the fury. Then we can create PR or run tests locally or run tests through jenkins to verify the module test results.
146
+
147
+ ```shell
148
+ bundle install --path .bundle/gems/
149
+ bundle exec rake 'git:clone_gem[]'
150
+ bundle exec rake 'pdksync:multi_gem_testing[]'
151
+ bundle exec rake 'pdksync:multigem_file_update[]'
152
+ ```
153
+
154
+ The rake tasks take in a file, `managed_modules.yml`, stored within the local directory that lists all the repositories that need to be updated. It then clones them, one after another, so that a local copy exists. The `pdk update` command is ran against this local copy, with the subsequent changes being added into a commit on a unique branch. It is then pushed back to the remote origin — where the local copy was originally cloned. A pull request against main is opened, and pdksync begins to clone the next repository.
94
155
 
95
156
  By default, pdksync will supply a label to a PR (default is 'maintenance'). This can be changed by creating `pdksync.yml` in the local directory and setting the `pdksync_label` key. You must ensure that the label selected exists on the modules that you are applying pdksync to. Should you wish to disable this feature, set `pdksync_label` to an empty string i.e. `''`. Similarly, when supplying a label using the `git:create_pr` rake task, the label must exist on each of the managed modules to run successfully.
96
157
 
@@ -104,9 +165,158 @@ The following rake tasks are available with pdksync:
104
165
  - `pdksync:pdk_convert` Runs PDK convert against modules.
105
166
  - `pdksync:pdk_validate` Runs PDK validate against modules.
106
167
  - `pdksync[:additional_title]` Run full pdksync process, clone repository, pdk update, create pr. Additional information can be added to the title, which will be appended before the reference section.
107
- - `rake pdksync` PR title outputs as `pdksync - pdksync_heads/master-0-gabccfb1`
108
- - `rake 'pdksync[MODULES-8231]'` PR title outputs as `pdksync - MODULES-8231 - pdksync_heads/master-0-gabccfb1`
109
- - `pdksync:run_a_command[:command]` Run a command against modules eg rake 'pdksync:run_a_command[complex command here -f -gx]'
168
+ - `rake pdksync` PR title outputs as `pdksync - pdksync_heads/main-0-gabccfb1`
169
+ - `rake 'pdksync[MODULES-8231]'` PR title outputs as `pdksync - MODULES-8231 - pdksync_heads/main-0-gabccfb1`
170
+ - `pdksync:run_a_command[:command, :option]` Run a command against modules eg rake 'pdksync:run_a_command[complex command here -f -gx, 'background']'. :option is an optional parameter which states to run command in backgroud.
171
+ - `pdksync:gem_file_update[[:gem_to_test, :gem_line, :gem_sha_finder, :gem_sha_replacer, :gem_version_finder, :gem_version_replacer, :gem_branch_finder, :gem_branch_replacer]]` Run gem_file_update against modules
172
+ - eg rake to update gem line `pdksync:gem_file_update['puppet_litmus', "gem 'puppet_litmus'\, git: 'https://github.com/test/puppet_litmus.git'\, branch: 'testbranch'"]'`
173
+ - eg rake to update sha `pdksync:gem_file_update['puppet_litmus', '', '20ee04ba1234e9e83eb2ffb5056e23d641c7a018', '20ee04ba1234e9e83eb2ffb5056e23d641c7a31']`
174
+ - eg rake to update version`pdksync:gem_file_update['puppet_litmus', '', '', '', "= 0.9.0", "<= 0.10.0", '', '']`
175
+ - eg rake to update branch `pdksync:gem_file_update['puppet_litmus', '', '', '', '', '', 'testbranch', 'testbranches']`
176
+ - `rake 'gem_testing[:additional_title, :gem_to_test, :gem_line, :gem_sha_finder, :gem_sha_replacer, :gem_version_finder, :gem_version_replacer, :gem_branch_finder, :gem_branch_replacer]'` Run complete Gem file testing (cloning, gemfileupdate, create commit, create PR)PR title outputs as `pdksync_gemtesting - MODULES-8231 - pdksync_heads/main-0-gabccfb1`
177
+ - eg rake to perform gem file testing `gem_testing['MODULES-testing', 'puppet_litmus', '', '20ee04ba1234e9e83eb2ffb5056e23d641c7a018', 'testsha']`
178
+ - `pdksync:run_tests_locally[:provision_type, :puppet_collection]` Run litmus modules locally
179
+ - eg rake 'pdksync:run_tests_locally["default"]'
180
+ - `pdksync:fetch_test_results_locally[]` Fetch litmus modules local run results
181
+ - eg rake 'pdksync:fetch_test_results_locally[]'
182
+ - `pdksync:run_tests_jenkins[:jenkins_server_url, :github_branch, :test_framework, :github_user]` Run traditional modules on jenkins. For now this rake task works just for test_framework: jenkins.
183
+ - eg rake 'pdksync:run_tests_jenkins[test_branch, '', test_user]'
184
+ - `pdksync:test_results_jenkins[]` Fetch traditional modules jenkins run results
185
+ - eg rake 'pdksync:test_results_jenkins[jenkins_server_url]'
186
+ - `git:clone_gem[:gem_name]` Clone gem.
187
+ - `pdksync:multi_gem_testing[:gem_name, :version_file, :build_gem, :gem_path, :gemfury_username]` Build and Push new gems built to the gemfury account for testing eg rake 'pdksync:multi_gem_testing[]'
188
+ - `pdksync:multigem_file_update[:gem_name, :gemfury_username]` Update Gemfile of the modules with the new gem should be pushed to Gemfury.'
189
+ - `pdksync:add_provision_list[:key, :provisioner, :images]` Add a provision list key to provision.yaml.
190
+ - `pdksync:generate_vmpooler_release_checks[:puppet_version]` Generates release checks in provision.yaml based on module compatible platforms and puppet version
191
+
192
+ ### Adding/Updating `provision.yaml`
193
+ To add/update an entry in the `provision.yaml`, run the following task:
194
+ ```ruby
195
+ bundle exec rake pdksync:add_provision_list[:key, :provisioner, :images]
196
+ ```
197
+ The `:images` parameter is a variable in length - everything from the 3rd arg onwards, separated by commas, will be treated as an image.
198
+ For example:
199
+ ```ruby
200
+ bundle exec rake "pdksync:add_provision_list[release_checks_latest_os, abs, 'redhat-8-x86_64', 'centos-8-x86_64', 'debian-10-x86_64', 'sles-15-x86_64', 'ubuntu-2004-x86_64', 'win-2019-core-x86_64', 'win-10-pro-x86_64']"
201
+ ```
202
+ This will create a new entry (or update an existing entry, if it already exists) in the `provision.yaml`:
203
+ ```yaml
204
+ release_checks_latest_os:
205
+ provisioner: abs
206
+ images:
207
+ - redhat-8-x86_64
208
+ - centos-8-x86_64
209
+ - debian-10-x86_64
210
+ - sles-15-x86_64
211
+ - ubuntu-2004-x86_64
212
+ - win-2019-core-x86_64
213
+ - win-10-pro-x86_64
214
+ ```
215
+
216
+ ### Generating Release Checks Config in `provision.yaml` for Given Puppet Version
217
+ To generate a release checks configuration that will use VMPooler (via the ABS provisioner) in the `provision.yaml` that satisfies both:
218
+ - The supported platforms of the given Puppet version
219
+ - The supported platforms of the module
220
+
221
+ ...you can run:
222
+ ```ruby
223
+ pdksync:generate_vmpooler_release_checks[:puppet_version]
224
+ ```
225
+
226
+ #### Step 1: Create Puppet version supported platform config entry
227
+ Ensure that the there is an entry in the `lib/pdksync/conf/puppet_abs_support_platforms.yaml` config for the Puppet version you wish to add an entry for:
228
+ ```yaml
229
+ 7:
230
+ centos: ['7', '8']
231
+ debian: ['9', '10']
232
+ oracle: ['7']
233
+ redhat: ['7', '8']
234
+ sles: ['12', '15']
235
+ scientific: ['7']
236
+ ubuntu: ['18.04', '20.04']
237
+ win: ['2012r2', '2016-core', '2019-core', '10']
238
+ ```
239
+ **NOTE: Please be aware of the requirements regarding the platform naming and version syntax. Instructions and an explanation are within the `puppet_support_platforms.yaml`**
240
+
241
+ The platforms specified above do not necessarily have to reflect ALL the platforms that Puppet version supports - this is the configuration we wish to test against.
242
+ If you do not wish to test against `solaris` then simply omit it from the above config.
243
+
244
+ #### Step 2: Add the config entries to `provision.yaml`
245
+ Say you want to add a configuration key for Puppet 7 (_and you have ensured the `puppet_support_platforms.yaml` is correct as defined in the step above_), you would run:
246
+ ```ruby
247
+ bundle exec rake 'pdksync:generate_vmpooler_release_checks[7]'
248
+ ```
249
+ This will create a `release_checks_7` entry in the `provision.yaml` of the managed modules cloned down that contains a list of appropriate number of platforms to satisfy the conditions outlined above.
250
+
251
+ ### Adding a new platform to `metadata.json`
252
+
253
+ To add a new OS or OS version to the `operatingsystem_support` key in the `metadata.json`:
254
+
255
+ ```ruby
256
+ bundle exec rake 'pdksync:add_platform_to_metadata[:os, :version]'
257
+ ```
258
+
259
+ For example, to add a new OS called 'FooBar OS' and versions `1`, `2` and `3`:
260
+
261
+ ```ruby
262
+ bundle exec rake 'pdksync:add_platform_to_metadata[FooBar,1]'
263
+ bundle exec rake 'pdksync:add_platform_to_metadata[FooBar,2]'
264
+ bundle exec rake 'pdksync:add_platform_to_metadata[FooBar,3]'
265
+ ```
266
+
267
+ To add a new version (e.g. `22.04`) to an existing entry (e.g. `Ubuntu`):
268
+
269
+ ```ruby
270
+ bundle exec rake 'pdksync:add_platform_to_metadata[Ubuntu,22.04]'
271
+ ```
272
+
273
+ **PLEASE NOTE: All OS names are normalised to the conventions defined in the `normalize_os` method - see below for more details.**
274
+
275
+ ### Removing a platform from `metadata.json`
276
+
277
+ To remove a platform version from `metadata.json`:
278
+
279
+ ```ruby
280
+ bundle exec rake 'pdksync:remove_platform_from_metadata[:os, :version]'
281
+ ```
282
+
283
+ **PLEASE NOTE: There is currently a limitation on removing an entire OS if no versions are specified - feel free to enhance with a PR :)**
284
+
285
+ For example, to remove version `14.04` from `Ubuntu`:
286
+
287
+ ```ruby
288
+ bundle exec rake 'pdksync:remove_platform_from_metadata[Ubuntu,14.04]'
289
+ ```
290
+
291
+ ### Update requirements
292
+
293
+ To add / modify a requirement from the `requirements` key of the `metadata.json`:
294
+
295
+ ```ruby
296
+ bundle exec rake 'pdksync:update_requirements[:name, :key, :value]'
297
+ ```
298
+
299
+ **PLEASE NOTE: There is currently a limitation on removing an entire requirement entry - feel free to enhance with a PR :)**
300
+
301
+ To update the `puppet` `version_requirement` requirement to `>= 6.0.0 < 8.0.0`:
302
+
303
+ ```ruby
304
+ bundle exec rake 'pdksync:update_requirements[puppet,version_requirement,>= 6.0.0 < 8.0.0]'
305
+ ```
306
+
307
+ To add a new requirement called `foobar` with a parameter called `baz` which has a value of `123`:
308
+
309
+ ```ruby
310
+ bundle exec rake 'pdksync:update_requirements[foobar,baz,123]'
311
+ ```
312
+
313
+ ### Normalize Supported Platforms
314
+
315
+ To normalize the platforms and versions (Windows only) defined in the `operatingsystem_support` key of the `metadata.json` based on [these rules](https://github.com/puppetlabs/pdksync/blob/ebb84d81d2c15115f896995043eac6d666a114a0/lib/pdksync/utils.rb#L1043-L1098):
316
+
317
+ ```ruby
318
+ bundle exec rake 'pdksync:normalize_metadata_supported_platforms'
319
+ ```
110
320
 
111
321
  ### Configuration
112
322
 
@@ -115,8 +325,9 @@ By default pdksync will use hardcoded values for configuring itself. However, if
115
325
  ---
116
326
  namespace: 'puppetlabs'
117
327
  pdksync_dir: 'modules_pdksync'
328
+ pdksync_gem_dir: 'gems_pdksync',
118
329
  push_file_destination: 'origin'
119
- create_pr_against: 'master'
330
+ create_pr_against: 'main'
120
331
  managed_modules: 'managed_modules.yml'
121
332
  pdksync_label: 'maintenance'
122
333
  git_platform: :github
@@ -134,8 +345,14 @@ By default pdksync assumes you are hosting your Puppet modules on GitHub, and Gi
134
345
  Pdksync also supports the GitLab platform, but without official support by Puppetlabs.
135
346
 
136
347
  ##### GitHub
348
+ Github.com and Github enterprise both work with octokit which is used in pdksync. There are some settings
349
+ you will need to adjust if using the on premise github enterprise edition.
350
+
351
+ 1. `api_endpoint: https://mygithub.mycompany.com/api/v3`
352
+ 2. `git_base_uri: git@mygithub.mycompany.com`
353
+ 3. `export GITHUB_TOKEN=k3939isdiasdf93i_` (your token goes here)
137
354
 
138
- To use GitHub you only need to export your GitHub access token as the
355
+ To use GitHub.com you only need to export your GitHub access token as the
139
356
  environment variable `GITHUB_TOKEN` and configure the namespace in which your
140
357
  modules are hosted in `$HOME/.pdksync.yml` as described above.
141
358
 
@@ -163,7 +380,7 @@ export GITLAB_TOKEN=<your GitLab access token here>
163
380
 
164
381
  If you are running your own GitLab instance on premise or use a GitLab instance
165
382
  other than the official one at `https://gitlab.com` you also need to configure
166
- `git_base_uri` and `gitlab_api_endpoint` in `$HOME/.pdksync.yml` so that
383
+ `git_base_uri` and `api_endpoint` in `$HOME/.pdksync.yml` so that
167
384
  pdksync knows from where to clone your modules and where to access to GitLab
168
385
  API to create the live merge requests:
169
386
 
@@ -175,9 +392,70 @@ git_platform: :gitlab
175
392
  git_base_uri: 'https://gitlab.example.com'
176
393
  # alternatively use SSH:
177
394
  #git_base_uri: 'ssh://git@gitlab.example.com:2222'
178
- gitlab_api_endpoint: 'https://gitlab.example.com/api/v4'
395
+ api_endpoint: 'https://gitlab.example.com/api/v4'
396
+ ```
397
+
398
+ ### Setting who has the authoritive
399
+ It may be desirable to allow modules to dictate which version of the pdk-templates they should sync with.
400
+ There are a few settings you can tune to allow for this kind of flexability. These settings are in the pdksync.yml file. All of these settings are optional and have sane defaults. See `rake pdksync:show_config` for the settings that will be used.
401
+
402
+ - pdk_templates_prefix: 'nwops-' (example only, keep as empty string)
403
+ - pdk_templates_ref: 1.12.0
404
+ - pdk_templates_url: https://github.com/puppetlabs/pdk-templates.git
405
+ - module_is_authoritive: true
406
+
407
+ The first setting is `module_is_authoritive`. When this is set to true the templates and ref specified in the metadata become the authoritive source for these settings. Even if you have pdk_templates_ref and pdk_templates_url specified in pdksync.yml the metadata settings will alwasys be used.
408
+
409
+ ```json
410
+ # module/metadata.json
411
+ {
412
+ "pdk-version": "1.11.1",
413
+ "template-url": "https://github.com/puppetlabs/pdk-templates#main",
414
+ "template-ref": "heads/main-0-gb096033"
415
+ }
416
+
179
417
  ```
180
418
 
419
+ When `module_is_authoritive` is set to false the pdk_templates_ref and pdk_templates_url will override what is found in the modules's metadata.json file. This is very useful when you have to control pdk-template upgrades on modules.
420
+
421
+ The other settings dictiate where the templates are located and which branch, tag or reference you want to use.
422
+ `pdk_templates_ref: 'main'` and `pdk_templates_url: https://github.com/puppetlabs/pdk-templates.git`. These settings will only be utilized if module_is_authoritive is set to false. However, if you are performing a conversion via pdksync these settings will also be used since the metadata in the module being converted doesn't have pdk settings yet.
423
+
424
+ The last setting `pdk_templates_prefix` is a special use case that allows folks with internal forks of pdk-templates to keep branches of the pdk-template tags with additional custom changes. Setting this to an empty string disables this. You will most likely need to resolve conflicts with this workflow, so it is not for everyone. If you know of a better way please submmit a pull request.
425
+
426
+ This strategy works in conjunction with the pdk-template git tags and the workflow looks like:
427
+ 1. git fetch upstream (github.com/puppetlabs/pdk-templates)
428
+ 2. git checkout main && git rebase upstream/main
429
+ 3. git checkout -b nwops-1.0.13 nwops-1.0.12
430
+ 4. git rebase 1.0.13
431
+ 5. git push origin nwops-1.0.13
432
+
433
+
434
+ ### Supporting multiple namespaces
435
+ If you have multiple namespaces that you need to support you will need to create a pdksync.yml config
436
+ file for each namespace. This will allow you to create a folder structure and keep a separate
437
+ managed_modules.yml for that namespace too.
438
+
439
+ You can set a PDKSYNC_CONFIG_PATH environment variable that points to the specific pdksync.yml config file for use in a CI or on the CLI. This allows you to set custom names for pdksync.yml file.
440
+
441
+ example: `PDKSYNC_CONFIG_PATH=pdksync_ops.yml`
442
+
443
+ Or you can set a different HOME environment variable that tells pdksync where to find the pdksync.yml file. Pdksync will locate the pdksync.yml file in the HOME folder you specify. The config file name is not changable in this case.
444
+
445
+ example: `HOME=ops`
446
+
447
+ ### Logging output
448
+ Pdksync uses a logger class to log all output. You can control how the logger works via a few environment variables.
449
+
450
+ To control the level set the `LOG_LEVEL` to one of
451
+ 1. info
452
+ 2. debug
453
+ 3. fatal
454
+ 4. error
455
+ 5. warn
456
+
457
+ To control where the logs are sent (defaults to stdout) set the `PDKSYNC_LOG_FILENAME` to a file path.
458
+
181
459
  ### Workflow
182
460
  --------
183
461