Skip to content

Add PuppetCore gem source support to module_ci workflow #129

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 1, 2025
Merged

Conversation

gavindidrichsen
Copy link
Contributor

@gavindidrichsen gavindidrichsen commented Mar 27, 2025

Overview

This PR enhances the module_ci reusable workflow to support the PuppetCore private gem source. This allows modules using this workflow to access private Puppet gems when needed.

Changes

  • Added input parameters to configure:
    • Ruby version (default 2.7)
    • PuppetCore API type (default forge-key)
  • Added environment configuration for PuppetCore authentication using PUPPET_FORGE_TOKEN. This "secret" is then in turn used to set the BUNDLE_RUBYGEMS___PUPPETCORE__PUPPET__COM which enables authenticated access to the puppetcore gems

ALSO added a how to document for consumers of this re-usable module, see docs/how-to/how_to_using_module_ci_workflow_with_puppetcore_gems.md

Impact

  • Modules using this workflow can now access private Puppet gems when authorized
  • Consuming workflows need to:
    • Set a valid PUPPET_FORGE_TOKEN secret on their repository
    • Set ruby_version >= 3.1 when using PuppetCore (bundle install will fail with Ruby 2.7)
  • No breaking changes expected as all new parameters have sensible defaults and the new module_ci.yml has been verified with both a puppetcore enabled module https://github.com/puppetlabs/provision and a non-puppetcore one https://github.com/puppetlabs/puppetlabs-apache. See in the comments below for proof of testing.

- Add ruby_version input parameter with default of '2.7'
- Add puppetcore_api_type input parameter with default of 'forge-key'
- Configure environment variables for Puppet Core authentication
- Update ruby-version in workflow to use the input parameter
- Add documentation on requirements for enabling PuppetCore

Signed-off-by: Gavin Didrichsen <[email protected]>
@gavindidrichsen gavindidrichsen changed the title Enable puppetcore common module testing Add PuppetCore gem source support to module_ci workflow Mar 31, 2025
@gavindidrichsen
Copy link
Contributor Author

gavindidrichsen commented Mar 31, 2025

Verification using a puppetcore repository

This provision PR introduces puppetcore and re-uses the new shared module_ci.yml. Notice that:

  • the new puppetcore gem source is being successfull referenced on the new module_ci.yml, e.g.,
image
  • the provision's PR includes a spec/integration/puppetcore_spec.rb that only passes if the puppetcore authentication has succeeded. This further verifies that the new module_ci.yml is working as expected.

The main advantage of this change to the module_ci.yml is that consuming repositories only need to set the PUPPET_FORGE_TOKEN defined as a secret.

Verification using a non-puppetcore repository

Further, this module_ci.yml has been designed to continue working with non-puppetcore modules. For example, an existing

image

Signed-off-by: Gavin Didrichsen <[email protected]>
Signed-off-by: Gavin Didrichsen <[email protected]>
@gavindidrichsen gavindidrichsen marked this pull request as ready for review March 31, 2025 15:28
@gavindidrichsen gavindidrichsen requested review from a team as code owners March 31, 2025 15:28
gavindidrichsen added a commit to puppetlabs/provision that referenced this pull request Mar 31, 2025
One of the cat-github-actions re-usable workflows has been updated to switch on the puppetcore.  For reference see <puppetlabs/cat-github-actions#129>.  This means a minor admustment is required on any modules that also need to run against puppetcore.  One, `ruby_version` must be passed in and be >= 3.1; and two, the `PUPPET_FORGE_TOKEN` must be a secret on the repository.

Signed-off-by: Gavin Didrichsen <[email protected]>
Copy link
Contributor

@LukasAud LukasAud left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@LukasAud LukasAud merged commit 2513c6c into main Apr 1, 2025
2 checks passed
@LukasAud LukasAud deleted the puppetcore branch April 1, 2025 09:14
gavindidrichsen added a commit that referenced this pull request Apr 15, 2025
This reverts commit 2513c6c, reversing
changes made to cb81a0b.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants