Skip to content

Adds missing API fields from JIRA integration responses

What does this MR do and why?

  • Converts the jira_issue_transition_id into an API-only field
  • Adds the missing attribute to the Jira's integration API response.
  • Removes API-only fields from the global_fields

The Terraform GitLab Provider currently has a buggy resource due to the missing field.

Screenshots or screen recordings

Before

{
    "id": 6,
    "title": "Jira",
    "slug": "jira",
    "created_at": "2022-06-15T10:18:18.104Z",
    "updated_at": "2022-06-15T11:06:14.703Z",
    "active": true,
    "commit_events": true,
    "push_events": true,
    "issues_events": true,
    "confidential_issues_events": true,
    "merge_requests_events": true,
    "tag_push_events": true,
    "note_events": true,
    "confidential_note_events": true,
    "pipeline_events": true,
    "wiki_page_events": true,
    "job_events": true,
    "comment_on_event_enabled": true,
    "properties": {
        "url": "https://testurl.com",
        "api_url": "https://testurl.com/rest",
        "username": "user2"
    }
}

After

{
    "id": 6,
    "title": "Jira",
    "slug": "jira",
    "created_at": "2022-06-15T10:18:18.104Z",
    "updated_at": "2022-06-15T11:40:15.430Z",
    "active": true,
    "commit_events": true,
    "push_events": true,
    "issues_events": true,
    "confidential_issues_events": true,
    "merge_requests_events": true,
    "tag_push_events": true,
    "note_events": true,
    "confidential_note_events": true,
    "pipeline_events": true,
    "wiki_page_events": true,
    "job_events": true,
    "comment_on_event_enabled": true,
    "properties": {
        "url": "https://testurl.com",
        "api_url": "https://testurl.com/rest",
        "username": "user2",
        "jira_issue_transition_id": "333"
    }
}

Jira's integration page

Screenshot_2022-06-15_at_13.28.49

How to set up and validate locally

  1. Checkout the 362437-jira-integration-rest-api-is-missing-jira_transition_id-in-responses branch and run the app
  2. Execute the following curl command (replace the authorization token)
curl -X PUT "http://localhost:3000/api/v4/projects/6/integrations/jira" --header "PRIVATE-TOKEN: REPLACE_ME" --header 'Content-Type: application/json' --data '{                                                        
 "url": "https://testurl.com",
 "api_url": "https://testurl.com/rest",
 "project_key": "",
 "username": "user2",
 "password": "mypass_update",
 "jira_issue_transition_id": "3",
 "merge_requests_events": true
}'
  1. The response should include "jira_issue_transition_id": "333" inside the properties
  2. Visit Jira's integration page (e.g. http://localhost:3000/api/v4/projects/6/integrations/jira) and confirm there is no additional input field.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #362437 (closed)

Edited by Bojan Marjanovic

Merge request reports