Questions tagged [gitlab-api]

The GitLab API is the api for the GitLab Community Edition.

The GitLab API is the for the GitLab Community Edition, which is hosted on github. See for more information on GitLab.

The GitLab API offers numerous access and management resources, including the most common needed for effective :

Additional API resources are available to provide a rich source control environment. Full documentation can also be found in the GitLab API github repository.

663 questions
2
votes
1 answer

Gitlab API branch listing is caching results / does not display new branches instantly after creation

This problem occurs on a self-hosted instance of GitLab Enterprise Edition (v14.7.2ee). All projects are set to "Internal". Steps to reproduce: List all branches using the API Create a new branch using the API List all branches using the API The…
feedy
  • 1,071
  • 5
  • 17
2
votes
1 answer

How to list all the files present within GitLab repository subfolder using API and recurse over it to read them one by one?

I am developing a project using Nodejs, as per the requirement I would like to list the files present within the subfolder of the GitLab repository using the GitLab API. The subfolder contains many files so I would like to list all the file names…
BATMAN_2008
  • 2,788
  • 3
  • 31
  • 98
2
votes
2 answers

Is there a way to dynamically choose whether a job is run in a Gitlab CI pipeline?

I am trying to have one job check for a word being present in a config file and have that determine whether a subsequent trigger job occurs or not... Like so... stages: - check - trigger_pipeline variables: - TRIGGER_JOB : "0" -…
thebaconator
  • 223
  • 6
  • 10
2
votes
1 answer

How to get GitLab commits of a file using python gitlab module?

We are trying to get the commits of each file in a Gitlab repository. We are using the Python Gitlab module. We could get the commits of a repository but couldn't get the commits of individual files in the repository. Can someone help us with this?
Shiny S U
  • 43
  • 2
  • 5
2
votes
0 answers

Error when create release using gitlab-ci

I tried to create a release using gitlab-ci and got error like this, how to fix it time="2022-01-11T08:19:58Z" level=info msg="Creating Release..." cli=release-cli command=create name=v0.0.28 project-id=3 ref=cb9b21c941d56d5ac592fc5d28610c3dc9981b9d…
northboy
  • 33
  • 3
2
votes
1 answer

Is there a way to get both current and old usernames from a gitlab project with the gitlab python api?

I am currently trying to every single commit out of my gitlab project and put them on a database. I also have a table with all the users of the project which I want to connect with the Commit table. I get all the users of the project via the command…
Edgar Tip
  • 43
  • 2
  • 7
2
votes
1 answer

How to programmatically access the full snippet in Gitlab?

Question My end goal is to have an offline, updateable copy of my snippets (including title & description) such that I can search and use them easily. How can I get all my snippets from Gitlab to my local machine? I'm using Gitlab version is…
Saaru Lindestøkke
  • 2,067
  • 1
  • 25
  • 51
2
votes
1 answer

Can't create annotated tag with gitlab api v4

I'm trying to create annotated tag with POST /tags/ The tag appears without it, even with hardcode param (snippet below). script: - git tag ${TAG} || true - git push origin ${TAG} - '#curl -X POST --header "PRIVATE-TOKEN:…
akse
  • 21
  • 2
2
votes
1 answer

stop previous deployed environment in gitlab CI before deploying new

I deploy an sample project to a minikube k8s cluster via gitlab. I want gitlab (or my CI script) to stop the old deployment/environment before deploying the new one. (to prevent issues when renaming something in k8s.yaml files) The corresponding…
Fritz
  • 831
  • 7
  • 23
2
votes
1 answer

python gitlab api merge request fails with gitlab.execeptions.GitlabMRClosedError 405

I have everything set up to create a branch, make a merge request, commit and merge the request, but it seems to fail on the last step. The commit gets through to gitlab, but the merge request fails with the exception from the title. Example…
Edward Spencer
  • 448
  • 8
  • 10
2
votes
1 answer

How to obtain the GitLab runner ID from the authentication_token?

When I register a runner, I can list my runner details with: # gitlab-runner list Runtime platform arch=amd64 os=linux pid=103997 revision=7a6612da version=13.12.0 Listing configured runners …
DavidGamba
  • 3,503
  • 2
  • 30
  • 46
2
votes
0 answers

GitLab.com Nuget Package registry - This version of nuget.exe does not support

I've tried to use the nuget package registry provided by gitlab.com but there seems to be some kind of API error with the newest version of nuget and the nuget tool from the dotnet CLI. Authentication seems to work but for example nuget list -Source…
TheAnachronism
  • 175
  • 1
  • 13
2
votes
1 answer

Use Gitlab API to create variables on project

I am trying to create a GitLab variable for a project on GitLab using a cURL command. I am following the API and the relevant paragraph here. Looking at the example on the docs, I cannot find any evidence on how Gitlab knows which repo I am trying…
berlin
  • 506
  • 4
  • 14
2
votes
0 answers

Gitlab: Automated action after merge request approval

A sample case is to have a hierarchy of branches, let say develop branch -> UAT branch -> master. I want each MR approval to trigger another MR, that is, merging to UAT would seamlessly create a new MR to master. I have looked through Gitlab API and…
thomp.l
  • 21
  • 1
2
votes
1 answer

Deleting a subdirectory present in a directory inside a project Gitlab

I have a requirement that I need to clean up GitLab repo, and need to remove all empty subdirectories present in a specific directory inside a specific project of a specific group. Since, there are more than 10000 such directories that I need to…
Abhinav Dhiman
  • 745
  • 3
  • 17