Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-59548

Automatically enable "Deploy Key" for Gitlab project

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      To enable Jenkins to checkout our Git projects from Gitlab, the "Deploy Key" of Jenkins currently must be enabled for each project in Gitlab individually.This is a tedious task that can be automated using the Gitlab API.

      A practical example:

      1. In Gitlab, go to "Admin Area" -> "Deploy Keys" and add a new key that we will call "jenkins-gitlab".
      2. To enable Jenkins to checkout the source code of the project named "MyProject", we must enable the deploy key for this project in Gitlab. For this, I currently have to go to the Settings of the gitlab project "MyProject" manually ("Settings" -> "Repository" -> "Deploy Keys") to enable the Deploy Key called "jenkins-gitlab").

      Using the gitlab-branch-source-plugin, this is the only thing I currently still have to do manually for each new gitlab project.

      Fortunately, this could be automated using the Gitlab API. Please have a look at the section "Enable a deploy key": https://docs.gitlab.com/ce/api/deploy_keys.html#enable-a-deploy-key

      If would be really great if I could configure the "Deploy Key" to use at organization-folder level in Gitlab (or maybe even as a system setting) that "gitlab-branch-source-plugin" uses to automatically call the Gitlab API to enable the deploy config for the gitlab projects. I think this should be offered as a trait that shows a combobox of available Deploy Keys. To fill the combox of available Deploy Keys, you can use this API: https://docs.gitlab.com/ce/api/deploy_keys.html#list-all-deploy-keys

        Attachments

          Activity

          There are no comments yet on this issue.

            People

            Assignee:
            christianciach Christian Ciach
            Reporter:
            christianciach Christian Ciach
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated: