gitlab通過api建立組、項目、成員

來源:互聯網
上載者:User

標籤:amp   within   rsh   eating   require   pipe   desc   git   tor   

前戲

擷取gitlab中admin使用者的private_token

Groups API擷取某個組的詳細

curl --header "PRIVATE-TOKEN: *********" http://192.168.10.7:8090/api/v4/groups/client   #擷取client組的詳細資料

client組的詳細資料
{"id":6,"name":"client","path":"client","description":"用戶端","visibility":"private","lfs_enabled":true,"avatar_url":null,"web_url":"http://192.168.10.7:8090/groups/client","request_access_enabled":false,"full_name":"client","full_path":"client","parent_id":null,"projects":[],"shared_projects":[]}
添加一個組
POST /groups

Parameters:

  • name (required) - The name of the group #必須
  • path (required) - The path of the group  #必須
  • description (optional) - The group‘s description
  • membership_lock (optional, boolean) - Prevent adding new members to project membership within this group
  • share_with_group_lock (optional, boolean) - Prevent sharing a project with another group within this group
  • visibility (optional) - The group‘s visibility. Can be private, internal, or public.
  • lfs_enabled (optional) - Enable/disable Large File Storage (LFS) for the projects in this group
  • request_access_enabled (optional) - Allow users to request member access.
  • parent_id (optional) - The parent group id for creating nested group.
  • shared_runners_minutes_limit (optional) - (admin-only) Pipeline minutes quota for this group
 

curl --request POST --header "PRIVATE-TOKEN: *****" --data "name=shanxi&path=shanxi" http://192.168.10.7:8090/api/v4/groups; #添加山西組

添加一個子組

gitlab社區版在9.0以後增加了子組的功能,比如我在shanxi這個組下面添加taiyuan這個子組

curl --request POST --header "PRIVATE-TOKEN: ******" --data "name=taiyuan&path=taiyuan&parent_id=父組的id" http://192.168.10.7:8090/api/v4/groups;

User API添加一個使用者

curl  -d "password=$password&email=$mail&username=$username&name=$name&private_token=************" http://192.168.10.7:8090/api/v4/users

Projects API添加一個項目

加入shanxi組的id是4,我想在shanxi組下面建立一個majiang項目

curl --request POST --header "PRIVATE-TOKEN: *********" --data "name=majiang&namespace_id=4" http://192.168.10.7:8090/api/v4/projects

 

詳細文檔猛戳

https://docs.gitlab.com/ee/api/README.html

gitlab通過api建立組、項目、成員

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.