Skip to content

Commit

Permalink
init commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ecrupper committed Jan 27, 2025
1 parent fe9bcaf commit eacc701
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 1 deletion.
4 changes: 3 additions & 1 deletion compiler/types/pipeline/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ type (
User string `json:"user,omitempty" yaml:"user,omitempty"`
ReportAs string `json:"report_as,omitempty" yaml:"report_as,omitempty"`
IDRequest string `json:"id_request,omitempty" yaml:"id_request,omitempty"`
LogTrunc string `json:"log_trunc,omitempty" yaml:"log_trunc,omitempty"`
}
)

Expand Down Expand Up @@ -137,7 +138,8 @@ func (c *Container) Empty() bool {
len(c.Volumes) == 0 &&
len(c.User) == 0 &&
len(c.ReportAs) == 0 &&
len(c.IDRequest) == 0 {
len(c.IDRequest) == 0 &&
len(c.LogTrunc) == 0 {
return true
}

Expand Down
3 changes: 3 additions & 0 deletions compiler/types/yaml/buildkite/step.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ type (
User string `yaml:"user,omitempty" json:"user,omitempty" jsonschema:"description=Set the user for the container.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-user-key"`
ReportAs string `yaml:"report_as,omitempty" json:"report_as,omitempty" jsonschema:"description=Set the name of the step to report as.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-report_as-key"`
IDRequest string `yaml:"id_request,omitempty" json:"id_request,omitempty" jsonschema:"description=Request ID Request Token for the step.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-id_request-key"`
LogTrunc string `yaml:"log_trunc,omitempty" json:"log_trunc,omitempty" jsonschema:"enum=head,enum=tail,description=When log reaches max size, set head or tail preference.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-log_trunc-key"`
}
)

Expand Down Expand Up @@ -65,6 +66,7 @@ func (s *StepSlice) ToPipeline() *pipeline.ContainerSlice {
User: step.User,
ReportAs: step.ReportAs,
IDRequest: step.IDRequest,
LogTrunc: step.LogTrunc,
})
}

Expand Down Expand Up @@ -171,6 +173,7 @@ func (s *Step) ToYAML() *yaml.Step {
User: s.User,
ReportAs: s.ReportAs,
IDRequest: s.IDRequest,
LogTrunc: s.LogTrunc,
}
}

Expand Down
2 changes: 2 additions & 0 deletions compiler/types/yaml/yaml/step.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ type (
User string `yaml:"user,omitempty" json:"user,omitempty" jsonschema:"description=Set the user for the container.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-user-key"`
ReportAs string `yaml:"report_as,omitempty" json:"report_as,omitempty" jsonschema:"description=Set the name of the step to report as.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-report_as-key"`
IDRequest string `yaml:"id_request,omitempty" json:"id_request,omitempty" jsonschema:"description=Request ID Request Token for the step.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-id_request-key"`
LogTrunc string `yaml:"log_trunc,omitempty" json:"log_trunc,omitempty" jsonschema:"enum=head,enum=tail,description=When log reaches max size, set head or tail preference.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-log_trunc-key"`
}
)

Expand Down Expand Up @@ -64,6 +65,7 @@ func (s *StepSlice) ToPipeline() *pipeline.ContainerSlice {
User: step.User,
ReportAs: step.ReportAs,
IDRequest: step.IDRequest,
LogTrunc: step.LogTrunc,
})
}

Expand Down
14 changes: 14 additions & 0 deletions constants/log.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// SPDX-License-Identifier: Apache-2.0

package constants

// Log options constants.
const (
// LogHead defines the option for preserving beginning of logs
// when the step has produces over the limit of log bytes.
LogHead = "head"

// LogTail defines the option for preserving end of logs
// when the step has produces over the limit of log bytes.
LogTail = "tail"
)

0 comments on commit eacc701

Please sign in to comment.