Hey everyone, I want to create a pants plugin whic...
# plugins
r
Hey everyone, I want to create a pants plugin which executes
trivy rootfs
on a
loose
pex_binary. My current plan of developing this is 1. Create a rule which filters-in PexBinary targets 2. Another rule accepts a PexBinary target, gets its
OutputPathField
as Digest and execute Process for
trivy rootfs
with the digest as input Slack Conversation
w
r
I currently have this, which I am sure is broken. Appreciate your help 🙏
w
What’s your error
r
I have used gpt to generate this version
it complains "[ERROR] type object 'TrivyScanGoal' has no attribute 'environment_behavior'"
but I think the idea is correct
pex_request = <http://field_set.to|field_set.to>_pex_request(layout="loose")
also seems incorrect
environment_behavior = Goal.EnvironmentBehavior.LOCAL_ONLY
fixes the former issue
w
If you're going to write a plugin, chatgpt guessing isn't going to be a great approach. Please review the documentation: https://www.pantsbuild.org/2.21/docs/writing-plugins/overview Tutorials: https://www.pantsbuild.org/2.21/docs/tutorials/create-a-new-goal https://www.pantsbuild.org/2.21/docs/tutorials/advanced-plugin-concepts And take a look at what would be a comparable example of what you want to do in the main repo (https://www.pantsbuild.org/2.21/docs/writing-plugins/overview) - as a starting point. Alternatively, I think this use case could be better suited to an ad-hoc tool: https://www.pantsbuild.org/2.21/docs/ad-hoc-tools/integrating-new-tools-without-plugins
1