-
-
Notifications
You must be signed in to change notification settings - Fork 746
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
Add pants-plugins/pack_metadata
to inform pants about our packs
#5868
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple of typos
Co-authored-by: Amanda McGuinness <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch! Fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
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_metadata
target. Thepack_metadata
target 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_submodule
target 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_metadata
targets (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).