Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • 18:26
    anarcat closed #1645
  • 18:26
    anarcat commented #1645
  • 18:19
    anarcat opened #1645
  • 13:02
    LiamInJapan closed #1639
  • 13:02
    LiamInJapan commented #1639
  • Oct 18 09:34
    StingRayZA review_requested #1610
  • Oct 18 09:34
    StingRayZA commented #1610
  • Oct 18 09:32
    StingRayZA synchronize #1610
  • Oct 18 09:03
    LiamInJapan opened #1644
  • Oct 17 19:23
    nejch commented #1610
  • Oct 17 19:22
    nejch unassigned #1610
  • Oct 17 19:22
    nejch assigned #1610
  • Oct 17 17:19
    nejch commented #1628
  • Oct 17 17:19

    nejch on main

    fix(api): delete invalid 'proje… (compare)

  • Oct 17 17:19
    nejch closed #1628
  • Oct 17 17:19
    nejch closed #1608
  • Oct 17 17:14
    codecov-commenter commented #1628
  • Oct 17 17:11
    codecov-commenter commented #1628
  • Oct 17 17:05
    codecov-commenter commented #1628
  • Oct 17 17:05
    lgatellier commented #1628
Mythili Parthasarathy
@Mythili-1935_gitlab
Hey hi.. I am new to git lab. Is it possible to access current value of variable in my gitlab yml file using python script??
John Villalovos
@JohnVillalovos
You would have to download the .gitlab-ci.yml file and then parse it.
Mythili Parthasarathy
@Mythili-1935_gitlab
Thanks for the reply.. It is very useful 😇😇😇
@JohnVillalovos
John Villalovos
@JohnVillalovos
👍
Mythili Parthasarathy
@Mythili-1935_gitlab
I used base url as gitlab.com and added my access token that i had created.. But wen i run the Program..i am getting someones else project.. Everytime i run..
John Villalovos
@JohnVillalovos
Code?
Mythili Parthasarathy
@Mythili-1935_gitlab
Import gitlab
Gl= gitlab.Gitlab('url', private_token='')
John Villalovos
@JohnVillalovos
I was expecting more code then that.
Mythili Parthasarathy
@Mythili-1935_gitlab
Oops.. I am unable use enter key thats y.. After that i just looped project in projects and printed it. It gave list of all projects with all attributes of someone else's project.
John Villalovos
@JohnVillalovos
Shift-enter allows you to enter multiple lines
Hi
My name
goes here
And triple back-quote allows code quoting.
Like ```python
import gitlab
gl = gitlab.Gitlab()
I had to use Ctrl-Enter to finish doing my code-quoting.
Mythili Parthasarathy
@Mythili-1935_gitlab
``` import gitlab
gl = gitlab.Gitlab('http://gitlab.com', private_token='token')
projects = gl.projects.list()
for i in projects:
print(i)
John Villalovos
@JohnVillalovos
You are iterating over ALL projects in Gitlab. Not just yours.
Mythili Parthasarathy
@Mythili-1935_gitlab
how to find my gitlab url for connection
John Villalovos
@JohnVillalovos
maybe you want the owned=True parameter?
Also you should use httpS. https://gitlab.com Secure connection.
Mythili Parthasarathy
@Mythili-1935_gitlab
okay i il try these suggestions. Thanks for valuable input @JohnVillalovos
John Villalovos
@JohnVillalovos
Good luck!
Mythili Parthasarathy
@Mythili-1935_gitlab
```owned=True
it worked now. Thanks @JohnVillalovos
John Villalovos
@JohnVillalovos
Great news @Mythili-1935_gitlab ! 👍
Glad to hear:
owned=True
worked
Léon McGregor
@LonMcGregor
Hi, I'm having some trouble. When I try to do the following: project.forks.create I get an AttributeError saying forks is not present. And indeed when I dir() the project object, there is no forks attribute. The rest of the attributes for a project seem to be there, including forks_count, so I'm not sure where I've gone wrong. Any suggestions on how to proceed would be welcome
I've checked and project.forking_access_level says it is enabled
John Villalovos
@JohnVillalovos
@LonMcGregor My initial guess is that your project object was not retrieved with a get
Likely it was retrieved using a list.
I could be wrong about that. But I would double-check that first.
From the docs:
Note

Fetching a list of projects, doesn’t include all attributes of all projects. To retrieve all attributes, you’ll need to fetch a single project
Léon McGregor
@LonMcGregor
@JohnVillalovos Thank you, that looks like the problem.
I thought I had read through the docs but I must have missed that note somehow.
John Villalovos
@JohnVillalovos
👍
Michael Mulich
@mmulich

I'm experiencing a strange behavior where I'm executing gitlab within a container's shell, it appears to do the operation and then crashes...

➜  (host shell) $ docker-compose exec service bash
root@c5a79ce8a14d:/code# gitlab -c ${PYTHON_GITLAB_CFG} project list
[{"id": 1, "description": "This project is automatically generated ...",
...
 "permissions": {"project_access": null, "group_access": {"access_level": 50, "notification_level": 3}}}]
➜  (host shell) $

Any thoughts on what might be happening here?

Michael Mulich
@mmulich
My bad, :point_up: There was a sourced gitlab function that used exec.
Seungwoo Rho
@seungwoo0926_gitlab
I want to send an email using gitlab-api to certain users registered in the project. Is there any way?
Lukas
@ludurr_gitlab
Hi Everyone, i was wondering whether you could point me to some good python examples for cicd in gitlab? Thank you
John Villalovos
@JohnVillalovos
@ludurr_gitlab You might look in: https://gitlab.com/cki-project I know they use python-gitlab. But I personally haven't looked at their usage to see if it is a "good" example. Good luck.
1 reply
Raimund Hook
@stingrayza_gitlab
I'd like to work on #1602 as a first pass at contributing to python-gitlab. Would somebody be able to assign it to me please?
1 reply
Mr. Ben
@kurasoe_twitter
Having an issue with python-gitlab where issue.participants() gives an AttributeName error, but can navigate to /api/v4/projects/id/issues/id/participants just fine. Any thoughts? I'm on 2.10.1 which came from PyPI.
John Villalovos
@JohnVillalovos
@kurasoe_twitter Initial guess is that the issue was retrieved as part of a list operation. Try getting the issue with a get operation.
kodeninja
@kodeninja

Hi, all :wave:

Beginner question. I'm not clear as to how to update an existing snippet. This is what I have so far. It succeeds (I see no errors), but the snippet in question is not updated (almost like a no-op). Is this not issuing a PUT call?

    gl_project = gl_client.projects.get("my_group/my_project", retry_transient_errors=True)

    gl_snippet = gl_project.snippets.get(1234, retry_transient_errors=True)

    new_snippet_json_text = json.dumps(new_snippet_json)
    gl_snippet.code = new_snippet_json_text
    gl_snippet.save(title=gl_snippet.title,
                    description=gl_snippet.description, file_name=gl_snippet.file_name,
                    visibility=gl_snippet.visibility,
                    retry_transient_errors=True)
kodeninja
@kodeninja
Figured it out. Based on the GitLab Snippets API docs, need to set files, instead of code. This worked!
    gl_snippet.files = [
        {
            "action": "update",
            "file_path": gl_snippet.files[0]["path"],
            "content": new_snippet_json_text
        }
    ]

    gl_snippet.save(visibility=gl_snippet.visibility, retry_transient_errors=True)