目录

使用doryctl运行流水线

Summary
  • 使用doryctl运行流水线

使用doryctl运行流水线

任务演示视频

  • 演示如何使用doryctl在命令行界面执行流水线

doryctl命令行管理工具概览

  • doryctldory-core的命令行管理工具,可以用于安装dory-core集群服务,以及管理dory-core中的资源
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# 获取doryctl命令帮助
doryctl --help
doryctl is a command line toolkit to manage dory-core

Usage:
  doryctl is a command line toolkit
  doryctl [command]

Examples:
  # install dory-core
  doryctl install run -o readme-install -f install-config.yaml

Available Commands:
  completion  generate the autocompletion script for the specified shell
  help        Help about any command
  install     install dory-core with docker or kubernetes
  login       login to dory-core server
  logout      logout from dory-core server
  pipeline    manage pipeline resources
  project     manage project resources
  run         manage pipeline run resources
  version     show doryctl version info

Flags:
  -c, --config string      doryctl config.yaml config file, it can set by system environment variable DORYCONFIG (default is $HOME/.doryctl/config.yaml)
  -h, --help               help for doryctl
      --insecure           if true, the servers certificate will not be checked for validity. This will make your HTTPS connections insecure
      --language string    language settings (options: ZH / EN)
  -s, --serverURL string   dory-core server URL, example: https://dory.example.com:8080
      --timeout int        dory-core server connection timeout seconds settings (default 5)
      --token string       dory-core server access token
  -v, --verbose            show logs in verbose mode

Use "doryctl [command] --help" for more information about a command.

使用doryctl登录并连接dory-core

  • 使用doryctl login命令,登录dory-core服务,完成登录操作后就可以执行各种资源管理命令
1
2
# 登录dory-core服务
doryctl login --serverURL ${SERVER_URL} --username ${DORY_USER} --password ${DORY_PWD}

使用doryctl执行流水线

  • 一旦登录dory-core服务成功后,可以使用命令查看dory-core中的项目流水线运行等资源
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# 查看项目资源
doryctl project get
NAME         	SHORTNAME	ENVNAMES	NODEPORTS              	PIPELINES                               
test-project1	tp1      	test    	30100-30109,30110-30119	test-project1-develop,test-project1-ops	
test-project2	tp2      	test    	30120-30129            	test-project2-develop,test-project2-ops	
test-project3	tp3      	test    	30130-30139            	test-project3-develop,test-project3-ops	

# 以yaml格式查看项目资源
doryctl project get test-project1 -o yaml
NAME                 	BRANCH 	ENVS	ENVPRODS	SUCCESS	FAIL	ABORT	LASTRUN                  
test-project1-develop	develop	test	        	68     	4   	4    	02-15 09:44:15 [SUCCESS]	
test-project1-ops    	       	    	        	10     	1   	1    	02-15 14:41:20 [SUCCESS]	
test-project2-develop	develop	test	        	0      	0   	0    	                        	
test-project2-ops    	       	    	        	0      	0   	0    	                        	
test-project3-develop	develop	test	        	0      	0   	0    	                        	
test-project3-ops    	       	    	        	0      	0   	0    	                        	

# 查看流水线资源
doryctl pipeline get
NAME                 	BRANCH 	ENVS	ENVPRODS	SUCCESS	FAIL	ABORT	LASTRUN                  
test-project1-develop	develop	test	        	68     	4   	4    	02-15 09:44:15 [SUCCESS]	
test-project1-ops    	       	    	        	10     	1   	1    	02-15 14:41:20 [SUCCESS]	
test-project2-develop	develop	test	        	0      	0   	0    	                        	
test-project2-ops    	       	    	        	0      	0   	0    	                        	
test-project3-develop	develop	test	        	0      	0   	0    	                        	
test-project3-ops    	       	    	        	0      	0   	0    	                        	

# 查看流水线运行记录
doryctl run get
NAME                    	STARTUSER 	ABORTUSER 	STARTTIME     	STATUS 	DURATION   
test-project1-ops-16    	dory-admin	          	02-15 14:41:20	SUCCESS	50s991ms  	
test-project1-develop-79	dory-admin	          	02-15 09:44:15	SUCCESS	1m8s      	
test-project1-develop-78	dory-admin	          	02-15 09:40:16	SUCCESS	12s959ms  	
test-project1-develop-77	dory-admin	          	02-15 09:35:57	SUCCESS	12s359ms  	
test-project1-develop-76	dory-admin	          	02-15 09:31:47	SUCCESS	1m8s      	
test-project1-develop-75	dory-admin	          	02-15 09:17:31	SUCCESS	1m8s      	
test-project1-develop-74	dory-admin	          	02-15 03:05:00	SUCCESS	1m3s      	
test-project1-develop-73	dory-admin	          	02-14 21:25:40	SUCCESS	1m3s      	
test-project1-develop-72	dory-admin	          	02-14 15:53:30	SUCCESS	1m2s      	
test-project1-develop-71	dory-admin	          	02-14 15:52:39	SUCCESS	1m54s     	
test-project1-ops-15    	dory-admin	          	02-14 14:51:51	SUCCESS	11s838ms  	

# 查看流水线运行日志
doryctl run logs test-project1-ops-16
  • 使用doryctl执行流水线,如果执行过程中需要手工输入信息,可以直接在命令行界面输入信息
1
2
# 执行流水线
doryctl pipeline execute test-project1-ops
  • 使用doryctl可以让jenkins、argocd、gitlab-ci等各种流水线工具与DORY实现无缝集成。