Skip to content

Commit

Permalink
fix(pipeline): remove template flag (#522)
Browse files Browse the repository at this point in the history
  • Loading branch information
ecrupper authored Feb 1, 2024
1 parent ba1a553 commit 8f58d34
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 34 deletions.
1 change: 0 additions & 1 deletion action/pipeline/pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ type Config struct {
Path string
Type string
Stages bool
Template bool
TemplateFiles []string
Local bool
Remote bool
Expand Down
5 changes: 2 additions & 3 deletions action/pipeline/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func (c *Config) ValidateLocal(client compiler.Engine) error {
logrus.Tracef("compiling pipeline %s", path)

// compile the object into a pipeline
p, _, err := client.CompileLite(path, c.Template, false)
p, _, err := client.CompileLite(path, false)
if err != nil {
return err
}
Expand Down Expand Up @@ -150,8 +150,7 @@ func (c *Config) ValidateRemote(client *vela.Client) error {
//
// https://pkg.go.dev/github.com/go-vela/sdk-go/vela?tab=doc#PipelineOptions
opts := &vela.PipelineOptions{
Output: c.Output,
Template: c.Template,
Output: c.Output,
}

// send API call to validate a pipeline
Expand Down
22 changes: 8 additions & 14 deletions action/pipeline/validate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,22 +210,20 @@ func TestPipeline_Config_ValidateLocal(t *testing.T) {
name: "stages default",
failure: false,
config: &Config{
Action: "validate",
File: "default_stages_template.yml",
Path: "testdata",
Type: "",
Template: true,
Action: "validate",
File: "default_stages_template.yml",
Path: "testdata",
Type: "",
},
},
{
name: "pipeline with template (remote)",
failure: false,
config: &Config{
Action: "validate",
File: "default_template.yml",
Path: "testdata",
Type: "",
Template: true,
Action: "validate",
File: "default_template.yml",
Path: "testdata",
Type: "",
},
},
{
Expand All @@ -236,7 +234,6 @@ func TestPipeline_Config_ValidateLocal(t *testing.T) {
File: "default_template.yml",
Path: "testdata",
Type: "",
Template: true,
TemplateFiles: []string{"sample:testdata/templates/template.yml"},
},
},
Expand All @@ -248,7 +245,6 @@ func TestPipeline_Config_ValidateLocal(t *testing.T) {
File: "default_multi_template.yml",
Path: "testdata",
Type: "",
Template: true,
TemplateFiles: []string{"sample:testdata/templates/template.yml", "sample2:testdata/templates/template2.yml"},
},
},
Expand All @@ -259,7 +255,6 @@ func TestPipeline_Config_ValidateLocal(t *testing.T) {
File: "default_multi_template.yml",
Path: "testdata",
Type: "",
Template: true,
TemplateFiles: []string{"sample2:testdata/templates/template2.yml"},
},
},
Expand All @@ -271,7 +266,6 @@ func TestPipeline_Config_ValidateLocal(t *testing.T) {
File: "default_template.yml",
Path: "testdata",
Type: "",
Template: true,
TemplateFiles: []string{"foo:testdata/templates/template.yml"},
},
},
Expand Down
20 changes: 10 additions & 10 deletions command/pipeline/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,7 @@ var CommandValidate = &cli.Command{
&cli.BoolFlag{
EnvVars: []string{"VELA_TEMPLATE", "PIPELINE_TEMPLATE"},
Name: "template",
Usage: "enables validating a pipeline with templates",
Value: false,
Usage: "DEPRECATED (Vela CLI will attempt to fetch templates if they exist)",
},
&cli.StringSliceFlag{
EnvVars: []string{"VELA_TEMPLATE_FILE", "PIPELINE_TEMPLATE_FILE"},
Expand Down Expand Up @@ -128,13 +127,11 @@ EXAMPLES:
5. Validate a remote pipeline for a repository with json output.
$ {{.HelpName}} --remote --org MyOrg --repo MyRepo --output json
6. Validate a template pipeline with expanding steps (when templates are sourced from private Github instance)
$ {{.HelpName}} --template --compiler.github.token <token> --compiler.github.url <url>
7. Validate a template pipeline with expanding steps
$ {{.HelpName}} --template
8. Validate a local template pipeline with expanding steps
$ {{.HelpName}} --template --template-file name:/path/to/file
9. Validate a local, nested template pipeline with custom template depth.
$ {{.HelpName}} --template --template-file name:/path/to/file name:/path/to/file --max-template-depth 2
$ {{.HelpName}} --compiler.github.token <token> --compiler.github.url <url>
7. Validate a local template pipeline with expanding steps
$ {{.HelpName}} --template-file name:/path/to/file
8. Validate a local, nested template pipeline with custom template depth.
$ {{.HelpName}} --template-file name:/path/to/file name:/path/to/file --max-template-depth 2
DOCUMENTATION:
https://go-vela.github.io/docs/reference/cli/pipeline/validate/
Expand All @@ -150,6 +147,10 @@ func validate(c *cli.Context) error {
return err
}

if c.Bool("template") {
logrus.Warnf("`template` flag is deprecated and will be removed in a later release")
}

// create the pipeline configuration
//
// https://pkg.go.dev/github.com/go-vela/cli/action/pipeline?tab=doc#Config
Expand All @@ -160,7 +161,6 @@ func validate(c *cli.Context) error {
File: c.String("file"),
Path: c.String("path"),
Ref: c.String("ref"),
Template: c.Bool("template"),
TemplateFiles: c.StringSlice("template-file"),
Remote: c.Bool("remote"),
PipelineType: c.String("pipeline-type"),
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ require (
github.com/dustin/go-humanize v1.0.1
github.com/gin-gonic/gin v1.9.1
github.com/go-git/go-git/v5 v5.11.0
github.com/go-vela/sdk-go v0.23.0-rc1
github.com/go-vela/server v0.23.0-rc1
github.com/go-vela/sdk-go v0.23.0-rc1.0.20240201212858-6fd0d75deed9
github.com/go-vela/server v0.23.0-rc1.0.20240201212123-ca2dbc596c34
github.com/go-vela/types v0.23.0-rc1
github.com/go-vela/worker v0.23.0-rc1
github.com/golang-jwt/jwt/v5 v5.2.0
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,10 @@ github.com/go-playground/validator/v10 v10.14.0 h1:vgvQWe3XCz3gIeFDm/HnTIbj6UGmg
github.com/go-playground/validator/v10 v10.14.0/go.mod h1:9iXMNT7sEkjXb0I+enO7QXmzG6QCsPWY4zveKFVRSyU=
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI=
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls=
github.com/go-vela/sdk-go v0.23.0-rc1 h1:PFABwdZxlwLcik5VwcXFZ5ymDhlE33Yr0ulYE1UnMPs=
github.com/go-vela/sdk-go v0.23.0-rc1/go.mod h1:iBHQ2YuYcAY1+JRrS3tHzHMstuUoA6Dxf8cuYHsnDAI=
github.com/go-vela/server v0.23.0-rc1 h1:ZxUVbSeOa1KTdFA5FcYIwBX9XgWCOo+Z6s1d5zvmc78=
github.com/go-vela/server v0.23.0-rc1/go.mod h1:w+UsZbtHebNJtXNiDfGe2VLhAp6f5cXEAAlO0O3bYfk=
github.com/go-vela/sdk-go v0.23.0-rc1.0.20240201212858-6fd0d75deed9 h1:f3py59WaIglOzCxTYQ05FMwcdQEAdadMOejAn5L5VXQ=
github.com/go-vela/sdk-go v0.23.0-rc1.0.20240201212858-6fd0d75deed9/go.mod h1:BCwNSkD3GidAwqci8BYIhWORVjSwbptq+i0mMq4hak0=
github.com/go-vela/server v0.23.0-rc1.0.20240201212123-ca2dbc596c34 h1:9S4XlgqlpoSaQD+9YdhikiPfhgQmz99HNwfJvcuYgfg=
github.com/go-vela/server v0.23.0-rc1.0.20240201212123-ca2dbc596c34/go.mod h1:w+UsZbtHebNJtXNiDfGe2VLhAp6f5cXEAAlO0O3bYfk=
github.com/go-vela/types v0.23.0-rc1 h1:WesJq/xZ0ugJR54/26T/L+kee83vQtVxaBesCvvsXYA=
github.com/go-vela/types v0.23.0-rc1/go.mod h1:cax3mW1kVz/ioI8qltZE+wl9rOLgOPdwBIvCooL09e4=
github.com/go-vela/worker v0.23.0-rc1 h1:MUjUXnBv/z55FHRrYlmYBDijM8sX9VcwVa8cnaSwp4E=
Expand Down

0 comments on commit 8f58d34

Please sign in to comment.