Skip to content

Allow to access Releases API via CI_JOB_TOKEN #1850

Closed
@MRigal

Description

@MRigal

Description of the problem, including code/CLI snippet

Thanks to #746 we have support for the releases.
Unfortunately we have to load a project to create a release, but getting a project (event its own project like #1393 reported it) is not possible with CI_JOB_TOKEN.

I have made a work-around for this, by creating a fake Project object, but it's not very nice. Maybe we could have a way to use the Releases API with CI_JOB_TOKEN:

# fails with CI_JOB_TOKEN
gitlab_project = client.projects.get(id=1)
# So this work as we aren't querying
gitlab_project = client._objects.Project(client.projects, attrs={"id": 1})
# To be able to do
release = gitlab_project.releases.create({"name": "Supa name"})

Expected Behavior

Not sure... Maybe something like this?

release = client.releases.create({"project_id": 1, "name": "Supa name"})

Actual Behavior

See description above

Specifications

  • python-gitlab version: ALL until at least 3.1
  • API version you are using (v3/v4): v4
  • Gitlab server version (or gitlab.com): 13/14.x

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions