I have configured my Jenkins pipeline to send the deployment info using jiraSendDeploymentInfo including environment and site ID which is working as expected.
How can I delete deployment info from Jira which has incorrect information? Is there any way to revert the deployment info sent by Jenkins using jiraSendDeploymentInfo and published under Jira deployments?
Welcome to the community.
Deployments that are added to Jira can be deleted using 2 REST APIs namely Delete By Properties and Delete By Key
However as far as I can make out the plugin that you install in Jenkins doesn't support either API for deleting deployments, so you will need to implement some custom code to reuse the configuration of the plugin so you can make authenticated requests to delete the deployments.
Cheers,
Mark
Hi @Mark Rekveld - Marvelution I have tried to use the Delete By Properties API but it's not working.
I have followed this doc and generated the bearer token:
https://developer.atlassian.com/cloud/jira/software/integrate-jsw-cloud-with-onpremises-tools/
Here is what my curl request looks like:
curl --request DELETE \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer $ACCESS_TOKEN' \
--url 'https://api.atlassian.com/jira/deployments/0.1/cloud/{cloudId}/bulkByProperties?environmentId=DEV-CANADA'
curl --request DELETE \
--header 'Accept: application/json' \
-H "Authorization: Bearer $ACCESS_TOKEN" \
--url 'https://cloudbolt.atlassian.net/rest/deployments/0.1/bulkByProperties?environmentId=DEV-CANADA'
I have tried to use both the URLs as suggested in this doc:
https://developer.atlassian.com/cloud/jira/software/rest/intro/#base-url-differences
But getting the following errors for both API calls respectively:
{"code":401,"message":"Unauthorized"}
{"message":"Client must be authenticated to access this resource.","status-code":401}
Can you please help me in resolving these errors?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The Delete By Properties API can only delete deployments using the properties that where set when the deployment was send to Jira using the Submit Deployment API
I'm not sure if one account can delete deployments that another account has added, this would be something to check with Atlassian. Maybe through a support ticket if no response come here.
As for the 401, it is likely that either the provided authentication header was not identified by the API endpoint or that the token provided was not identified and that the request was treated as an anonymous requests. I would suggest double checking the process of getting the access token.
Cheers,
Mark
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Mark Rekveld - Marvelution
Thanks for your response.
FYI, the deployments are sent to Jira using the Jira-Jenkins integration.
https://support.atlassian.com/jira-cloud-administration/docs/integrate-with-jenkins/
Thanks,
Chandrapratap Singh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'm not sure how I can help you further, but maybe @Tom Hombergs can help you, looking at the commit log of the plugin and this article he seems to be one of the developers of the plugin.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Tom Hombergs Can you please provide any solution to delete the deployment created via the Jenkins-Jira integration app?
I got to know that the Jira-Jenkins integration app is a Forge connect app and the only way is to delete the app to remove the deployment data but this approach will delete all the deployments added by the app.
Any turnaround to delete specific deployments?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
https://jira.atlassian.com/browse/BCLOUD-22462
its similar but for bitbucket and not implemented yet so we have to wait
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.