Add pants-plugins/pack_metadata to inform pants about our packs#5868
Merged
cognifloyd merged 23 commits intomasterfrom Jan 23, 2023
Merged
Add pants-plugins/pack_metadata to inform pants about our packs#5868cognifloyd merged 23 commits intomasterfrom
pants-plugins/pack_metadata to inform pants about our packs#5868cognifloyd merged 23 commits intomasterfrom
Conversation
Add pack_metadata target and a tailor rule to automatically add it in every dir with pack.yaml.
We need to hard code the instructions in the plugin. So, we'll only add the instructions to the pack_metadata target.
Since these instructions can't be generic enough to upstream, Move it to our pack_metadata plugin which is st2-specific.
rush-skills
approved these changes
Jan 18, 2023
Co-authored-by: Amanda McGuinness <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Background
This is another part of introducing pants, as discussed in various TSC meetings.
Related PRs can be found in:
Overview of this PR
This PR makes it possible to inform pants about all of our pack metadata files by adding a new
pack_metadatatarget. Thepack_metadatatarget encompasses the following files:st2/pants-plugins/pack_metadata/target_types.py
Lines 29 to 40 in 185e871
Python, shell, and requirements files all need to be handled separately so that pants can lint/fmt them appropriately. Pants does not have a markdown plugin yet, so I put them in the list as a reminder that they will need to be dealt with, but I commented them out.
One of our packs is in a git submodule (
st2tests/st2tests/fixtures/packs/test_content_version), so it also adds apack_metadata_in_git_submoduletarget to cleanly handle a case where someone has not checked out the git submodules. This improves the Developer Experience by raising an error as early as possible to let people know that they need to checkout the git submodule and how to do that. Otherwise, they won't get an error until they run tests where we have some code to give the same instructions for the tests that need it.Note that I have not enabled the plugin yet:
st2/pants.toml
Line 28 in 185e871
That keeps this PR focused on the plugin itself including adding tests for it. The next PR will add the
pack_metadatatargets (at least in part using./pants tailor ::) in our BUILD files. If you want to explore some of that, you can look at: pants-plugins-pack_metadata...pants-pack_metadataDeveloping pants plugins
Pants has extensive documentation on the plugin API, including how to create targets, how to write rules, and there's even a mini tutorial about how to add a formatter (adding formatters is a very common thing for plugins to do).