Skip to content

Commit 8f58d34

Browse files
authored
fix(pipeline): remove template flag (#522)
1 parent ba1a553 commit 8f58d34

File tree

6 files changed

+26
-34
lines changed

6 files changed

+26
-34
lines changed

action/pipeline/pipeline.go

-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ type Config struct {
1919
Path string
2020
Type string
2121
Stages bool
22-
Template bool
2322
TemplateFiles []string
2423
Local bool
2524
Remote bool

action/pipeline/validate.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ func (c *Config) ValidateLocal(client compiler.Engine) error {
105105
logrus.Tracef("compiling pipeline %s", path)
106106

107107
// compile the object into a pipeline
108-
p, _, err := client.CompileLite(path, c.Template, false)
108+
p, _, err := client.CompileLite(path, false)
109109
if err != nil {
110110
return err
111111
}
@@ -150,8 +150,7 @@ func (c *Config) ValidateRemote(client *vela.Client) error {
150150
//
151151
// https://pkg.go.dev/github.com/go-vela/sdk-go/vela?tab=doc#PipelineOptions
152152
opts := &vela.PipelineOptions{
153-
Output: c.Output,
154-
Template: c.Template,
153+
Output: c.Output,
155154
}
156155

157156
// send API call to validate a pipeline

action/pipeline/validate_test.go

+8-14
Original file line numberDiff line numberDiff line change
@@ -210,22 +210,20 @@ func TestPipeline_Config_ValidateLocal(t *testing.T) {
210210
name: "stages default",
211211
failure: false,
212212
config: &Config{
213-
Action: "validate",
214-
File: "default_stages_template.yml",
215-
Path: "testdata",
216-
Type: "",
217-
Template: true,
213+
Action: "validate",
214+
File: "default_stages_template.yml",
215+
Path: "testdata",
216+
Type: "",
218217
},
219218
},
220219
{
221220
name: "pipeline with template (remote)",
222221
failure: false,
223222
config: &Config{
224-
Action: "validate",
225-
File: "default_template.yml",
226-
Path: "testdata",
227-
Type: "",
228-
Template: true,
223+
Action: "validate",
224+
File: "default_template.yml",
225+
Path: "testdata",
226+
Type: "",
229227
},
230228
},
231229
{
@@ -236,7 +234,6 @@ func TestPipeline_Config_ValidateLocal(t *testing.T) {
236234
File: "default_template.yml",
237235
Path: "testdata",
238236
Type: "",
239-
Template: true,
240237
TemplateFiles: []string{"sample:testdata/templates/template.yml"},
241238
},
242239
},
@@ -248,7 +245,6 @@ func TestPipeline_Config_ValidateLocal(t *testing.T) {
248245
File: "default_multi_template.yml",
249246
Path: "testdata",
250247
Type: "",
251-
Template: true,
252248
TemplateFiles: []string{"sample:testdata/templates/template.yml", "sample2:testdata/templates/template2.yml"},
253249
},
254250
},
@@ -259,7 +255,6 @@ func TestPipeline_Config_ValidateLocal(t *testing.T) {
259255
File: "default_multi_template.yml",
260256
Path: "testdata",
261257
Type: "",
262-
Template: true,
263258
TemplateFiles: []string{"sample2:testdata/templates/template2.yml"},
264259
},
265260
},
@@ -271,7 +266,6 @@ func TestPipeline_Config_ValidateLocal(t *testing.T) {
271266
File: "default_template.yml",
272267
Path: "testdata",
273268
Type: "",
274-
Template: true,
275269
TemplateFiles: []string{"foo:testdata/templates/template.yml"},
276270
},
277271
},

command/pipeline/validate.go

+10-10
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,7 @@ var CommandValidate = &cli.Command{
7272
&cli.BoolFlag{
7373
EnvVars: []string{"VELA_TEMPLATE", "PIPELINE_TEMPLATE"},
7474
Name: "template",
75-
Usage: "enables validating a pipeline with templates",
76-
Value: false,
75+
Usage: "DEPRECATED (Vela CLI will attempt to fetch templates if they exist)",
7776
},
7877
&cli.StringSliceFlag{
7978
EnvVars: []string{"VELA_TEMPLATE_FILE", "PIPELINE_TEMPLATE_FILE"},
@@ -128,13 +127,11 @@ EXAMPLES:
128127
5. Validate a remote pipeline for a repository with json output.
129128
$ {{.HelpName}} --remote --org MyOrg --repo MyRepo --output json
130129
6. Validate a template pipeline with expanding steps (when templates are sourced from private Github instance)
131-
$ {{.HelpName}} --template --compiler.github.token <token> --compiler.github.url <url>
132-
7. Validate a template pipeline with expanding steps
133-
$ {{.HelpName}} --template
134-
8. Validate a local template pipeline with expanding steps
135-
$ {{.HelpName}} --template --template-file name:/path/to/file
136-
9. Validate a local, nested template pipeline with custom template depth.
137-
$ {{.HelpName}} --template --template-file name:/path/to/file name:/path/to/file --max-template-depth 2
130+
$ {{.HelpName}} --compiler.github.token <token> --compiler.github.url <url>
131+
7. Validate a local template pipeline with expanding steps
132+
$ {{.HelpName}} --template-file name:/path/to/file
133+
8. Validate a local, nested template pipeline with custom template depth.
134+
$ {{.HelpName}} --template-file name:/path/to/file name:/path/to/file --max-template-depth 2
138135
DOCUMENTATION:
139136
140137
https://go-vela.github.io/docs/reference/cli/pipeline/validate/
@@ -150,6 +147,10 @@ func validate(c *cli.Context) error {
150147
return err
151148
}
152149

150+
if c.Bool("template") {
151+
logrus.Warnf("`template` flag is deprecated and will be removed in a later release")
152+
}
153+
153154
// create the pipeline configuration
154155
//
155156
// https://pkg.go.dev/github.com/go-vela/cli/action/pipeline?tab=doc#Config
@@ -160,7 +161,6 @@ func validate(c *cli.Context) error {
160161
File: c.String("file"),
161162
Path: c.String("path"),
162163
Ref: c.String("ref"),
163-
Template: c.Bool("template"),
164164
TemplateFiles: c.StringSlice("template-file"),
165165
Remote: c.Bool("remote"),
166166
PipelineType: c.String("pipeline-type"),

go.mod

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ require (
1010
github.com/dustin/go-humanize v1.0.1
1111
github.com/gin-gonic/gin v1.9.1
1212
github.com/go-git/go-git/v5 v5.11.0
13-
github.com/go-vela/sdk-go v0.23.0-rc1
14-
github.com/go-vela/server v0.23.0-rc1
13+
github.com/go-vela/sdk-go v0.23.0-rc1.0.20240201212858-6fd0d75deed9
14+
github.com/go-vela/server v0.23.0-rc1.0.20240201212123-ca2dbc596c34
1515
github.com/go-vela/types v0.23.0-rc1
1616
github.com/go-vela/worker v0.23.0-rc1
1717
github.com/golang-jwt/jwt/v5 v5.2.0

go.sum

+4-4
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,10 @@ github.com/go-playground/validator/v10 v10.14.0 h1:vgvQWe3XCz3gIeFDm/HnTIbj6UGmg
114114
github.com/go-playground/validator/v10 v10.14.0/go.mod h1:9iXMNT7sEkjXb0I+enO7QXmzG6QCsPWY4zveKFVRSyU=
115115
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI=
116116
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls=
117-
github.com/go-vela/sdk-go v0.23.0-rc1 h1:PFABwdZxlwLcik5VwcXFZ5ymDhlE33Yr0ulYE1UnMPs=
118-
github.com/go-vela/sdk-go v0.23.0-rc1/go.mod h1:iBHQ2YuYcAY1+JRrS3tHzHMstuUoA6Dxf8cuYHsnDAI=
119-
github.com/go-vela/server v0.23.0-rc1 h1:ZxUVbSeOa1KTdFA5FcYIwBX9XgWCOo+Z6s1d5zvmc78=
120-
github.com/go-vela/server v0.23.0-rc1/go.mod h1:w+UsZbtHebNJtXNiDfGe2VLhAp6f5cXEAAlO0O3bYfk=
117+
github.com/go-vela/sdk-go v0.23.0-rc1.0.20240201212858-6fd0d75deed9 h1:f3py59WaIglOzCxTYQ05FMwcdQEAdadMOejAn5L5VXQ=
118+
github.com/go-vela/sdk-go v0.23.0-rc1.0.20240201212858-6fd0d75deed9/go.mod h1:BCwNSkD3GidAwqci8BYIhWORVjSwbptq+i0mMq4hak0=
119+
github.com/go-vela/server v0.23.0-rc1.0.20240201212123-ca2dbc596c34 h1:9S4XlgqlpoSaQD+9YdhikiPfhgQmz99HNwfJvcuYgfg=
120+
github.com/go-vela/server v0.23.0-rc1.0.20240201212123-ca2dbc596c34/go.mod h1:w+UsZbtHebNJtXNiDfGe2VLhAp6f5cXEAAlO0O3bYfk=
121121
github.com/go-vela/types v0.23.0-rc1 h1:WesJq/xZ0ugJR54/26T/L+kee83vQtVxaBesCvvsXYA=
122122
github.com/go-vela/types v0.23.0-rc1/go.mod h1:cax3mW1kVz/ioI8qltZE+wl9rOLgOPdwBIvCooL09e4=
123123
github.com/go-vela/worker v0.23.0-rc1 h1:MUjUXnBv/z55FHRrYlmYBDijM8sX9VcwVa8cnaSwp4E=

0 commit comments

Comments
 (0)