Skip to content
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

Adds ability to resolve dependencies from a source file #1232 #1314

Closed
wants to merge 2 commits into from

Conversation

binford2k
Copy link
Contributor

This supersedes PR #1232 and updates the expected workflow to

  1. Write Puppetfile.src that describes only the modules you intend to use.
  2. Run r10k puppetfile resolve to resolve all dependencies of those modules.
  3. Optional: review the generated Puppetfile for quality and security purposes.
  4. Deploy.

This modifies the path resolution so that /path/to/Puppetfile.lock is
preferred. If the lockfile exists, then it will be used instead of the
Puppetfile. It also adds a `puppetfile resolve` action that will resolve
dependencies and write out that lockfile.

Note: all dependencies will be satisfied from the Forge, no matter what
the original source was.

Expected user workflow:

* Write Puppetfile that describes only the modules you intend to use.
* Run `r10k puppetfile resolve` to resolve all dependencies of those
  modules.
* Optional: review the dependent modules for quality and security
  purposes.
* Deploy.

@glennsarti what do you think about this implementation? It feels a bit
weird to have multiple Puppetfile parsers in the same tool, but don't
really see a better way. And am I using the dependency graph properly?
This changes the workflow to resolving dependencies from a source
Puppetfile.src to the Puppetfile used by r10k to deploy code. This makes
this workflow completely opt-in.
@binford2k binford2k requested a review from a team as a code owner June 21, 2022 20:30
@binford2k binford2k changed the title [WIP] Adds ability to resolve dependencies from a source file #1232 Adds ability to resolve dependencies from a source file #1232 Jun 21, 2022
@glennsarti
Copy link

Commenting here as I was summoned by a commit....

@binford2k The puppetfile resolver has a parser in it to convert text (puppetfile) into a document model. However you can absolutely create the document model in another way. I know that's how bolt does it. Rough psuedo code.

dom = new PuppetfileResolver::Puppetfile::Document
r10k.modules.each do |module|
   dom_module = new PuppetfileResolver::Puppetfile::ForgeModule(module.name)
   dom.add_module(dom_module)
end

resolver = new PuppetfileResolver.Resolver()
resolver.resolve(dom)

@glennsarti
Copy link

That said, my parser has magic-comment support as per - https://sarti.dev/puppetfile-resolver/parsers

@github-actions
Copy link

This PR has been marked stale because it has had no activity for 60 days. If you are still interested in getting this merged, please comment and we'll try to move it forward. Otherwise, it will be closed in 7 days.

@github-actions github-actions bot added the stale label Aug 21, 2022
@github-actions github-actions bot closed this Aug 29, 2022
@jhoblitt
Copy link

jhoblitt commented Oct 4, 2023

I think a lot of people would be interested in this functionality. Are there any plans to revive this PR?

@binford2k
Copy link
Contributor Author

@jhoblitt I'd love to get it into core, but no luck yet. In the meantime, I recreated it as a standalone tool https://github.com/binford2k/r10k-resolve

@jhoblitt
Copy link

jhoblitt commented Oct 4, 2023

@binford2k hmm. I think something like a rake target that could be run under CI would be needed to make sure that the Puppetfile is update to date.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants