1
- # pipeline
1
+ # steps
2
2
3
3
## 基本指令
4
4
5
- ` pipeline ` 指令用来设置具体的构建步骤,每个步骤均运行在容器中,所以每个步骤必须首先指定 Docker Image 名称 (` image ` ) 和具体的构建指令 (` commands ` ) 。
5
+ ` steps ` 指令用来设置具体的构建步骤,每个步骤均运行在容器中,所以每个步骤必须首先指定 Docker Image 名称 (` image ` ) 和具体的构建指令 (` commands ` ) 。
6
6
7
- > pipeline 指令可以包含多个构建步骤
7
+ > steps 指令可以包含多个构建步骤
8
8
9
9
``` yaml
10
- pipeline :
10
+ steps :
11
11
php :
12
12
image : khs1994/php-fpm:7.4.3-alpine
13
13
commands :
@@ -29,12 +29,12 @@ pipeline:
29
29
30
30
设置构建步骤所运行的命令。
31
31
32
- # # 3. `environment` 环境变量
32
+ # # 3. `environment`
33
33
34
34
除了以上两个基本指令外,还可以像我们平时使用 `$ docker container run -e "K=V" ...` 命令那样设置 **环境变量**。
35
35
36
36
` ` ` yaml
37
- pipeline :
37
+ steps :
38
38
php:
39
39
image: khs1994/php-fpm:7.4.3-alpine
40
40
environment:
@@ -44,12 +44,12 @@ pipeline:
44
44
- vendor/bin/phpunit
45
45
` ` `
46
46
47
- # # 4. `pull` 镜像拉取策略
47
+ # # 4. `pull`
48
48
49
49
每次构建时,无论 Docker Image 是否存在总是拉取镜像,可以使用 `pull : true` 指令(默认为 `false`)。
50
50
51
51
` ` ` yaml
52
- pipeline :
52
+ steps :
53
53
php:
54
54
image: khs1994/php-fpm:7.4.3-alpine
55
55
pull: true
@@ -63,35 +63,35 @@ pipeline:
63
63
默认的 shell 为 `sh`,你可以改为 `bash`
64
64
65
65
` ` ` yaml
66
- pipeline :
66
+ steps :
67
67
php:
68
68
image: khs1994/php-fpm:7.4.3-alpine
69
69
shell: bash
70
70
` ` `
71
71
72
72
全部支持的 `shell` 包括 `sh` `bash` `python` `pwsh` `node`
73
73
74
- # # 6. `when` 构建条件
74
+ # # 6. `if`
75
75
76
- 可以通过 `when ` 指令设置构建条件。
76
+ 可以通过 `if ` 指令设置构建条件。
77
77
78
78
` ` ` yaml
79
- pipeline :
79
+ steps :
80
80
php:
81
81
image: khs1994/php-fpm:7.4.3-alpine
82
82
commands:
83
83
- composer install -q
84
84
- vendor/bin/phpunit
85
- when :
85
+ if :
86
86
event: tag
87
87
` ` `
88
88
89
- 增加以上的 `when ` 指令之后,构建仅在 Git 打标签之后执行,当 push、pull_request 均不进行构建。
89
+ 增加以上的 `if ` 指令之后,构建仅在 Git 打标签之后执行,当 push、pull_request 均不进行构建。
90
90
91
91
全部可用的设置如下:
92
92
93
93
` ` ` yaml
94
- when :
94
+ if :
95
95
# platform: linux/amd64
96
96
# platform: [ linux/*, windows/amd64 ]
97
97
@@ -109,7 +109,7 @@ when:
109
109
# include: [ master, release/* ]
110
110
# exclude: [ release/1.0.0, release/1.1.* ]
111
111
112
- # matrix :
112
+ # jobs :
113
113
# - K: v
114
114
# K2: v2
115
115
# K3: v3
@@ -124,7 +124,7 @@ when:
124
124
该指令用来配置插件。
125
125
126
126
` ` ` yaml
127
- pipeline :
127
+ steps :
128
128
settings:
129
129
provider: docker
130
130
k: v
0 commit comments