{"id":13777830,"url":"https://github.com/puppetlabs/pdksync","last_synced_at":"2025-06-22T19:05:50.709Z","repository":{"id":32462286,"uuid":"126831282","full_name":"puppetlabs/pdksync","owner":"puppetlabs","description":"Manage large sets of modules with automation built on top of PDK","archived":false,"fork":false,"pushed_at":"2025-04-10T14:48:26.000Z","size":532,"stargazers_count":14,"open_issues_count":6,"forks_count":29,"subscribers_count":17,"default_branch":"main","last_synced_at":"2025-05-25T10:03:49.133Z","etag":null,"topics":["git","hacktoberfest","modules","pdk","puppet"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/puppetlabs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-03-26T13:14:43.000Z","updated_at":"2025-04-10T14:48:28.000Z","dependencies_parsed_at":"2023-02-10T06:45:16.302Z","dependency_job_id":"6bfe3a5a-7480-4de7-884a-c3aa3bfe29b9","html_url":"https://github.com/puppetlabs/pdksync","commit_stats":{"total_commits":257,"total_committers":34,"mean_commits":"7.5588235294117645","dds":0.8287937743190661,"last_synced_commit":"1698cbf46521d62587b698f3c3da30287dfdbd62"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/puppetlabs/pdksync","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/puppetlabs%2Fpdksync","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/puppetlabs%2Fpdksync/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/puppetlabs%2Fpdksync/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/puppetlabs%2Fpdksync/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/puppetlabs","download_url":"https://codeload.github.com/puppetlabs/pdksync/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/puppetlabs%2Fpdksync/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261348268,"owners_count":23145305,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["git","hacktoberfest","modules","pdk","puppet"],"created_at":"2024-08-03T18:00:49.124Z","updated_at":"2025-06-22T19:05:45.692Z","avatar_url":"https://github.com/puppetlabs.png","language":"Ruby","funding_links":[],"categories":["Development","Module Management","Modules"],"sub_categories":["Time Series","Modules Management"],"readme":"# Pdksync\n\n[![Code Owners](https://img.shields.io/badge/owners-DevX--team-blue)](https://github.com/puppetlabs/pdksync/blob/main/CODEOWNERS)\n![ci](https://github.com/puppetlabs/pdksync/actions/workflows/ci.yml/badge.svg)\n![GitHub release (latest by date)](https://img.shields.io/github/v/release/puppetlabs/pdksync)\n\nTable of Contents\n-----------------\n\n1. [Overview](#overview)\n2. [Requirements](#requirements)\n3. [Usage](#usage)\n4. [How it works](#how-it-works)\n5. [Configuration](#configuration)\n6. [Workflow](#workflow)\n7. [Migrating from modulesync to pdksync](#migrating-from-modulesync-to-pdksync)\n8. [Contributing](#contributing)\n\n### Overview\n--------\n\nPdksync is an efficient way to run a `pdk update` command against the various Puppet module repositories that you manage — keeping them up-to-date with the changes made to PDK. It is a solution for converted modules that no longer run with modulesync.\n\nPdksync 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.\n\n### Requirements\n--------\n* Ruby \u003e= 2.7\n* Bundler \u003e= 1.15\n* Obtain a forge api access key so that pdksync can access the puppetcore gems.  This key will be referenced below as the `PUPPET_FORGE_TOKEN`.  For more information see [Puppet Documentation](https://www.puppet.com/docs/puppet/8/system_requirements#plan_requirements) and the [dev.to blog](https://dev.to/puppet/lets-get-started-with-puppet-core-3p5j).\n\n### Usage\n----------\n\n\u003e 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.\n\n1. To use pdksync, clone the GitHub repo or install it as a gem. Set up the environment by exporting a GitHub token:\n\n   ```shell\n   export GITHUB_TOKEN=\u003caccess_token\u003e\n   ```\n\n   If you use GitLab instead of GitHub export your GitLab access token:\n\n   ```shell\n   export GITLAB_TOKEN=\u003caccess_token\u003e\n   ```\n\n   Finally, set the `PUPPET_FORGE_TOKEN` environment variable to the forge api access key and the `BUNDLE_RUBYGEMS___PUPPETCORE__PUPPET__COM` to the expected bundler credential so that pdksync can access the puppetcore gems:\n\n   ```shell\n   export PUPPET_FORGE_TOKEN=\u003cAPI access key\u003e\n   export BUNDLE_RUBYGEMS___PUPPETCORE__PUPPET__COM: \"forge-key:${PUPPET_FORGE_TOKEN}\"\n   ```\n\n2. Before the script will run, you need to install the gems:\n```shell\nbundle install --path .bundle/gems/\n```\n3. Once this is complete, call the built-in rake task to run the module:\n```shell\nbundle exec rake pdksync\n```\n\n### Github Token Permissions\n----------\n\nFollow the steps below to set up a Github token with the minimum level of permissions required by `pdksync`:\n\n- Log in to your Github account and navigate to the [Personal Access Tokens](https://github.com/settings/tokens) section under `Settings -\u003e Developer settings`\n- Click [`Generate new token`](https://github.com/settings/tokens/new)\n- Select the check boxes appropriate for your use case below\n\n#### **Public Repos, No Workflow Modifications Permitted**\n\n- [ ] **repo**\n  - [ ] repo:status\n  - [ ] repo_deployment\n  - [x] public_repo\n  - [ ] repo:invite\n  - [ ] security_events\n- [ ] workflow  \n\n#### **Private Repos or Public Repos with Workflow Modifications Permitted**\n\n- [x] **repo**\n  - [x] repo:status\n  - [x] repo_deployment\n  - [x] public_repo\n  - [x] repo:invite\n  - [x] security_events\n- [x] workflow  \n\n### How it works\n------------\n\nPdksync is a gem that works to clone, update, and push module repositories. Create a new git repository to store your working config. You need the following files in there:\n\nRakefile:\n```ruby\nrequire 'pdksync/rake_tasks'\n```\n\nGemfile:\n```ruby\n# frozen_string_literal: true\n\nsource \"https://rubygems.org\"\n\ngit_source(:github) { |repo_name| \"https://github.com/#{repo_name}\" }\n\ngem 'pdksync'\ngem 'rake'\n```\n\nmanaged_modules.yml:\n```yaml\n---\n- repo1\n- repo2\n- repo3\n- repo4\n```\n\npdksync.yml:\n```yaml\n---\nnamespace: 'YOUR GITHUB NAME'\ngit_base_uri: 'git@github.com'\n```\n\n\nRun the following commands to check that everything is working as expected:\n\n```shell\nbundle install --path .bundle/gems/\nbundle exec rake git:clone_managed_modules\n```\n\npdksync 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.\n\n\nIn Workflow 1 we can clone modules, update the gem file, create the commit, push the changes and create the PR using separate rake tasks.\n```shell\nbundle install --path .bundle/gems/\nbundle exec rake git:clone_managed_modules\nbundle exec rake 'pdksync:gem_file_update[]'\nbundle exec rake 'git:create_commit[]'\nbundle exec rake 'git:push'\nbundle exec rake 'git:create_pr[]'\n```\n\nIn Workflow 2 we can clone modules, update the gem file, create the commit, push the changes and create the PR using single rake task\n```\nUsing single rake job\nbundle install --path .bundle/gems/\nbundle exec rake 'gem_testing[]'\n```\n\nIn 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\n```\nUsing single rake job\nbundle install --path .bundle/gems/\nbundle exec rake git:clone_managed_modules\nbundle exec rake 'pdksync:gem_file_update[]'\nbundle exec rake 'pdksync:run_tests_locally[]'\nbundle exec rake 'pdksync:fetch_test_results_locally[]'\n```\n\nOnce the verified gem is released we can use pdksync to update the the new version of gem released in the  .sync.yaml file.\n\npdksync 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.\n\n ```shell\n   export GEMFURY_TOKEN=\u003caccess_token\u003e\n   ```\n\nRun the following commands to check that everything is working as expected:\n\n```shell\nbundle install --path .bundle/gems/\nbundle exec rake -D\nbundle exec rake 'git:clone_gem['gem_name']'\n```\nBelow given are the workflows for doing multi gem testing with pdksync.\n\nIn 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.\n\n```shell\nbundle install --path .bundle/gems/\nbundle exec rake 'git:clone_gem[]'\nbundle exec rake 'pdksync:multi_gem_testing[]'\nbundle exec rake 'pdksync:multigem_file_update[]'\n```\n\nThe 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.\n\nBy 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.\n\nThe following rake tasks are available with pdksync:\n- `pdksync:show_config` Display the current configuration of pdksync\n- `git:clone_managed_modules` Clone managed modules.\n- `git:create_commit[:branch_name, :commit_message]` Stage commits for modules, branchname and commit message eg rake 'git:create_commit[flippity, commit messagez]'.\n- `git:push` Push staged commits eg rake 'git:push'.\n- `git:create_pr[:pr_title, :label]` Create PR for modules. Label is optional eg rake 'git:create_pr[pr title goes here, optional label right here]'.\n- `git:clean[:branch_name]` Clean up origin branches, (branches must include pdksync in their name) eg rake 'git:clean[pdksync_origin_branch]'.\n- `pdksync:pdk_convert` Runs PDK convert against modules.\n- `pdksync:pdk_validate` Runs PDK validate against modules.\n- `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.\n  - `rake pdksync` PR title outputs as `pdksync - pdksync_heads/main-0-gabccfb1`\n  - `rake 'pdksync[MODULES-8231]'` PR title outputs as `pdksync - MODULES-8231 - pdksync_heads/main-0-gabccfb1`\n- `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.\n- `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\n  - 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'\"]'`\n  - eg rake to update sha `pdksync:gem_file_update['puppet_litmus', '', '20ee04ba1234e9e83eb2ffb5056e23d641c7a018', '20ee04ba1234e9e83eb2ffb5056e23d641c7a31']`\n  - eg rake to update version`pdksync:gem_file_update['puppet_litmus', '', '', '', \"= 0.9.0\", \"\u003c= 0.10.0\", '', '']`\n  - eg rake to update branch `pdksync:gem_file_update['puppet_litmus', '', '', '', '', '', 'testbranch', 'testbranches']`\n- `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`\n  - eg rake to perform gem file testing `gem_testing['MODULES-testing', 'puppet_litmus', '', '20ee04ba1234e9e83eb2ffb5056e23d641c7a018', 'testsha']`\n- `pdksync:run_tests_locally[:provision_type, :puppet_collection]` Run litmus modules locally\n  - eg rake 'pdksync:run_tests_locally[\"default\"]'\n- `pdksync:fetch_test_results_locally[]` Fetch litmus modules local run results\n  - eg rake 'pdksync:fetch_test_results_locally[]'\n- `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.\n  - eg rake 'pdksync:run_tests_jenkins[test_branch, '', test_user]'\n- `pdksync:test_results_jenkins[]` Fetch traditional modules jenkins run results\n  - eg rake 'pdksync:test_results_jenkins[jenkins_server_url]'\n- `git:clone_gem[:gem_name]` Clone gem.\n- `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[]'\n- `pdksync:multigem_file_update[:gem_name, :gemfury_username]` Update Gemfile of the modules with the new gem should be pushed to Gemfury.'\n- `pdksync:add_provision_list[:key, :provisioner, :images]` Add a provision list key to provision.yaml.\n- `pdksync:generate_vmpooler_release_checks[:puppet_version]` Generates release checks in provision.yaml based on module compatible platforms and puppet version\n- `pdksync:add_platform_to_metadata[:os, :version]` Add a given OS Version to the metadata\n- `pdksync:remove_platform_from_metadata[:os, :version]` Remove a given OS Version from the metadata\n\n\nYou can run ```bundle exec rake -D``` to view the list of available rake tasks.\n\n### Adding/Updating `provision.yaml`\nTo add/update an entry in the `provision.yaml`, run the following task:\n```ruby\nbundle exec rake pdksync:add_provision_list[:key, :provisioner, :images]\n```\nThe `:images` parameter is a variable in length - everything from the 3rd arg onwards, separated by commas, will be treated as an image.\nFor example:\n```ruby\nbundle 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']\"\n```\nThis will create a new entry (or update an existing entry, if it already exists) in the `provision.yaml`:\n```yaml\nrelease_checks_latest_os:\n    provisioner: abs\n    images:\n    - redhat-8-x86_64\n    - centos-8-x86_64\n    - debian-10-x86_64\n    - sles-15-x86_64\n    - ubuntu-2004-x86_64\n    - win-2019-core-x86_64\n    - win-10-pro-x86_64\n```\n\n### Generating Release Checks Config in `provision.yaml` for Given Puppet Version\nTo generate a release checks configuration that will use VMPooler (via the ABS provisioner) in the `provision.yaml` that satisfies both:\n- The supported platforms of the given Puppet version\n- The supported platforms of the module\n\n...you can run:\n```ruby\npdksync:generate_vmpooler_release_checks[:puppet_version]\n```\n\n#### Step 1: Create Puppet version supported platform config entry\nEnsure 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:\n```yaml\n7:\n  centos: ['7', '8']\n  debian: ['9', '10']\n  oracle: ['7']\n  redhat: ['7', '8']\n  sles: ['12', '15']\n  scientific: ['7']\n  ubuntu: ['18.04', '20.04']\n  win: ['2012r2', '2016-core', '2019-core', '10']\n```\n**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`**\n\nThe 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.\nIf you do not wish to test against `solaris` then simply omit it from the above config.\n\n#### Step 2: Add the config entries to `provision.yaml`\nSay 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:\n```ruby\nbundle exec rake 'pdksync:generate_vmpooler_release_checks[7]'\n```\nThis 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.\n\n### Adding a new platform to `metadata.json`\n\nTo add a new OS or OS version to the `operatingsystem_support` key in the `metadata.json`:\n\n```ruby\nbundle exec rake 'pdksync:add_platform_to_metadata[:os, :version]'\n```\n\nFor example, to add a new OS called 'FooBar OS' and versions `1`, `2` and `3`:\n\n```ruby\nbundle exec rake 'pdksync:add_platform_to_metadata[FooBar,1]'\nbundle exec rake 'pdksync:add_platform_to_metadata[FooBar,2]'\nbundle exec rake 'pdksync:add_platform_to_metadata[FooBar,3]'\n```\n\nTo add a new version (e.g. `22.04`) to an existing entry (e.g. `Ubuntu`):\n\n```ruby\nbundle exec rake 'pdksync:add_platform_to_metadata[Ubuntu,22.04]'\n```\n\n**PLEASE NOTE: All OS names are normalised to the conventions defined in the `normalize_os` method - see below for more details.**\n\n### Removing a platform from `metadata.json`\n\nTo remove a platform version from `metadata.json`:\n\n```ruby\nbundle exec rake 'pdksync:remove_platform_from_metadata[:os, :version]'\n```\n\n**PLEASE NOTE: There is currently a limitation on removing an entire OS if no versions are specified - feel free to enhance with a PR :)**\n\nFor example, to remove version `14.04` from `Ubuntu`:\n\n```ruby\nbundle exec rake 'pdksync:remove_platform_from_metadata[Ubuntu,14.04]'\n```\n\n### Update requirements\n\nTo add / modify a requirement from the `requirements` key of the `metadata.json`:\n\n```ruby\nbundle exec rake 'pdksync:update_requirements[:name, :key, :value]'\n```\n\n**PLEASE NOTE: There is currently a limitation on removing an entire requirement entry - feel free to enhance with a PR :)**\n\nTo update the `puppet` `version_requirement` requirement to `\u003e= 6.0.0 \u003c 8.0.0`:\n\n```ruby\nbundle exec rake 'pdksync:update_requirements[puppet,version_requirement,\u003e= 6.0.0 \u003c 8.0.0]'\n```\n\nTo add a new requirement called `foobar` with a parameter called `baz` which has a value of `123`:\n\n```ruby\nbundle exec rake 'pdksync:update_requirements[foobar,baz,123]'\n```\n\n### Normalize Supported Platforms\n\nTo 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):\n\n```ruby\nbundle exec rake 'pdksync:normalize_metadata_supported_platforms'\n```\n\n### Configuration\n\nBy default pdksync will use hardcoded values for configuring itself. However, if you wish to override these values, create a `pdksync.yml` in your working directory and use the following format:\n```yaml\n---\nnamespace: 'puppetlabs'\npdksync_dir: 'modules_pdksync'\npdksync_gem_dir: 'gems_pdksync',\npush_file_destination: 'origin'\ncreate_pr_against: 'main'\nmanaged_modules: 'managed_modules.yml'\npdksync_label: 'maintenance'\ngit_platform: :github\ngit_base_uri: 'https://github.com'\n# Only used when git_platform is set to :gitlab\ngitlab_api_endpoint: 'https://gitlab.com/api/v4'\n```\n\nYou may override any property. Those that are not specified in your config file will use their corresponding default value from `lib/pdksync/constants.rb`.\n\n#### Git platform support\n\nBy default pdksync assumes you are hosting your Puppet modules on GitHub, and GitHub is the only platform officially supported by Puppetlabs in pdksync.\n\nPdksync also supports the GitLab platform, but without official support by Puppetlabs.\n\n##### GitHub\nGithub.com and Github enterprise both work with octokit which is used in pdksync.  There are some settings\nyou will need to adjust if using the on premise github enterprise edition.\n\n1. `api_endpoint: https://mygithub.mycompany.com/api/v3`\n2. `git_base_uri: git@mygithub.mycompany.com`\n3. `export GITHUB_TOKEN=k3939isdiasdf93i_`  (your token goes here)\n\nTo use GitHub.com you only need to export your GitHub access token as the\nenvironment variable `GITHUB_TOKEN` and configure the namespace in which your\nmodules are hosted in `$HOME/.pdksync.yml` as described above.\n\n##### GitLab\n\nTo use GitLab at `https://gitlab.com` you need to set `git_platform: :gitlab`\nand configure the namespace of your modules in `$HOME/.pdksync.yml`. You also\nneed to export your GitLab access token as the environment variable\n`GITLAB_TOKEN`.\n\nYour `$HOME/.pdksync.yml` then looks like this:\n\n```yaml\n# ~/pdksync.yml\n---\nnamespace: 'acme'\ngit_platform: :gitlab\n```\n\nExport your GitLab access token:\n\n```shell\nexport GITLAB_TOKEN=\u003cyour GitLab access token here\u003e\n```\n\nIf you are running your own GitLab instance on premise or use a GitLab instance\nother than the official one at `https://gitlab.com` you also need to configure\n`git_base_uri` and `api_endpoint` in `$HOME/.pdksync.yml` so that\npdksync knows from where to clone your modules and where to access to GitLab\nAPI to create the live merge requests:\n\n```yaml\n# ~/pdksync.yml\n---\nnamespace: 'puppetmodules'\ngit_platform: :gitlab\ngit_base_uri: 'https://gitlab.example.com'\n# alternatively use SSH:\n#git_base_uri: 'ssh://git@gitlab.example.com:2222'\napi_endpoint: 'https://gitlab.example.com/api/v4'\n```\n\n### Setting who has the authoritive\nIt may be desirable to allow modules to dictate which version of the pdk-templates they should sync with.\nThere 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.\n\n- pdk_templates_prefix: 'nwops-'  (example only, keep as empty string)\n- pdk_templates_ref: 1.12.0\n- pdk_templates_url: https://github.com/puppetlabs/pdk-templates.git\n- module_is_authoritive: true\n\nThe 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.\n\n```json\n# module/metadata.json\n{\n\"pdk-version\": \"1.11.1\",\n\"template-url\": \"https://github.com/puppetlabs/pdk-templates#main\",\n\"template-ref\": \"heads/main-0-gb096033\"\n}\n\n```\n\nWhen `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.\n\nThe other settings dictiate where the templates are located and which branch, tag or reference you want to use.\n`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.\n\nThe 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.\n\nThis strategy works in conjunction with the pdk-template git tags and the workflow looks like:\n  1. git fetch upstream (github.com/puppetlabs/pdk-templates)\n  2. git checkout main \u0026\u0026 git rebase upstream/main\n  3. git checkout -b nwops-1.0.13 nwops-1.0.12\n  4. git rebase 1.0.13\n  5. git push origin nwops-1.0.13\n\n\n### Supporting multiple namespaces\nIf you have multiple namespaces that you need to support you will need to create a pdksync.yml config\nfile for each namespace.  This will allow you to create a folder structure and keep a separate\nmanaged_modules.yml for that namespace too.\n\nYou 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.\n\nexample: `PDKSYNC_CONFIG_PATH=pdksync_ops.yml`\n\nOr 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.\n\nexample: `HOME=ops`\n\n### Logging output\nPdksync uses a logger class to log all output.  You can control how the logger works via a few environment variables.\n\nTo control the level set the `LOG_LEVEL` to one of\n1. info\n2. debug\n3. fatal\n4. error\n5. warn\n\nTo control where the logs are sent (defaults to stdout) set the `PDKSYNC_LOG_FILENAME` to a file path.\n\n### Workflow\n--------\n\nIt currently runs without additional arguments. To alter how it runs, make alterations to either `HOME/.pdksync.yml` or `managed_modules.yml`.\n\n### Managed modules\n----------\n\nThis module runs through a pre-set array of modules, with this array set within the `managed_modules.yml` file. This file makes use of a simple `yaml` style format to set out the different module names, for example:\n\n```yaml\n---\n- puppetlabs-motd\n- puppetlabs-stdlib\n- puppetlabs-mysql\n```\n\nTo add a module, add it to the list. To remove a module, remove it from the list. If you wish to specify a custom managed modules file, use the `managed_modules` property in your configuration file to specify the path to the file.\n\n### Migrating from modulesync to pdksync\n--------\n\nIf your modules are currently managed by modulesync, and you want to use PDK and keep your modules up-to-date, read the following.\n\n#### Terminology\n- `pdk convert` - A command to convert your module, for example, to make it compatible with the PDK.\n- `convert_report.txt` - A report that shows the changes PDK will make to your module when `pdk convert` is ran.\n- `pdk update` - A command to consume any changes that have been made to the pdk-template used to convert the module.\n- `update_report.txt` - A report that shows the changes PDK will make to your module when `pdk update` is ran.\n- `pdk validate` - A command to run basic validation checks on your module.\n- `pdk test unit` - A command to run all available unit tests on your module.\n- `.sync.yml` - A file that lists all of of your module customizations — and will require  work before module conversion.\n\n##### Prerequisites\n* Unit tests are in a good state — with no failures. Check by running `pdk test unit`.\n* The module is in good shape. Check by running `pdk validate`.\n\nWhen you're confident everything is in good shape, you can start converting your module to make it compatible with PDK.\n\n##### Getting started\n\n1) Run `pdk convert --noop`. This will output to the console a high level overview of the changes that PDK is planning to make to your files.\n\n\u003e Note: For an in-depth diff, see the convert_report.txt that is output in the module root directory.\n\n2) Make changes to your .sync.yml. State any configuration that the custom [pdk-templates](https://github.com/puppetlabs/pdk-templates) plan to remove.\n\nUseful commands via the .sync.yml:\n\n- Add additional gem dependencies:\n```yaml\nGemfile:\n  required:\n    ':system_tests':\n      - gem 'octokit'\n        platforms: ruby\n```\n- Make changes to your travis configuration:\n```yaml\n.travis.yml:\n  branches:\n    - release\n```\n- Delete files that you don't want to exist in the repo:\n```yaml\n.gitlab-ci.yml:\n  delete: true\n```\n- Unmanage files that you don't want to be managed:\n```yaml\n.gitlab-ci.yml:\n  unmanaged: true\n```\n\u003e Note: It is unlikely your module will work out of the box.\n\n3) When you are finished customizing your .sync.yml file, run `pdk convert --noop` and confirm the changes that PDK will make when you convert. Changes can be found in the `convert_report.txt`\n\n4) Run `pdk convert` to convert. You will be prompted to pass in Y/N — type Y and all your changes will be applied.\n\n\u003e Note: If you have any concerns it is not too late — type N.\n\n5) Run your unit tests to confirm that nothing has broken. If there are breakages, you might need to require a library or include a missing gem — address this issue before you continue.\n\n6) Run `pdk validate` to ensure there are no failures.\n\n7) Commit the changes that the `pdk convert` has made and create your pull request.\n\n8) Remove your module from being managed via `modulesync`, and start using `pdksync` going forward — no more manually creating pull requests.\n\nFor more information on keeping your module up to date with the PDK check out [Helens blog post](https://puppet.com/blog/guide-converting-module-pdk).\n\n### Compatibility\n----------\n\nThis tool has been developed and tested on OSX and Linux. **It currently does not run on Windows.**\n\n### Contributing\n--------\n\n1. Fork the repo\n2. Create your feature branch:\n```shell\ngit checkout -b my-new-feature\n```\n3. Commit your changes:\n```shell\ngit commit -am 'Add some feature'\n```\n4. Push to the branch:\n```shell\ngit push origin my-new-feature\n```\n5. Create a new pull request\n\n## License\n\nThis codebase is licensed under Apache 2.0. However, the open source dependencies included in this codebase might be subject to other software licenses such as AGPL, GPL2.0, and MIT.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpuppetlabs%2Fpdksync","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpuppetlabs%2Fpdksync","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpuppetlabs%2Fpdksync/lists"}