1. 程式人生 > >自動化部署之gitlab權限管理--issue管理

自動化部署之gitlab權限管理--issue管理

自動化部署 gitlab

  • 創建Group,User,Project

  • 創建一個組,組名為java

    Group path http://192.168.56.11/java
    Visibility Level:    #為權限級別,一般使用Private
    Private
    Internal
    Public

    創建一個PM的用戶作為項目管理者並加入到java組內

    技術分享圖片

    創建一個項目:

    技術分享圖片

    創建dev1和dev2的用戶作為開發者,並加入到項目中

    技術分享圖片


    2.測試dev1,dev2拉取代碼庫

    (1)生成ssh-key
    [root@linux-node1 ~]# ssh-keygen 
    Generating public/private rsa key pair.
    Enter file in which to save the key (/root/.ssh/id_rsa): 
    Created directory '/root/.ssh'.
    Enter passphrase (empty for no passphrase): 
    Enter same passphrase again: 
    Your identification has been saved in /root/.ssh/id_rsa.
    Your public key has been saved in /root/.ssh/id_rsa.pub.
    The key fingerprint is:
    SHA256:Hf3O9F7sS9N04cFUr3Awb/Wec28gTpHYyRZMCzLW9q0 root@linux-node1
    The key's randomart image is:
    +---[RSA 2048]----+
    |        +..o=  .+|
    |       . oo*.Oo.o|
    |         .o.@.++o|
    |         . o.*oo+|
    |        S . o.=+=|
    |           oE= =*|
    |            . ooB|
    |              .+o|
    |               .+|
    +----[SHA256]-----+
    [root@linux-node1 ~]# cat .ssh/id_rsa.pub 
    ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDLDVIqTAvJtj8Uc+SvhcKOKuDtURt3YBxHo9enUkDjOWtSygLZI4hSrEsnvjHdnxeBGOgjPrxEfMMdNCno4pox7V/8bIU9LRVp2eeQFS+N+bSmbJlTKyODa0tabPwT7URYoiFI3giQamQdA0AwwPCPM/RcXwHJsw4q0O/2woCqNKq2tHaUFBqojd2KvqavzpB+4+AdKJSoabwLhE8dzfjIR/eHY31Y2C/+m9sU504v+R0GsAqr5uifi6Ct9eFvumI54BvHssIpZFZmADTT35b1aP0WSwZb2VEhXjaia8L6h/6ANn1NuHGgYZqNiYT6JILESKbrc7PyJOn9DfHKSMq9 root@linux-node1
    
    (2)將公鑰(id_rsa.pub)放進dev1賬戶中
    在admin賬戶下給dev1,dev2賬戶設置密碼,然後使用dev1登錄gitlab,做如下操作添加ssh-key:
    測試是否能正常拉取代碼庫app1
    [root@linux-node1 ~]# git clone [email protected]:java/app1.git
    Cloning into 'app1'...
    The authenticity of host '192.168.56.11 (192.168.56.11)' can't be established.
    ECDSA key fingerprint is SHA256:p2lhKmsPQ6K+dWHHvbJg0GV+Ni9VM7vlViKrYsZLP1s.
    ECDSA key fingerprint is MD5:22:14:1c:37:de:47:1c:4a:2f:88:b1:dc:e2:d0:02:17.
    Are you sure you want to continue connecting (yes/no)? yes
    Warning: Permanently added '192.168.56.11' (ECDSA) to the list of known hosts.
    warning: You appear to have cloned an empty repository.
    Checking connectivity... done.
    [root@linux-node1 ~]# ll
    total 6804
    -rw-------.  1 root root     948 Dec  3 01:21 anaconda-ks.cfg
    drwxr-xr-x   3 root root      17 Dec 20 15:00 app1
    drwxr-xr-x  22 root root   24576 Dec  8 22:16 git-2.7.4
    drwxr-xr-x   3 root root      65 Dec  9 01:23 test
    -rw-r--r--   1 root root 6918037 Dec  8 22:09 v2.7.4.zip
    [root@linux-node1 ~]# cd app1
    [root@linux-node1 app1]# ll
    total 4
    -rw-r--r-- 1 root root 19 Dec 20 15:05 readme

    技術分享圖片

    到此,Linux環境下完成了gitlab的授權管理代碼庫。


    下面以PM用戶進行創建開發計劃

    開發一個官網V1.0版本,包含首頁和新聞


    (1)創建裏程碑(Milestone

    技術分享圖片

    (2)依次把任務首頁,新聞添加到裏程碑,並進行任務分配給開發者

    技術分享圖片(3)使用dev1用戶登錄查看,會有任務提示,如圖:

    技術分享圖片

    (4)dev1開發者收到任務,進行開發

    [root@linux-node1 app1]# git checkout -b shouye    #創建首頁分支
    Switched to a new branch 'shouye'
    [root@linux-node1 app1]# git status
    On branch shouye
    nothing to commit, working directory clean
    [root@linux-node1 app1]# echo "<h1> welcome to www.123.com" > index.html    #進行開發
    [root@linux-node1 app1]# ll
    total 8
    -rw-r--r-- 1 root root 28 Dec 20 15:50 index.html
    -rw-r--r-- 1 root root 19 Dec 20 15:05 readme
    [root@linux-node1 app1]# git add .
    [root@linux-node1 app1]# git commit -m "shouye"    #開發完成,提交本地倉庫
    [shouye babdcb5] shouye
     1 file changed, 1 insertion(+)
     create mode 100644 index.html
    [root@linux-node1 app1]# git push origin shouye    #提交到遠程庫
    Counting objects: 3, done.
    Compressing objects: 100% (2/2), done.
    Writing objects: 100% (3/3), 292 bytes | 0 bytes/s, done.
    Total 3 (delta 0), reused 0 (delta 0)
    remote: 
    remote: To create a merge request for shouye, visit:
    remote:   http://192.168.56.11/java/app1/merge_requests/new?merge_request%5Bsource_branch%5D=shouye
    remote: 
    To [email protected]:java/app1.git
     * [new branch]      shouye -> shouye
     
     可以看到有剛才創建的分支,點擊"merge request"合並分支請求,之後PM用戶登錄處理合並請求。此時,一個功能的開發流程就完成。

    技術分享圖片技術分享圖片


    總結:

    1. PM在gitlab創建任務,分配給開發人員

    2. 開發人員領取任務後,在本地使用git clone拉取代碼庫

    3. 開發人員創建開發分支(git checkout -b dev),並進行開發

    4. 開發人員完成之後,提交到本地倉庫(git commit )

    5. 開發人員在gitlab界面上申請分支合並請求(Merge request)

    6. PM在gitlab上查看提交和代碼修改情況,確認無誤後,確認將開發人員的分支合並到主分支(master)

    7. 開發人員在gitlab上Mark done確認開發完成,並關閉issue。這一步在提×××並請求時可以通過描述中填寫"close #1"等字樣,可以直接關閉issue。















    自動化部署之gitlab權限管理--issue管理