[JIRA] (JENKINS-59548) Automatically enable "Deploy Key" for Gitlab project

7 views
Skip to first unread message

christian.ciach@gmail.com (JIRA)

unread,
Sep 26, 2019, 10:15:01 AM9/26/19
to jenkinsc...@googlegroups.com
Christian Ciach created an issue
 
Jenkins / New Feature JENKINS-59548
Automatically enable "Deploy Key" for Gitlab project
Issue Type: New Feature New Feature
Assignee: Christian Ciach
Components: gitlab-branch-source-plugin
Created: 2019-09-26 14:14
Priority: Minor Minor
Reporter: Christian Ciach

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. If Jenkins should be able to checkout the source code of the project named "MyProject", we must enable the deploy key for this project. For this, I currently have to go to the Settings of the Gitlab-Project 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/ee/api/deploy_keys.html#enable-a-deploy-key

If would be really great if I could configure a "Deploy Token title" 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.

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo

christian.ciach@gmail.com (JIRA)

unread,
Sep 26, 2019, 10:16:02 AM9/26/19
to jenkinsc...@googlegroups.com
Christian Ciach updated an issue
Change By: Christian Ciach
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:
# In Gitlab, go to "Admin Area" -> "Deploy Keys" and add a new key that we will call "jenkins-gitlab".
# 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 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/ee/api/deploy_keys.html#enable-a-deploy-key]

If would be really great if I could configure a "Deploy Token title" 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.

christian.ciach@gmail.com (JIRA)

unread,
Sep 26, 2019, 10:16:39 AM9/26/19
to jenkinsc...@googlegroups.com
Christian Ciach updated an issue
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:
# In Gitlab, go to "Admin Area" -> "Deploy Keys" and add a new key that we will call "jenkins-gitlab".
# If To enable Jenkins should be able to checkout the source code of the project named "MyProject", we must enable the deploy key for this project. For this, I currently have to go to the Settings of the Gitlab-Project 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/ee/api/deploy_keys.html#enable-a-deploy-key]

If would be really great if I could configure a "Deploy Token title" 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.

christian.ciach@gmail.com (JIRA)

unread,
Sep 26, 2019, 10:19:04 AM9/26/19
to jenkinsc...@googlegroups.com
Christian Ciach updated an issue
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:
# In Gitlab, go to "Admin Area" -> "Deploy Keys" and add a new key that we will call "jenkins-gitlab".
# 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 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|https://docs.gitlab.com/ ee/api/deploy_keys.html#enable-a-deploy-key]

If would be really great if I could configure
a the "Deploy Token title 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

christian.ciach@gmail.com (JIRA)

unread,
Sep 26, 2019, 12:27:01 PM9/26/19
to jenkinsc...@googlegroups.com
Christian Ciach updated an issue
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:
# In Gitlab, go to "Admin Area" -> "Deploy Keys" and add a new key that we will call "jenkins-gitlab".
# 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 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|https://docs.gitlab.com/ee/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 ]
Reply all
Reply to author
Forward
0 new messages