Reputation: 53
I need to change the BuildUser name (Principal) in BuildInfo json while publishing package to the Artifactory.
Kindly let me know if there is any REST API(PUT/POST) available to update the user details in Buildinfo.
Thanks,
Upvotes: 0
Views: 758
Reputation: 2770
Builds are supposed to be immutable, so there is no way to modify one. If you really need to do this, the closest you can get is deleting and re-deploying the existing build info:
curl -uuser:pass -XGET 'http://localhost:8081/artifactory/api/build/foobar/10' >build.json
curl -uuser:pass -XDELETE 'http://localhost:8081/artifactory/api/build/foobar?buildNumbers=10'
curl -uuser:pass -XPUT 'http://localhost:8081/artifactory/api/build' -H 'Content-Type: application/json' -T build.json
This should re-deploy the build exactly as it already is, except that Artifactory will overwrite the principal field with the current user (so make sure you run these as the user you want the principal to be set to). By default, the DELETE
will only delete the build info, and not the build artifacts.
If you're looking to deploy a build with a different principal from the user you're deploying as, I don't think that's possible.
Upvotes: 2