Skip to content

Jira integration - API doesn't respect available format

Hello everyone,

Summary

When using the gitlab API v4 to update jira service for a project, the jira_issue_transition_id cannot be set to another value than an integer. This does not respect the documentation and the available format in UI.

Also, when set in the UI, the jira_issue_transition_id is stored as a string and the transition works correctly. When set with the API, it is stored as an integer and the transition doesn't work anymore.

Steps to reproduce

  1. Create a PUT query to https://GITLAB_URL/api/v4/projects/PROJECT_ID/services/jira with a jira_issue_transition_id=1,11 (sample) and you will get the following response (HTTP 400)
{
    "error": "jira_issue_transition_id is invalid"
}
  1. Update the service with a valid transition (1), then get the service value from API: you will see it as an integer. Then update it from the UI and get it from the API: you will see it as a string.

Example Project

Service integration issue, cannot be seen in a sample project.

What is the current bug behavior?

The field jira_issue_transition_id cannot be set to the expected valid value.

The transition is failing when the value is stored as an integer from API.

What is the expected correct behavior?

The field must be update-able to the same format as the UI one.

The stored value should not be stored as an integer since it make the service fail.

Relevant logs and/or screenshots

Sample from Postman generated code:

curl -X PUT \
  https://GITLAB_URI/api/v4/projects/PROJECT_ID/services/jira \
  -H 'Private-Token: xxxxxxxxxxxxxxxx' \
  -H 'cache-control: no-cache' \
  -H 'content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW' \
  -F url=https://xxxxxxxxx.atlassian.net \
  -F api_url= \
  -F username=system@DOMAIN \
  -F password=xxxxxxxxxxxxxxxxxxxx \
  -F 'jira_issue_transition_id=91,111'

output: {"error":"jira_issue_transition_id is invalid"}

Output of checks

This bug happens on a private Gitlab instance.

Results of GitLab environment info

Expand for output related to GitLab environment info
System information
System:		Debian 9.6
Current User:	git
Using RVM:	no
Ruby Version:	2.4.5p335
Gem Version:	2.7.6
Bundler Version:1.16.6
Rake Version:	12.3.1
Redis Version:	3.2.12
Git Version:	2.18.1
Sidekiq Version:5.2.1
Go Version:	unknown

GitLab information Version: 11.5.3 Revision: aa11737 Directory: /opt/gitlab/embedded/service/gitlab-rails DB Adapter: postgresql URL: https://GITLAB_URL HTTP Clone URL: https://GITLAB_URL/some-group/some-project.git SSH Clone URL: git@GITLAB_URL:some-group/some-project.git Using LDAP: no Using Omniauth: yes Omniauth Providers:

GitLab Shell Version: 8.4.1 Repository storage paths:

  • default: /var/opt/gitlab/git-data/repositories Hooks: /opt/gitlab/embedded/service/gitlab-shell/hooks Git: /opt/gitlab/embedded/bin/git

Results of GitLab application Check

Expand for output related to the GitLab application check
Checking GitLab Shell ...

GitLab Shell version >= 8.4.1 ? ... OK (8.4.1) hooks directories in repos are links: ... 31/1 ... ok 9/2 ... ok 9/3 ... ok 9/4 ... ok 9/5 ... ok 10/6 ... ok 10/7 ... ok 10/8 ... ok 43/10 ... ok 43/11 ... ok 43/12 ... ok 10/13 ... ok 10/14 ... ok 10/15 ... ok 10/16 ... ok 10/17 ... ok 10/18 ... ok 10/19 ... ok 10/20 ... ok 10/21 ... ok 10/22 ... ok 13/24 ... ok 13/25 ... ok 13/26 ... ok 13/28 ... ok 13/29 ... ok 13/30 ... ok 13/31 ... ok 13/32 ... ok 13/33 ... ok 13/34 ... ok 13/35 ... ok 13/36 ... ok 13/37 ... ok 13/38 ... ok 13/39 ... ok 33/40 ... ok 15/41 ... ok 15/42 ... ok 13/43 ... ok 13/44 ... ok 30/45 ... ok 15/46 ... ok 15/48 ... ok 17/49 ... ok 17/50 ... ok 10/54 ... ok 10/55 ... ok 19/56 ... ok 19/57 ... ok 19/58 ... ok 19/60 ... ok 19/61 ... ok 19/62 ... ok 19/63 ... ok 19/64 ... ok 9/66 ... ok 20/67 ... ok 19/68 ... ok 8/75 ... ok 13/76 ... ok 13/77 ... ok 15/78 ... ok 8/79 ... ok 19/82 ... ok 19/83 ... ok 13/84 ... ok 9/88 ... ok 9/89 ... ok 9/90 ... ok 9/91 ... ok 9/92 ... ok 9/93 ... ok 9/95 ... ok 33/97 ... ok 9/98 ... ok 31/99 ... ok 9/100 ... ok 17/101 ... ok 9/102 ... ok 9/103 ... ok 13/104 ... ok 19/105 ... ok 31/106 ... ok 32/107 ... ok 30/108 ... ok 20/109 ... ok 19/110 ... ok 19/111 ... ok 17/112 ... ok 9/113 ... ok 30/114 ... ok 17/115 ... ok 35/118 ... ok 37/120 ... ok 37/121 ... ok 35/122 ... ok 19/123 ... ok 32/124 ... ok 32/126 ... ok 9/127 ... ok 9/128 ... ok 35/129 ... ok 30/130 ... ok 30/131 ... ok 31/133 ... ok 13/134 ... ok 30/135 ... ok 35/136 ... ok 19/137 ... ok 30/138 ... ok 34/139 ... ok 30/140 ... ok 31/141 ... ok 42/142 ... ok 30/144 ... ok 30/146 ... repository is empty 13/147 ... ok 35/148 ... ok 30/149 ... ok 39/150 ... repository is empty 37/151 ... ok 48/152 ... ok 48/153 ... ok 48/154 ... ok 48/155 ... ok 48/156 ... ok 37/157 ... ok 48/158 ... ok 47/159 ... ok 31/160 ... ok 48/161 ... ok 43/162 ... ok 48/163 ... ok 48/164 ... ok 25/165 ... ok 9/166 ... ok 9/167 ... ok 48/168 ... ok 17/169 ... ok 54/170 ... ok 32/171 ... ok 47/172 ... ok 9/173 ... ok 31/174 ... ok 31/175 ... ok 48/176 ... ok 62/177 ... ok 57/178 ... repository is empty 62/179 ... ok 31/180 ... ok 58/181 ... ok 48/182 ... ok 62/183 ... ok 48/184 ... ok 48/185 ... ok 48/186 ... ok 30/187 ... ok 30/188 ... ok 48/189 ... ok 48/190 ... ok 32/191 ... ok 61/193 ... ok 61/194 ... ok 61/195 ... ok 61/196 ... ok 17/197 ... ok 13/198 ... ok 62/200 ... ok 62/201 ... ok 62/203 ... ok 62/204 ... ok 48/205 ... ok 34/206 ... ok 62/207 ... ok 62/208 ... ok 62/209 ... ok 62/210 ... ok 34/211 ... ok 63/213 ... ok 63/214 ... ok 63/215 ... ok 30/216 ... ok 62/217 ... ok 30/218 ... ok 2/219 ... ok 42/220 ... ok 34/221 ... ok 48/222 ... ok 31/223 ... ok Running /opt/gitlab/embedded/service/gitlab-shell/bin/check Check GitLab API access: OK Redis available via internal API: OK

Access to /var/opt/gitlab/.ssh/authorized_keys: OK gitlab-shell self-check successful

Checking GitLab Shell ... Finished

Checking Gitaly ...

default ... OK

Checking Gitaly ... Finished

Checking Sidekiq ...

Running? ... yes Number of Sidekiq processes ... 1

Checking Sidekiq ... Finished

Reply by email is disabled in config/gitlab.yml Checking LDAP ...

LDAP is disabled in config/gitlab.yml

Checking LDAP ... Finished

Checking GitLab ...

Git configured correctly? ... yes Database config exists? ... yes All migrations up? ... yes Database contains orphaned GroupMembers? ... no GitLab config exists? ... yes GitLab config up to date? ... yes Log directory writable? ... yes Tmp directory writable? ... yes Uploads directory exists? ... yes Uploads directory has correct permissions? ... yes Uploads directory tmp has correct permissions? ... no Try fixing it: sudo chown -R git /var/opt/gitlab/gitlab-rails/uploads sudo find /var/opt/gitlab/gitlab-rails/uploads -type f -exec chmod 0644 {} ; sudo find /var/opt/gitlab/gitlab-rails/uploads -type d -not -path /var/opt/gitlab/gitlab-rails/uploads -exec chmod 0700 {} ; For more information see: doc/install/installation.md in section "GitLab" Please fix the error above and rerun the checks. Init script exists? ... skipped (omnibus-gitlab has no init script) Init script up-to-date? ... skipped (omnibus-gitlab has no init script) Projects have namespace: ... 31/1 ... yes 9/2 ... yes 9/3 ... yes 9/4 ... yes 9/5 ... yes 10/6 ... yes 10/7 ... yes 10/8 ... yes 43/10 ... yes 43/11 ... yes 43/12 ... yes 10/13 ... yes 10/14 ... yes 10/15 ... yes 10/16 ... yes 10/17 ... yes 10/18 ... yes 10/19 ... yes 10/20 ... yes 10/21 ... yes 10/22 ... yes 13/24 ... yes 13/25 ... yes 13/26 ... yes 13/28 ... yes 13/29 ... yes 13/30 ... yes 13/31 ... yes 13/32 ... yes 13/33 ... yes 13/34 ... yes 13/35 ... yes 13/36 ... yes 13/37 ... yes 13/38 ... yes 13/39 ... yes 33/40 ... yes 15/41 ... yes 15/42 ... yes 13/43 ... yes 13/44 ... yes 30/45 ... yes 15/46 ... yes 15/48 ... yes 17/49 ... yes 17/50 ... yes 10/54 ... yes 10/55 ... yes 19/56 ... yes 19/57 ... yes 19/58 ... yes 19/60 ... yes 19/61 ... yes 19/62 ... yes 19/63 ... yes 19/64 ... yes 9/66 ... yes 20/67 ... yes 19/68 ... yes 8/75 ... yes 13/76 ... yes 13/77 ... yes 15/78 ... yes 8/79 ... yes 19/82 ... yes 19/83 ... yes 13/84 ... yes 9/88 ... yes 9/89 ... yes 9/90 ... yes 9/91 ... yes 9/92 ... yes 9/93 ... yes 9/95 ... yes 33/97 ... yes 9/98 ... yes 31/99 ... yes 9/100 ... yes 17/101 ... yes 9/102 ... yes 9/103 ... yes 13/104 ... yes 19/105 ... yes 31/106 ... yes 32/107 ... yes 30/108 ... yes 20/109 ... yes 19/110 ... yes 19/111 ... yes 17/112 ... yes 9/113 ... yes 30/114 ... yes 17/115 ... yes 35/118 ... yes 37/120 ... yes 37/121 ... yes 35/122 ... yes 19/123 ... yes 32/124 ... yes 32/126 ... yes 9/127 ... yes 9/128 ... yes 35/129 ... yes 30/130 ... yes 30/131 ... yes 31/133 ... yes 13/134 ... yes 30/135 ... yes 35/136 ... yes 19/137 ... yes 30/138 ... yes 34/139 ... yes 30/140 ... yes 31/141 ... yes 42/142 ... yes 30/144 ... yes 30/146 ... yes 13/147 ... yes 35/148 ... yes 30/149 ... yes 39/150 ... yes 37/151 ... yes 48/152 ... yes 48/153 ... yes 48/154 ... yes 48/155 ... yes 48/156 ... yes 37/157 ... yes 48/158 ... yes 47/159 ... yes 31/160 ... yes 48/161 ... yes 43/162 ... yes 48/163 ... yes 48/164 ... yes 25/165 ... yes 9/166 ... yes 9/167 ... yes 48/168 ... yes 17/169 ... yes 54/170 ... yes 32/171 ... yes 47/172 ... yes 9/173 ... yes 31/174 ... yes 31/175 ... yes 48/176 ... yes 62/177 ... yes 57/178 ... yes 62/179 ... yes 31/180 ... yes 58/181 ... yes 48/182 ... yes 62/183 ... yes 48/184 ... yes 48/185 ... yes 48/186 ... yes 30/187 ... yes 30/188 ... yes 48/189 ... yes 48/190 ... yes 32/191 ... yes 61/193 ... yes 61/194 ... yes 61/195 ... yes 61/196 ... yes 17/197 ... yes 13/198 ... yes 62/200 ... yes 62/201 ... yes 62/203 ... yes 62/204 ... yes 48/205 ... yes 34/206 ... yes 62/207 ... yes 62/208 ... yes 62/209 ... yes 62/210 ... yes 34/211 ... yes 63/213 ... yes 63/214 ... yes 63/215 ... yes 30/216 ... yes 62/217 ... yes 30/218 ... yes 2/219 ... yes 42/220 ... yes 34/221 ... yes 48/222 ... yes 31/223 ... yes Redis version >= 2.8.0? ... yes Ruby version >= 2.3.5 ? ... yes (2.4.5) Git version >= 2.9.5 ? ... yes (2.18.1) Git user has default SSH configuration? ... yes Active users: ... 21

Checking GitLab ... Finished

Possible fixes

I do not know gitlab code enough to link where the fix should go.

Edited by Verlhac Gaëtan