I am using Gitlab integrated with Mantis BT All the required plugins are installed and configured
In Mantis BT, Repositories -> Action -> Manage
, for the required the project click on Update Repository, in that we have a field called Gitlab Repository ID
.
for that project. When I provided some numbers and updated them repository, the result in the change sets is changed but files and issues fields values are not getting updated.
Issues:
The mantis documentation states:
hub_repoid
: id of the Gitlab projet, starting from 1 for the first created project (auto-filed if reponame is valid and readable for the user)
You could use the GitLab API to get that id
GET /projects/NAMESPACE/PROJECT_NAME
curl --header "PRIVATE-TOKEN: <yourPrivateToken>" https://gitlab.example.com/api/v3/projects/NAMESPACE/PROJECT_NAME
The answer includes its id:
{
"id": 3,
"description": null,
"default_branch": "master",
"public": false,
"visibility_level": 0,
...
In the gitlab you have to navigate to the api exposed by GitLab to retrieve the required details.
First of all, you need the project_id for your project. This is exposed via CI_PROJECT_ID variable by GitLab. From the UI, navigate to the project and you would see the project id below the project name.
Once you have the project id then access the following url
https://gitlab.example.com/api/v4/projects/projectId/registry/repositories
this will give you a json response showing all repositories under the project. And you find the id from the response.
[{"id":876,"name":"","path":"group-name/subgroup-name/project-name","project_id":4099,"location":"registry.gitlab.example.com/group-name/subgroup-name/project-name","created_at":"2022-01-06T12:39:28.326Z","cleanup_policy_started_at":null}]
Now using this ID, you can further navigate to the API to fetch more details like container image tags.
for e.g.
https://gitlab.example.com/api/v4/projects/**4099**/registry/repositories/**876**/tags
or more specifically any particular tag
https://gitlab.exmaple.com/api/v4/projects/**4099**/registry/repositories/**876**/tags/**tagName**
Instead of accessing these from browser, it can be accessed from .gitlab-ci.yml as well.
for e.g. below is sample script for deleting a image tag from container registery.
curl --request DELETE --header "PRIVATE-TOKEN: <your_access_token>" \
"https://gitlab.example.com/api/v4/projects/5/registry/repositories/2/tags/v10.0.0"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With