• 1.创建Group,User,Project

创建一个组,组名为java

Group path http://192.168.56.11/java
Visibility Level: #为权限级别,一般使用Private
Private
Internal
Public

创建一个PM的用户作为项目管理者并加入到java组内

Gitlab+Jenkins学习之路(三)之gitlab权限管理--issue管理-LMLPHP

创建一个项目:

Gitlab+Jenkins学习之路(三)之gitlab权限管理--issue管理-LMLPHP

创建dev1和dev2的用户作为开发者,并加入到项目中

Gitlab+Jenkins学习之路(三)之gitlab权限管理--issue管理-LMLPHP

  •  2.测试dev1,dev2拉取代码库

()生成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 ]----+
| +..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++AdKJSoabwLhE8dzfjIR/eHY31Y2C/+m9sU504v+R0GsAqr5uifi6Ct9eFvumI54BvHssIpZFZmADTT35b1aP0WSwZb2VEhXjaia8L6h/6ANn1NuHGgYZqNiYT6JILESKbrc7PyJOn9DfHKSMq9 root@linux-node1 ()将公钥(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:::1c::de::1c:4a:2f::b1:dc:e2:d0::.
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
-rw-------. root root Dec : anaconda-ks.cfg
drwxr-xr-x root root Dec : app1
drwxr-xr-x root root Dec : git-2.7.
drwxr-xr-x root root Dec : test
-rw-r--r-- root root Dec : v2.7.4.zip
[root@linux-node1 ~]# cd app1
[root@linux-node1 app1]# ll
total
-rw-r--r-- root root Dec : readme

Gitlab+Jenkins学习之路(三)之gitlab权限管理--issue管理-LMLPHP

到此,Linux环境下完成了gitlab的授权管理代码库。

下面以PM用户进行创建开发计划

开发一个官网V1.0版本,包含首页和新闻

 (1)创建里程碑(Milestone

Gitlab+Jenkins学习之路(三)之gitlab权限管理--issue管理-LMLPHP

(2)依次把任务首页,新闻添加到里程碑,并进行任务分配给开发者

Gitlab+Jenkins学习之路(三)之gitlab权限管理--issue管理-LMLPHP

(3)使用dev1用户登录查看,会有任务提示,如图:

Gitlab+Jenkins学习之路(三)之gitlab权限管理--issue管理-LMLPHP

(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
-rw-r--r-- root root Dec : index.html
-rw-r--r-- root root Dec : readme
[root@linux-node1 app1]# git add .
[root@linux-node1 app1]# git commit -m "shouye" #开发完成,提交本地仓库
[shouye babdcb5] shouye
file changed, insertion(+)
create mode index.html
[root@linux-node1 app1]# git push origin shouye #提交到远程库
Counting objects: , done.
Compressing objects: % (/), done.
Writing objects: % (/), bytes | bytes/s, done.
Total (delta ), reused (delta )
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用户登录处理合并请求。此时,一个功能的开发流程就完成。

Gitlab+Jenkins学习之路(三)之gitlab权限管理--issue管理-LMLPHP

Gitlab+Jenkins学习之路(三)之gitlab权限管理--issue管理-LMLPHP

总结:

  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。

05-08 08:20