Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,459,883
Community Members
 
Community Events
176
Community Groups

Error while getting development status from the issue

Hi.

I'm trying to update proper issue status from Bamboo build plan by calling a Scriptrunner REST endpoint.

The endpoint is defined as following:

@Field ComponentClassManager ccm = ComponentAccessor.getComponentClassManager()
@Field def service = ccm.newInstance("com.atlassian.jira.plugin.devstatus.impl.DefaultDevStatusSummaryService")
@Field UserManager um = ComponentAccessor.getUserManager()
@Field ApplicationUser user = um.getUserByName("bamboo")

status(httpMethod: "PUT") { MultivaluedMap queryParams, String body, HttpServletRequest request ->
...
getIssuePullRequestData(Issue issue)
...
}

def getIssuePullRequestData(Issue issue) {
...
detailData = service.getDetailData(issue.id, "stash", "pullrequest", user)
...
}

When I call this endpoint from CLI using curl I get such result:

 

{
  "detail": [
    {
      "_instance": {
      "applicationLinkId": "b64ab619-e6d6-33ff-853d-fd4cac43c4d5",
      "baseUrl": "https://bitbucket.lan.local",
      "id": "b64ab619-e6d6-33ff-853d-fd4cac43c4d5",
      "name": "Bitbucket",
      "primary": true,
      "singleInstance": false,
      "type": "stash",
      "typeName": "Bitbucket Server"
    },
    "branches": [
      {
        "createPullRequestUrl": "https://bitbucket.lan.local/projects/...",
        "name": "...",
        "repository": {
          "avatar": "https://bitbucket.lan.local/projects/...",
          "avatarDescription": "pflege",
          "name": "FE-chat-app",
          "url": "https://bitbucket.lan.local/projects/..."
        },
        "url": "https://bitbucket.lan.local/projects/..."
      }
    ],
    "pullRequests": [
      {
        "author": {
          "name": "User 1"
        },
        "commentCount": 0

....

 

So branches and pull requests data is returned 

But when I call same endpoint from script task in Bamboo build plan I get this:

 

{
  "errors":[],
  "detail":[
    {
      "branches":[],
      "pullRequests":[],
      "repositories":[],
      "_instance":{
        "singleInstance":false,
        "primary":true,
        "baseUrl":"https://bitbucket.lan.local",
        "applicationLinkId":"b64ab619-e6d6-33ff-853d-fd4cac43c4d5",
        "name":"Bitbucket",
        "typeName":"Bitbucket Server",
        "id":"b64ab619-e6d6-33ff-853d-fd4cac43c4d5",
        "type":"stash"
      }
    }
  ]
}

So no branches and pull requests are returned.

I haven't seen any error in logs. The only difference is that I run curl with my credentials and from Bamboo use none (I expect mutual authentication between Bamboo and Jira)

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events