Skip to content

How can I enable a runner for a project? #205

Closed

Description

@jurgenhaas

When I receive a runner object I can see a list of all the enabled projects for this runner. I was trying to one and then save the runner, but that doesn't work:

runner = gl.runners.get(1) # type: gitlab.Runner
runner.projects.append({
    'id': 100
})
runner.save()

What's required to make that work? Or is there a different way of doing this?

Activity

  1. gpocentek commented on Jan 21, 2017

    @gpocentek
    Contributor

    This feature is not yet implemented in python-gitlab, I'll work on this.

    As a temporary workaround you can run a raw request to gitlab (untested):

    gl._raw_post('/projects/100/runners', {'runner_id': runner.id})
  2. self-assigned this
    on Jan 21, 2017
  3. daveyjcrocket commented on May 3, 2018

    @daveyjcrocket

    Hi @gpocentek - i saw you added 'create'. in the above fix. 04435e1.

      p = repo._project.manager.gitlab.projects.get(
              'myservice/test/template')
          # all runners, shared or not from the other project in my repo
          list3 = repo._project.runners.list()
          #runners from this project
          list3keys = [x.id for x in list3]
          l = p.runners.list()
          # add non-shared specific runners
          for x in l:
              if not x.is_shared:
                  repo._project.runners.create({'runner_id': x.id})
              else:
                  if x.id in list3keys:
                      repo._project.runners.delete(x.id)
    
    

    is this the right way to disable shared runners and add only my non-shared specials for a project?
    it seems that delete always gets a 404.. even though i checked the list list3keys were actually in the list

  4. locked as resolved and limited conversation to collaborators on Nov 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions