Is there any way to extend existing goals in pants...
# plugins
q
Is there any way to extend existing goals in pants? For example, if I want to extend the
publish
goal to upload pex files as well to an artifactory
f
You could add a new target type representing upload of a pex file to an artifactory repository. Or better, add a new target type representing the upload of any file to Artifactory. Then you can define a publish rule for that target type.
Examples include
terraform_deployment
(which works with the
experimental-deploy
goal though but the principle remains the same)
There are quite a number of ways to design the developer experience for it.
q
Could you explain more about what you mean to define a publish rule for that target type? What I want ideally is to run the original publish goal in pants in addition to some of my own logic (uploading any type of file to an artifactory)
Also, what would u recommend is the best way to upload a file? Using a
curl
command in a
Process
? Or is there any other way supported/recommended by pants
f
How familiar have you become with the Pants plugin API?
(just trying to gauge where I should start)
q
I am mostly a beginner (written 1 basic plugin)
f
basically you would derive your own subclass of
PublishRequest
and an associated subclass of
PublishFieldSet
and tell Pants about it via the
UnionRule
rule.
"unions" are Pants' name for an extension point
q
I see. This will allow me to have the
publish
goal functionality along with mine as well?
f
yes because that union is how all of the publish functionality is setup
q
I am sorry but could u explain the process in a bit more detail
I have to create my own target that runs a custom goal that is an extended version of the
publish
goal?