Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
ecrupper committed Aug 13, 2024
1 parent 9d91cee commit 189c0ac
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 23 deletions.
27 changes: 27 additions & 0 deletions library/step.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ type Step struct {
Distribution *string `json:"distribution,omitempty"`
CheckID *int64 `json:"check_id,omitempty"`
ReportAs *string `json:"report_as,omitempty"`
Report *Report `json:"report,omitempty"`
}

// Duration calculates and returns the total amount of
Expand Down Expand Up @@ -319,6 +320,19 @@ func (s *Step) GetReportAs() string {
return *s.ReportAs
}

// GetReport returns the Report field.
//
// When the provided Step type is nil, or the field within
// the type is nil, it returns the zero value for the field.
func (s *Step) GetReport() *Report {
// return zero value if Step type or Report field is nil
if s == nil || s.Report == nil {
return new(Report)
}

return s.Report
}

// SetID sets the ID field.
//
// When the provided Step type is nil, it
Expand Down Expand Up @@ -553,6 +567,19 @@ func (s *Step) SetReportAs(v string) {
s.ReportAs = &v
}

// SetReport sets the Report field.
//
// When the provided Step type is nil, it
// will set nothing and immediately return.
func (s *Step) SetReport(v *Report) {
// return if Step type is nil
if s == nil {
return
}

s.Report = v
}

// String implements the Stringer interface for the Step type.
func (s *Step) String() string {
return fmt.Sprintf(`{
Expand Down
49 changes: 26 additions & 23 deletions pipeline/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,28 +31,30 @@ type (
//
// swagger:model PipelineContainer
Container struct {
ID string `json:"id,omitempty" yaml:"id,omitempty"`
Commands []string `json:"commands,omitempty" yaml:"commands,omitempty"`
Detach bool `json:"detach,omitempty" yaml:"detach,omitempty"`
Directory string `json:"directory,omitempty" yaml:"directory,omitempty"`
Entrypoint []string `json:"entrypoint,omitempty" yaml:"entrypoint,omitempty"`
Environment map[string]string `json:"environment,omitempty" yaml:"environment,omitempty"`
ExitCode int `json:"exit_code,omitempty" yaml:"exit_code,omitempty"`
Image string `json:"image,omitempty" yaml:"image,omitempty"`
Name string `json:"name,omitempty" yaml:"name,omitempty"`
Needs []string `json:"needs,omitempty" yaml:"needs,omitempty"`
Networks []string `json:"networks,omitempty" yaml:"networks,omitempty"`
Number int `json:"number,omitempty" yaml:"number,omitempty"`
Ports []string `json:"ports,omitempty" yaml:"ports,omitempty"`
Privileged bool `json:"privileged,omitempty" yaml:"privileged,omitempty"`
Pull string `json:"pull,omitempty" yaml:"pull,omitempty"`
Ruleset Ruleset `json:"ruleset,omitempty" yaml:"ruleset,omitempty"`
Secrets StepSecretSlice `json:"secrets,omitempty" yaml:"secrets,omitempty"`
Ulimits UlimitSlice `json:"ulimits,omitempty" yaml:"ulimits,omitempty"`
Volumes VolumeSlice `json:"volumes,omitempty" yaml:"volumes,omitempty"`
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"`
ID string `json:"id,omitempty" yaml:"id,omitempty"`
Commands []string `json:"commands,omitempty" yaml:"commands,omitempty"`
Detach bool `json:"detach,omitempty" yaml:"detach,omitempty"`
Directory string `json:"directory,omitempty" yaml:"directory,omitempty"`
Entrypoint []string `json:"entrypoint,omitempty" yaml:"entrypoint,omitempty"`
Environment map[string]string `json:"environment,omitempty" yaml:"environment,omitempty"`
ExitCode int `json:"exit_code,omitempty" yaml:"exit_code,omitempty"`
Image string `json:"image,omitempty" yaml:"image,omitempty"`
Name string `json:"name,omitempty" yaml:"name,omitempty"`
Needs []string `json:"needs,omitempty" yaml:"needs,omitempty"`
Networks []string `json:"networks,omitempty" yaml:"networks,omitempty"`
Number int `json:"number,omitempty" yaml:"number,omitempty"`
Ports []string `json:"ports,omitempty" yaml:"ports,omitempty"`
Privileged bool `json:"privileged,omitempty" yaml:"privileged,omitempty"`
Pull string `json:"pull,omitempty" yaml:"pull,omitempty"`
Ruleset Ruleset `json:"ruleset,omitempty" yaml:"ruleset,omitempty"`
Secrets StepSecretSlice `json:"secrets,omitempty" yaml:"secrets,omitempty"`
Ulimits UlimitSlice `json:"ulimits,omitempty" yaml:"ulimits,omitempty"`
Volumes VolumeSlice `json:"volumes,omitempty" yaml:"volumes,omitempty"`
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"`
ReportStatus bool `json:"report_status,omitempty" yaml:"report_status,omitempty"`
ReportPath string `json:"report_path,omitempty" yaml:"report_path,omitempty"`
}
)

Expand Down Expand Up @@ -137,7 +139,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.ReportPath) == 0 {
return true
}

Expand Down

0 comments on commit 189c0ac

Please sign in to comment.