Clould Jira connection with Jenkins

Bogdan Ciobanu November 13, 2019

Hello,

I was wondering if it is possible to configure the https://jenkinsci.github.io/jira-steps-plugin/getting-started/examples/ to work with the on cloud version of JIRA.

I havent seen many topics on it and would like to be sure before i start working on it.

Thanks for any clarification.

 

1 answer

1 accepted

0 votes
Answer accepted
Dario B
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 15, 2019

Hi @Bogdan Ciobanu ,

There are multiple ways to integrate Jira Cloud with Jenkins. However, the officially supported way is the one described in the below documentation page:

Please review above page and let me know if it helps of if you have further questions on this topic.

 

Cheers,
Dario

Tobias Ståhl November 19, 2019

Hello @Dario B 

Working in the same team as Bogdan.

We have tried using this, and yes it works. but it does not have the functions we want.
there were only two different function which we could find, and neither of them is what we want.

Or if you have some other information on how we can expand it?

 

Best regards
Tobias

Dario B
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 19, 2019

Hi @Tobias Ståhl ,

There should be other ways to integrate and we should also have some add-ons available in our marketplace for this:

 

Can you kindly let me know which functionalities you are after so that I can do a bit of research and see what can be done?

 

Cheers,
Dario

Tobias Ståhl December 4, 2019

Hi again @Dario B 

Sorry for slow reply.

Here are the different thing we would like to do.

 

1. Move tickets in the workflow depending on the environment Jenkins deploys to.

2. Add a comment.

3. Update custom fields.

 

This is what we would like to start with.

 

Best regards,

Tobias

Dario B
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 4, 2019

Hi @Tobias Ståhl ,

I have never used it myself, but apparently the below add-on should allow you to achieve your goals:

The above add-on seems to be built for Jira Server. However, it should work in Cloud as well if rather than using username and password for basic authentication you provide email address and API Token.

Another option that seems to be providing similar functionalities is the add-on Jenkins Integration Automation for Jira:

  • Common use cases

    You can automate a lot development workflow related tasks with the Jenkins Integration Automation for Jira extension.

    Here are some common use cases to help you get started.

     

    Create an Issue if a Build is Unsuccessful

    Some builds get more eyes on them than others, but builds that are not successful should generally be looked at to determine if actions are needed. Automatically creating an issue can make sure that all unsuccessful builds get eyes on them.

    Transition Issue to In-Progress when Development has Started

    We have all seen this from time to time, developers that eagerly start work on a new story but don't update them to the reflect this. Automatically transitioning issues linked to a build can make sure issues in Jira reflect the actual state, even when developers forget.

     

    More Use Cases

    Additional use cases will be added over time when the add-ons feature sets get expanded.

 

Cheers,
Dario

Tobias Ståhl December 5, 2019

Hello :)

Been trying to use the Jira issue updater plugin for some time now.

I´m able to the get the connection with the email an API Token.

My problem is that it cannot find the issue it should update. no matter how I make the JQL. and the documentation for hte plugin say different things. 

However I make the JQL, I get this everytime.
"Unable to find issues: (301)"

Have not found any solution on this.

Any tips how to proceed?

 

Best regards,

Tobias

Tobias Ståhl December 5, 2019
Like Dario B likes this
Dario B
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 6, 2019

Hi @Tobias Ståhl ,

I am not sure I understand correctly. Are you saying that the same JQL that works fine in Jira is then returning error 301 when added to the Jenkins plugin or anything else? 

Please provide as many details as possible about this issue. Actually, it would be best if you could provide the exact list of steps you are following so that I can make sure we are on the same page.

Cheers,
Dario

Tobias Ståhl December 12, 2019

Hello @Dario B 

 

I installed the plugin and setup a multiconfiguration jenkins job.
and added a build step which looks like this.

And this JQL statments works perfectly when used in JIRA.

issueUpdater_Congfigure.PNGTried multiple different jql statments now, and everytime I get this reponse.
issueupdated_errorcode.PNG
Best regards

Tobias

Dario B
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 12, 2019

Hi @Tobias Ståhl , 

The add-on is not built by us, so this is just a guess. However, in the add-on documentation I can see:

Inputs:

- the Jira REST URL (e.g. http://something.com/rest/api/2)

 

Therefore, I believe that the Jira REST Base URL is missing the /rest/api/<VERSION> part at the end. 

Can you kindly set it to something like one of the below examples and let me know if this works:

  1. https://NAME.atlassian.net/rest/api/3
  2. https://NAME.atlassian.net/rest/api/2
  3. https://NAME.atlassian.net/rest/api/latest

 

Also, can you confirm you are using an API Token instead of your Jira password to authenticate?

 

Cheers,
Dario

Tobias Ståhl January 23, 2020

Hello @Dario B 

Have been testing around now some time with this plugin, and yes it works very well.

Except on one customfield. This custofield is an drop down, of 3 different option.
I cannot get it to update the field with JIRA issue updater.

Maybe you have some input, or help?

 

Best regards,

Tobias

Dario B
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 23, 2020

Hi @Tobias Ståhl , 

If this is now working please accept my answer to this thread.

As regarding the custom field not being updated, not using the add-on myself I don't have enough information to be able to determine why this is failing. However, I made a bit of research and it can actually be that this functionality is only intended to be used with text custom fields. Indeed I can see an open pull request to add the possibility to:

choose whether the custom field update should REPLACE, APPEND existing field data

For more details please see:

 

At this point, can you kindly:

  1. Provide a screenshot of the help text for the fields: 'Jira Custom Field to be edited" and "Jira Custom Field value"
  2. Repeat the test having debugging enabled as explained in https://github.com/jenkinsci/jira-issue-updater-plugin and paste the logs in here:
    If you want to see debug messages, add an environment variable "JIRA_ISSUE_UPDATER_DEBUG=TRUE" to the environment

 

Cheers,
Dario

Tobias Ståhl January 24, 2020

Hi @Dario B 

Here is a screenshot of the help text:
Help_Text_Customfield.PNG

 

And about the debugging, added the variable and ran the same jenkins job. and nothing else showed up in the log. Do not beilve that this is "bug".
Since I get this kind of reponse from JIRA:
Since it is doable to update all the other fields, and it is the exact same setup fo all of them

Cusomfield_Update_job_reponse.PNG

The Customfield I´m trying to update is of type, select list (single choice). 

Tobias Ståhl January 24, 2020

Also, what do you mean by "accept my answer to this thread."?

Dario B
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 24, 2020

Hi @Tobias Ståhl ,

As I mentioned in my previous reply, there are chances that the functionality is supposed to be used with text custom fields (since you can append, replace or pre-pend text) and not select lists. 

This is because the way to update custom fields via REST API is different depending on the kind of field:

  • The syntax to update a text field is:
    "customfield_10004": "Free text goes here.  Type away!"
    
  • The syntax to update a select-list field is: 
    "customfield_10013": { "value": "red" }
    

For more details please review the Jira REST API examples page.

 

Another option could be that the wrong value is passed for the custom field.  So, in order to confirm or deny which one is the case, can you kindly let me know:

  1. Which endpoint is called? I assume it is sending a put request to the endpoint /rest/api/<version>/issue (to edit/update issues) but since you removed that part from the last screenshot you have sent I'd like to confirm.
  2. Which are the possible options for the single select? 
  3. If configuring the Jira Issue Updater to enter some text into a text custom field works correctly or if it returns the same kind of error? 

 

Finally, by saying "please accept my answer to this thread" I mean "please click on the 'accept answer' button next to my answer":

accept-answer.jpg

 

Cheers,
Dario

Suggest an answer

Log in or Sign up to answer