I am currently at the stage where I’ve managed to ...
# plugins
f
I am currently at the stage where I’ve managed to register a Target and a rule, and I can run
pants publish :my-target
. But nothing happens! How do I know if Pants is actually running my rule? If I comment out the rule Pants complains about missing paths from all of the other kinds of publishable targets in my repo (Docker image and Helm chart).
1
I published the code here, any guidance would be greatly appreciated! https://github.com/Peder2911/pants-oras-plugin
I think a plugin like this would be relatively straightforward, all I need to do is call the ORAS CLI which publishes stuff as artifacts to an OCI registry. Lots of cool things one could do with metadata and content types as well.
c
I think you’re missing the
required_fields
on your
OrasPublishFieldSet
Copy code
required_fields = (OrasSourcesField,)
oh, nvm, I missed the inheritance there..
I would make a try though with not having the extra
OrasArtifactFieldSet
as middle-man as it changes how your dataclass works.. don’t recall if that would matter in this case though..
ah, now it clicked. pants publishes packages, so unless your target can be packaged, it won’t be considered for publishing.. i.e. you need to implement the rules to produce a
BuiltPackage
f
Ah, I suspected something like that. Oras lets you publish any kind of file, so I don’t strictly need to “package” anything, but I guess that I would have to create some kind of package abstraction for this to work. Maybe just something wrapping a single file.
c
as Tom hinted at, you don’t need to actually produce anything, it can be an empty dummy package..
we should really fix this 😉
oh, sorry, he started a new thread about it in #development here: https://pantsbuild.slack.com/archives/C0D7TNJHL/p1698783405692079
f
Thanks! Now I am at least able to run hello world code within my rules and so on with publish, so great progress has been made! Thank you to @gorgeous-winter-99296 for excellent help, we talked a bit in scandinavian on PM to figure some things out as well. 🇸🇪🇳🇴
💪 1
What I would have loved to have while working to get to this point was clearer documentation and minimal examples. The relationships between all of the things (types) involved in a simple “hello world” no-op run of publish was not at all clear and I had to do a lot of source code diving. I’ll see what I can contribute once I have written this into something useful and shipped.
To me it seems like the graphiness of this system would lend itself to some simple graph representations of what is going on and what needs to be satisfied in order to do things, but the best i managed to do for the publish process was this:
c
Yea, very true. Any and all doc contributions (and other things as well, of course) are always most welcome 😄
🤝 1