External issue tracker with regular expressions settings not configureable via API #9654

Closed
opened 2025-11-02 08:45:37 -06:00 by GiteaMirror · 1 comment
Owner

Originally created by @andrewimeson on GitHub (Oct 4, 2022).

Description

The external issue tracker regular expression feature isn't configurable via the Gitea API. Other aspects of the external issue tracker are configurable via the API, but the regexp pattern specifically is not.

Example:

curl -X 'PATCH' \
  'https://try.gitea.io/api/v1/repos/andrewimeson/test_repo?token=redacted' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "external_tracker": {
    "external_tracker_format": "https://jira.example.com/browse/LOL-{index}",
    "external_tracker_style": "regexp",
    "external_tracker_regexp_pattern": "LOL-(\\d+)",
    "external_tracker_url": "https://jira.example.com/projects/LOL/issues"
  },
  "has_issues": true
}'

which responds with this JSON, which you can see is missing the external_tracker_regexp_pattern field. The field name I guessed at, but if I set it in the web UI and then execute the API request again it still doesn't show the regex in the JSON response:

{
  "id": 37590,
  "owner": {
    "id": 518534,
    "login": "andrewimeson",
    "login_name": "",
    "full_name": "",
    "email": "andrewimeson@noreply.try.gitea.io",
    "avatar_url": "https://try.gitea.io/avatar/fd2e41aec83c11fc97b9915fe441cb76",
    "language": "",
    "is_admin": false,
    "last_login": "0001-01-01T00:00:00Z",
    "created": "2022-10-04T19:23:51Z",
    "restricted": false,
    "active": false,
    "prohibit_login": false,
    "location": "",
    "website": "",
    "description": "",
    "visibility": "public",
    "followers_count": 0,
    "following_count": 0,
    "starred_repos_count": 0,
    "username": "andrewimeson"
  },
  "name": "test_repo",
  "full_name": "andrewimeson/test_repo",
  "description": "",
  "empty": true,
  "private": false,
  "fork": false,
  "template": false,
  "parent": null,
  "mirror": false,
  "size": 76,
  "language": "",
  "languages_url": "https://try.gitea.io/api/v1/repos/andrewimeson/test_repo/languages",
  "html_url": "https://try.gitea.io/andrewimeson/test_repo",
  "ssh_url": "git@try.gitea.io:andrewimeson/test_repo.git",
  "clone_url": "https://try.gitea.io/andrewimeson/test_repo.git",
  "original_url": "",
  "website": "",
  "stars_count": 0,
  "forks_count": 0,
  "watchers_count": 1,
  "open_issues_count": 0,
  "open_pr_counter": 0,
  "release_counter": 0,
  "default_branch": "main",
  "archived": false,
  "created_at": "2022-10-04T19:24:34Z",
  "updated_at": "2022-10-04T19:33:28Z",
  "permissions": {
    "admin": true,
    "push": true,
    "pull": true
  },
  "has_issues": true,
  "external_tracker": {
    "external_tracker_url": "https://jira.example.com/projects/LOL/issues",
    "external_tracker_format": "https://jira.example.com/browse/LOL-{index}",
    "external_tracker_style": "regexp"
  },
  "has_wiki": true,
  "has_pull_requests": true,
  "has_projects": true,
  "ignore_whitespace_conflicts": false,
  "allow_merge_commits": true,
  "allow_rebase": true,
  "allow_rebase_explicit": true,
  "allow_squash_merge": true,
  "allow_rebase_update": true,
  "default_delete_branch_after_merge": false,
  "default_merge_style": "merge",
  "avatar_url": "",
  "internal": false,
  "mirror_interval": "",
  "mirror_updated": "0001-01-01T00:00:00Z",
  "repo_transfer": null
}

Gitea Version

1.17.2

Can you reproduce the bug on the Gitea demo site?

Yes

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

No response

How are you running Gitea?

Helm chart

Database

PostgreSQL

Originally created by @andrewimeson on GitHub (Oct 4, 2022). ### Description The external issue tracker regular expression feature isn't configurable via the Gitea API. Other aspects of the external issue tracker are configurable via the API, but the regexp pattern specifically is not. Example: ```sh curl -X 'PATCH' \ 'https://try.gitea.io/api/v1/repos/andrewimeson/test_repo?token=redacted' \ -H 'accept: application/json' \ -H 'Content-Type: application/json' \ -d '{ "external_tracker": { "external_tracker_format": "https://jira.example.com/browse/LOL-{index}", "external_tracker_style": "regexp", "external_tracker_regexp_pattern": "LOL-(\\d+)", "external_tracker_url": "https://jira.example.com/projects/LOL/issues" }, "has_issues": true }' ``` which responds with this JSON, which you can see is missing the `external_tracker_regexp_pattern` field. The field name I guessed at, but if I set it in the web UI and then execute the API request again it still doesn't show the regex in the JSON response: ```json { "id": 37590, "owner": { "id": 518534, "login": "andrewimeson", "login_name": "", "full_name": "", "email": "andrewimeson@noreply.try.gitea.io", "avatar_url": "https://try.gitea.io/avatar/fd2e41aec83c11fc97b9915fe441cb76", "language": "", "is_admin": false, "last_login": "0001-01-01T00:00:00Z", "created": "2022-10-04T19:23:51Z", "restricted": false, "active": false, "prohibit_login": false, "location": "", "website": "", "description": "", "visibility": "public", "followers_count": 0, "following_count": 0, "starred_repos_count": 0, "username": "andrewimeson" }, "name": "test_repo", "full_name": "andrewimeson/test_repo", "description": "", "empty": true, "private": false, "fork": false, "template": false, "parent": null, "mirror": false, "size": 76, "language": "", "languages_url": "https://try.gitea.io/api/v1/repos/andrewimeson/test_repo/languages", "html_url": "https://try.gitea.io/andrewimeson/test_repo", "ssh_url": "git@try.gitea.io:andrewimeson/test_repo.git", "clone_url": "https://try.gitea.io/andrewimeson/test_repo.git", "original_url": "", "website": "", "stars_count": 0, "forks_count": 0, "watchers_count": 1, "open_issues_count": 0, "open_pr_counter": 0, "release_counter": 0, "default_branch": "main", "archived": false, "created_at": "2022-10-04T19:24:34Z", "updated_at": "2022-10-04T19:33:28Z", "permissions": { "admin": true, "push": true, "pull": true }, "has_issues": true, "external_tracker": { "external_tracker_url": "https://jira.example.com/projects/LOL/issues", "external_tracker_format": "https://jira.example.com/browse/LOL-{index}", "external_tracker_style": "regexp" }, "has_wiki": true, "has_pull_requests": true, "has_projects": true, "ignore_whitespace_conflicts": false, "allow_merge_commits": true, "allow_rebase": true, "allow_rebase_explicit": true, "allow_squash_merge": true, "allow_rebase_update": true, "default_delete_branch_after_merge": false, "default_merge_style": "merge", "avatar_url": "", "internal": false, "mirror_interval": "", "mirror_updated": "0001-01-01T00:00:00Z", "repo_transfer": null } ``` ### Gitea Version 1.17.2 ### Can you reproduce the bug on the Gitea demo site? Yes ### Log Gist _No response_ ### Screenshots _No response_ ### Git Version _No response_ ### Operating System _No response_ ### How are you running Gitea? Helm chart ### Database PostgreSQL
GiteaMirror added the type/bug label 2025-11-02 08:45:37 -06:00
Author
Owner

@andrewimeson commented on GitHub (Oct 4, 2022):

I believe it needs to be added here: https://github.com/go-gitea/gitea/blob/release/v1.17/modules/structs/repo.go#L32 . The API documentation is also out of date for external_tracker_style and needs to mention regexp as a valid value

Feature introduced in #17624

@andrewimeson commented on GitHub (Oct 4, 2022): I believe it needs to be added here: https://github.com/go-gitea/gitea/blob/release/v1.17/modules/structs/repo.go#L32 . The API documentation is also out of date for `external_tracker_style` and needs to mention `regexp` as a valid value Feature introduced in #17624
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#9654