Hi Jira Community,
I am trying perform jira issue status transition from Gitlab pipeline/job using rest api via curl command indicated below:
#FLIP JIRA STATUS curl -k POST \ -H "Authorization: Basic $TOKEN" \ -H "Content-Type: application/json" \ "https://******team*******.atlassian.net/rest/api/3/issue/${ISSUE_KEY}/transitions" \ -d " { \"transition\": { \"id\": \"$TRN_ID\" } }"
I am able to perform other transitions on the same Jira issue/ticket, infact i can even comment on the same jira issue before performing the above transition but specifically only this transition alone not working. There are no errors thrown from the pipeline logs as well. Also, i added 10 seconds delay/wait time before performing transition but still no luck.
Gitlab pipeline log:
There are not workflow rules/properties configured its a plane transition.
when i run this script manually from my local machine, i get below error:
{"errorMessages":["Issue does not exist or you do not have permission to see it."],"errors":{}}
My user id having token already has admin access.
Not sure what is blocking this transition. Please assist if i am missing anything.
Regards,
Azeem
Hi All,
The above issue is resolved now.
Fix:
The token used for curl api was different in gitlab and when running locally.
Gitlab job was failing despite updating the correct curl api command because, i was retrying only the failed job in gitlab (requirement is not to create new pipeline) when i rerun a failed job in gitlab, it doesnt checkout the latest changes/commit, it was picking previous commit through which initially pipeline was triggered. Tested with new jira and new pipeline with latest changes. gitlab pipeline able to transition the issue status.
Thanks for the quick responses
Glad you solved it, so it was related to a permission issues based on a wrong user token.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Please confirm how you have generated the transition id.
you can use the below to command to generate the transition id:
curl -u username:password \
-X GET \
-H "Content-Type: application/json" \
"https://your-jira-instance/rest/api/2/issue/ISSUE-KEY/transitions"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI @Dilip
Why are you providing information based on the DC api?
The cloud API doesn't allow authentication by username/password, only API token, also for the API version 2
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
yes I am using API version 3 and Jira could
also, the transition id looks ok
(verified from rest API as well as from url context path when clicked on transition in workflow )
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Check for any conditions or validators that might are present on the specific transition in the workflow.
Or it could be that issue security has been setup on the project and the security level set on the issue prevents you from accessing it.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Marc,
This particular transition doesn't have rules or properties et
it's a plane transition.
Issue security meaning are you referring to permssion schemes ?
if yes then this project doesn't have any permissions associated.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Can you provide a screenshot of the issue (all details)
An provide details on the workflow transition you are trying to execute.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Here is the screenshots.
Below is the error i received when i ran the curl/rest api from cli/manually.
Regards,
Azeem
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.