How to delete the deployment info sent using Jenkins integration (jiraSendDeploymentInfo)

Chandrapratap Singh October 6, 2023

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?

1 answer

0 votes
Mark Rekveld - Marvelution
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
October 6, 2023

Hi @Chandrapratap Singh 

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

Chandrapratap Singh October 20, 2023

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?

Mark Rekveld - Marvelution
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
October 21, 2023

Hi @Chandrapratap Singh 

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

Chandrapratap Singh October 23, 2023

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

Mark Rekveld - Marvelution
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
October 26, 2023

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.

Chandrapratap Singh October 27, 2023

@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?

Krystian Sadowski
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
December 7, 2023

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events