组、子组、用户、项目
group、subgroup、user、为gitlab中3个namespace的概念,
如用户wang注册了gitlab账户,创建了cncf组,又在cncf组创建了子组k8s,那么wang、cncf、k8s就是三个不同的名称空间,在名称空间下,可以创建project项目;
url分别为:
项目project,可以在组或子组中创建,如在cncf组里创建了app1这一project,其url就是:
开发流程示例
-
gitlab管理员创建pm账户,2个开发账户,此处为user1和user2
-
pm登陆并创建组,并在组下创建一个project
创建组;
创建project项目
邀请2个开发用户到pm的组中,对mygroup有开发权限
-
2个开发账户生成密钥对,并上传到自己的gitlab账户中,然后测试拉取pm创建的project1的仓库(因上步已经user1和user2加入了project1的成员为devloper权限)
生成密钥对,上传到开发账户略,
[user1@git-client ~]$ git clone git@192.168.80.102:mygroup1/myproject1.git Cloning into 'myproject1'... The authenticity of host '192.168.80.102 (192.168.80.102)' can't be established. ECDSA key fingerprint is SHA256:qLoTkwl898icJA1iYfTdIG7SM15+vkmEibFyCGbB1yc. ECDSA key fingerprint is MD5:2a:08:eb:ae:a7:dc:82:19:0b:23:1a:27:2a:c2:2f:41. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added '192.168.80.102' (ECDSA) to the list of known hosts. remote: Enumerating objects: 3, done. remote: Counting objects: 100% (3/3), done. remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0 Receiving objects: 100% (3/3), done. [user1@git-client ~]$ ll total 0 drwxrwxr-x 3 user1 user1 35 Dec 6 15:38 myproject1 [user1@git-client ~]$ ls myproject1/ README.md # 查看拉取的代码库状态;可以看到,只有pm创建的init的commit提交,之后各个开发就可以在自己本地开发,然后提交,请求合并 [user2@git-client myproject1]$ git status # On branch master nothing to commit, working directory clean [user2@git-client myproject1]$ git log commit 500f962b7cef84c42b10f573ec051303a6b83e13 Author: pm <boogies@163.com> Date: Sun Dec 6 13:57:35 2020 +0800 Initial commit
-
创建milestone里程碑,即项目的开项
-
分配project任务给开发,提issue
给开发提issue,就是一个个开发、或bug修复任务,被分配到的开发会收到通知;
-
开发登陆,查看issue,拉取项目库到本地
查看自己被分配的issue
-
本地拉取开发分支,开发,开发后commit
[user1@git-client myproject1]$ whoami user1 [user1@git-client myproject1]$ git branch * master [user1@git-client myproject1]$ git checkout -b frontend Switched to a new branch 'frontend' [user1@git-client myproject1]$ touch frontend [user1@git-client myproject1]$ git add frontend [user1@git-client myproject1]$ git commit -m 'frontend done!' *** Please tell me who you are. Run git config --global user.email "you@example.com" git config --global user.name "Your Name" to set your account's default identity. Omit --global to set the identity only in this repository. fatal: empty ident name (for <user1@git-client.(none)>) not allowed [user1@git-client myproject1]$ git config --global user.email '1210839056@qq.com' [user1@git-client myproject1]$ git config --global user.name 'user1' [user1@git-client myproject1]$ git commit -m 'frontend done!' [frontend a6cad36] frontend done! 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 frontend [user1@git-client myproject1]$ git remote -v origin git@192.168.80.102:mygroup1/myproject1.git (fetch) origin git@192.168.80.102:mygroup1/myproject1.git (push)
-
本地commit后push到远程gitlab仓库
# 把frontend分支,推送到远端库 [user1@git-client myproject1]$ git push origin frontend Counting objects: 4, done. Delta compression using up to 2 threads. Compressing objects: 100% (2/2), done. Writing objects: 100% (3/3), 268 bytes | 0 bytes/s, done. Total 3 (delta 0), reused 0 (delta 0) remote: remote: To create a merge request for frontend, visit: remote: http://192.168.80.102/mygroup1/myproject1/-/merge_requests/new?merge_request%5Bsource_branch%5D=frontend remote: To git@192.168.80.102:mygroup1/myproject1.git * [new branch] frontend -> frontend
-
开发登陆,对pm提起merge request
-
pm登陆,收到merege request请求后检查,检查通过合并
-
开发关闭issue,确认开发完成
回到issue页面,关闭相应的issue即可;
开发流程总结
- 项目经理创建项目project,如app1,然后分配不同任务给各个研发人员,如user1开发前端、user2开发后端;
- 开发人员收到任务通知,拉取空的初始project到本地
- 开发人员git checkout -b 开发分支,在自己的开发分支进行开发
- 开发后,本地提交,然后push到远程gitlab仓库
- 开发人员登陆自己的gitlab账户,向项目经理提出merge request请求合并代码
- 项目经理登陆自己的gitlab账户,收到开发的合并代码请求,然后检查,检查无误后,合并到主分支
- 开发在gitlab界面标记被分配的任务已经完成,并关闭项目经理分配的issue,