Reputation: 621
I recently installed GitLab to try it out and I am really enjoying it. It's very easy to install and use, still, I found an annoying "problem". I haven't yet found a way to delete Issues associated to projects.
I know that it's not a good practice to remove Issues from the system, but there are some specific occasions where this is really useful, such as when you create an Issue that makes no sense and don't want to be in the system, even after being closed.
So, my question, really simple: Is it possible to delete Issues on GitLab? If so, how can I do it?
I am using GitLab 7.2.1, on Debian wheezy.
Many thanks
Upvotes: 52
Views: 41498
Reputation: 652
Bellow a Python script for doing it automatically using a library python-gitlab:
Install the library:
pip install --upgrade python-gitlab
The script:
import gitlab
access_token = 'xxxxxxxxxxxxxxxxxx'
project_id = 00
author_username = 'user.name'
gl = gitlab.Gitlab(url='https://your-url.com/',
private_token=access_token)
project = gl.projects.get(id=project_id)
while True:
issues = project.issues.list(iterator=True)
if issues.total == 0:
break
for issue in issues:
issue.delete()
print(f'Deleted issue {issue.id}')
Upvotes: 0
Reputation: 21496
Click the Edit
button (Pencil icon for editing the text of the issue)
Below and to the right of the text box where you can enter the description is a big red Delete
button. Click it and confirm.
Personally, I find the hiding of a Delete
button behind the Edit
button and right next to a pretty unrelated Cancel
button to be very unintuitive and weird.
Upvotes: 7
Reputation: 8211
You can do that, but have to modify the database manually. If you have a backup, you can give it a try.
Update: Possible since GitLab 8.6.
Upvotes: 1
Reputation: 383678
At the time this question was asked, No. There is a feature request for that at: https://gitlab.com/gitlab-org/gitlab-ce/issues/2489
Now it seems possible: https://stackoverflow.com/a/36172116/895245
Upvotes: 8
Reputation: 2324
It is now possible to delete issues starting with GitLab 8.6:
GitLab 8.6 released with Deploy to Kubernetes and Subscribe to Label
Delete Issues
Sometimes, simply closing an issue or merge request is not sufficient. For those times, we are now making it possible to delete issues and merge requests.
Only
owners
can delete issues by editing the issue or merge request and clicking, you guessed it,Delete
.
Upvotes: 30
Reputation: 305
You cannot do that any more.
Delete existing issue (Deprecated)
The function is deprecated and returns a 405 Method Not Allowed error if called. An issue gets now closed and is done by calling PUT /projects/:id/issues/:issue_id with parameter closed set to 1.
DELETE /projects/:id/issues/:issue_id
Parameters:
id (required) - The project ID
issue_id (required) - The ID of the issue
Ref: GitLab Documentation
Upvotes: 6