I would like to send deployment information to a Jira issue from my ArgoCD pipeline

Guy Yehezkel October 30, 2024

Hi, I though I could use the Rest API for deployment but I'm having difficulties understanding the authentication method needed to achieve that and how to set it up 

2 answers

0 votes
Guy Yehezkel October 31, 2024

Does this work as well with the builds API as I'm getting forbidden responses using the build URL: rest/builds/0.1/bulk 

Humashankar VJ
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 31, 2024

Hi @Guy Yehezkel 

Yes that's right.

To get rid of Forbidden - Double check - Authentication / permissions and the Deployments features.

Regards

0 votes
Humashankar VJ
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 31, 2024

Hi @Guy Yehezkel 

To integrate your ArgoCD pipeline with Jira issues via the Jira REST API, authentication setup is essential.

For Jira Server/Data Center, choose between Basic Authentication (less secure) and OAuth (more secure). For Jira Cloud, generate an API token through the Atlassian API token management portal.

https://id.atlassian.com/manage/api-tokens

To authenticate:

  • Jira Cloud: Use your email as the username and API token as the password.
  • Jira Server/Data Center (Basic Authentication): Use your Jira username and password, encoded in Base64.
  • Jira Server/Data Center (OAuth): Create an Application Link, generate consumer and private keys, and implement the OAuth flow.

In your ArgoCD pipeline:

  • Create a script or use a tool for HTTP requests.
  • Include authentication headers.
  • Send a POST or PUT request to update the Jira issue.

Example using curl for Jira Cloud:

bash

curl -D- \

   -u your-email@example.com:your-api-token \

   -X PUT \

   -H "Content-Type: application/json" \

   https://your-domain.atlassian.net/rest/api/3/issue/ISSUE-KEY \

   --data '{

     "fields": {

       "customfield_10000": "Deployment completed"

 

Replace your-email@example.com, your-api-token, your-domain, and ISSUE-KEY with your actual values

To learn more about authentication:

Solved: How to authenticate to Jira REST API

OAuth

Jira Align and Authentication Methods (Jira Connec... - Atlassian Community

Hope this helps - Happy to help further!!
Thank you very much and have a great one!
Warm regards

 

Guy Yehezkel November 5, 2024

unfortunately i still getting 403 using basic auth

Like Humashankar VJ likes this
Humashankar VJ
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 5, 2024

@Guy Yehezkel .

403 errors can arise from several common causes.

Firstly, incorrect credentials or insufficient permissions can prevent authorized access, triggering the error.

Furthermore, API token issues specifically affecting Jira Cloud integrations can also lead to 403 errors. Another possible cause is using an incorrect API endpoint, which can disrupt communication.

Likewise, network or firewall restrictions may block requests, resulting in the error.

Best Regards

Suggest an answer

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

Atlassian Community Events