Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
andrewimeson opened this issue Oct 4, 2022 · 1 comment · Fixed by #21338
Closed
Labels

Comments

@andrewimeson
Copy link
Contributor

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

@andrewimeson
Copy link
Contributor Author

andrewimeson commented 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

wxiaoguang pushed a commit that referenced this issue Oct 7, 2022
Fixes #21336 

Signed-off-by: Andrew Imeson <andrew@andrewimeson.com>
@go-gitea go-gitea locked and limited conversation to collaborators May 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant