Skip to content

Commit

Permalink
Merge branch 'main' into feat/deployment-config
Browse files Browse the repository at this point in the history
  • Loading branch information
ecrupper committed Oct 29, 2024
2 parents 04d6ac1 + f463fc9 commit 9a8884c
Show file tree
Hide file tree
Showing 24 changed files with 120 additions and 113 deletions.
7 changes: 7 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ linters-settings:
- dot
- prefix(github.com/go-vela)

# https://golangci-lint.run/usage/linters/#tagalign
# ensure struct tags are aligned
# will auto fix with `make lintfix`
tagalign:
sort: false

# https://github.com/denis-tingaikin/go-header
goheader:
template: |-
Expand Down Expand Up @@ -100,6 +106,7 @@ linters:
- revive # linter for go
- staticcheck # applies static analysis checks, go vet on steroids
- stylecheck # replacement for golint
- tagalign # finds maligned struct tags
- tenv # analyzer that detects using os.Setenv instead of t.Setenv since Go1.17
- typecheck # parses and type-checks go code, like the front-end of a go compiler
- unconvert # remove unnecessary type conversions
Expand Down
2 changes: 1 addition & 1 deletion api/types/secret.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type Secret struct {
Value *string `json:"value,omitempty"`
Type *string `json:"type,omitempty"`
Images *[]string `json:"images,omitempty"`
AllowEvents *Events `json:"allow_events,omitempty" yaml:"allow_events"`
AllowEvents *Events `json:"allow_events,omitempty" yaml:"allow_events"`
AllowCommand *bool `json:"allow_command,omitempty"`
AllowSubstitution *bool `json:"allow_substitution,omitempty"`
CreatedAt *int64 `json:"created_at,omitempty"`
Expand Down
4 changes: 2 additions & 2 deletions api/types/settings/compiler.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ package settings
import "fmt"

type Compiler struct {
CloneImage *string `json:"clone_image,omitempty" yaml:"clone_image,omitempty"`
TemplateDepth *int `json:"template_depth,omitempty" yaml:"template_depth,omitempty"`
CloneImage *string `json:"clone_image,omitempty" yaml:"clone_image,omitempty"`
TemplateDepth *int `json:"template_depth,omitempty" yaml:"template_depth,omitempty"`
StarlarkExecLimit *uint64 `json:"starlark_exec_limit,omitempty" yaml:"starlark_exec_limit,omitempty"`
}

Expand Down
12 changes: 6 additions & 6 deletions api/types/settings/platform.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ import (
// swagger:model Platform
type Platform struct {
ID *int64 `json:"id"`
*Compiler `json:"compiler,omitempty" yaml:"compiler,omitempty"`
*Queue `json:"queue,omitempty" yaml:"queue,omitempty"`
RepoAllowlist *[]string `json:"repo_allowlist,omitempty" yaml:"repo_allowlist,omitempty"`
*Compiler `json:"compiler,omitempty" yaml:"compiler,omitempty"`
*Queue `json:"queue,omitempty" yaml:"queue,omitempty"`
RepoAllowlist *[]string `json:"repo_allowlist,omitempty" yaml:"repo_allowlist,omitempty"`
ScheduleAllowlist *[]string `json:"schedule_allowlist,omitempty" yaml:"schedule_allowlist,omitempty"`
CreatedAt *int64 `json:"created_at,omitempty" yaml:"created_at,omitempty"`
UpdatedAt *int64 `json:"updated_at,omitempty" yaml:"updated_at,omitempty"`
UpdatedBy *string `json:"updated_by,omitempty" yaml:"updated_by,omitempty"`
CreatedAt *int64 `json:"created_at,omitempty" yaml:"created_at,omitempty"`
UpdatedAt *int64 `json:"updated_at,omitempty" yaml:"updated_at,omitempty"`
UpdatedBy *string `json:"updated_by,omitempty" yaml:"updated_by,omitempty"`
}

// FromCLIContext returns a new Platform record from a cli context.
Expand Down
18 changes: 9 additions & 9 deletions compiler/types/pipeline/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@ import (
//
// swagger:model PipelineBuild
type Build struct {
ID string `json:"id,omitempty" yaml:"id,omitempty"`
Version string `json:"version,omitempty" yaml:"version,omitempty"`
Metadata Metadata `json:"metadata,omitempty" yaml:"metadata,omitempty"`
ID string `json:"id,omitempty" yaml:"id,omitempty"`
Version string `json:"version,omitempty" yaml:"version,omitempty"`
Metadata Metadata `json:"metadata,omitempty" yaml:"metadata,omitempty"`
Environment raw.StringSliceMap `json:"environment,omitempty" yaml:"environment,omitempty"`
Worker Worker `json:"worker,omitempty" yaml:"worker,omitempty"`
Deployment Deployment `json:"deployment,omitempty" yaml:"deployment,omitempty"`
Secrets SecretSlice `json:"secrets,omitempty" yaml:"secrets,omitempty"`
Services ContainerSlice `json:"services,omitempty" yaml:"services,omitempty"`
Stages StageSlice `json:"stages,omitempty" yaml:"stages,omitempty"`
Steps ContainerSlice `json:"steps,omitempty" yaml:"steps,omitempty"`
Worker Worker `json:"worker,omitempty" yaml:"worker,omitempty"`
Deployment Deployment `json:"deployment,omitempty" yaml:"deployment,omitempty"`
Secrets SecretSlice `json:"secrets,omitempty" yaml:"secrets,omitempty"`
Services ContainerSlice `json:"services,omitempty" yaml:"services,omitempty"`
Stages StageSlice `json:"stages,omitempty" yaml:"stages,omitempty"`
Steps ContainerSlice `json:"steps,omitempty" yaml:"steps,omitempty"`
}

// Purge removes the steps, in every stage, that contain a ruleset
Expand Down
4 changes: 2 additions & 2 deletions compiler/types/pipeline/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ type (
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"`
ReportAs string `json:"report_as,omitempty" yaml:"report_as,omitempty"`
IDRequest string `json:"id_request,omitempty" yaml:"id_request,omitempty"`
}
)

Expand Down
12 changes: 6 additions & 6 deletions compiler/types/pipeline/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ type (
//
// swagger:model PipelineDeployment
Deployment struct {
Targets []string `json:"targets,omitempty" yaml:"targets,omitempty"`
Targets []string `json:"targets,omitempty" yaml:"targets,omitempty"`
Parameters ParameterMap `json:"parameters,omitempty" yaml:"parameters,omitempty"`
}

Expand All @@ -25,11 +25,11 @@ type (
// swagger:model PipelineParameters
Parameter struct {
Description string `json:"description,omitempty" yaml:"description,omitempty"`
Type string `json:"type,omitempty" yaml:"type,omitempty"`
Required bool `json:"required,omitempty" yaml:"required,omitempty"`
Options []string `json:"options,omitempty" yaml:"options,omitempty"`
Min int `json:"min,omitempty" yaml:"min,omitempty"`
Max int `json:"max,omitempty" yaml:"max,omitempty"`
Type string `json:"type,omitempty" yaml:"type,omitempty"`
Required bool `json:"required,omitempty" yaml:"required,omitempty"`
Options []string `json:"options,omitempty" yaml:"options,omitempty"`
Min int `json:"min,omitempty" yaml:"min,omitempty"`
Max int `json:"max,omitempty" yaml:"max,omitempty"`
}
)

Expand Down
8 changes: 4 additions & 4 deletions compiler/types/pipeline/metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ package pipeline
//
// swagger:model PipelineMetadata
type Metadata struct {
Template bool `json:"template,omitempty" yaml:"template,omitempty"`
Clone bool `json:"clone,omitempty" yaml:"clone,omitempty"`
Template bool `json:"template,omitempty" yaml:"template,omitempty"`
Clone bool `json:"clone,omitempty" yaml:"clone,omitempty"`
Environment []string `json:"environment,omitempty" yaml:"environment,omitempty"`
AutoCancel *CancelOptions `json:"auto_cancel,omitempty" yaml:"auto_cancel,omitempty"`
}

// CancelOptions is the pipeline representation of the auto_cancel block for a pipeline.
type CancelOptions struct {
Running bool `yaml:"running,omitempty" json:"running,omitempty"`
Pending bool `yaml:"pending,omitempty" json:"pending,omitempty"`
Running bool `yaml:"running,omitempty" json:"running,omitempty"`
Pending bool `yaml:"pending,omitempty" json:"pending,omitempty"`
DefaultBranch bool `yaml:"default_branch,omitempty" json:"default_branch,omitempty"`
}
18 changes: 9 additions & 9 deletions compiler/types/yaml/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@ import (

// Build is the yaml representation of a build for a pipeline.
type Build struct {
Version string `yaml:"version,omitempty" json:"version,omitempty" jsonschema:"required,minLength=1,description=Provide syntax version used to evaluate the pipeline.\nReference: https://go-vela.github.io/docs/reference/yaml/version/"`
Metadata Metadata `yaml:"metadata,omitempty" json:"metadata,omitempty" jsonschema:"description=Pass extra information.\nReference: https://go-vela.github.io/docs/reference/yaml/metadata/"`
Version string `yaml:"version,omitempty" json:"version,omitempty" jsonschema:"required,minLength=1,description=Provide syntax version used to evaluate the pipeline.\nReference: https://go-vela.github.io/docs/reference/yaml/version/"`
Metadata Metadata `yaml:"metadata,omitempty" json:"metadata,omitempty" jsonschema:"description=Pass extra information.\nReference: https://go-vela.github.io/docs/reference/yaml/metadata/"`
Environment raw.StringSliceMap `yaml:"environment,omitempty" json:"environment,omitempty" jsonschema:"description=Provide global environment variables injected into the container environment.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-environment-key"`
Worker Worker `yaml:"worker,omitempty" json:"worker,omitempty" jsonschema:"description=Limit the pipeline to certain types of workers.\nReference: https://go-vela.github.io/docs/reference/yaml/worker/"`
Secrets SecretSlice `yaml:"secrets,omitempty" json:"secrets,omitempty" jsonschema:"description=Provide sensitive information.\nReference: https://go-vela.github.io/docs/reference/yaml/secrets/"`
Services ServiceSlice `yaml:"services,omitempty" json:"services,omitempty" jsonschema:"description=Provide detached (headless) execution instructions.\nReference: https://go-vela.github.io/docs/reference/yaml/services/"`
Stages StageSlice `yaml:"stages,omitempty" json:"stages,omitempty" jsonschema:"oneof_required=stages,description=Provide parallel execution instructions.\nReference: https://go-vela.github.io/docs/reference/yaml/stages/"`
Steps StepSlice `yaml:"steps,omitempty" json:"steps,omitempty" jsonschema:"oneof_required=steps,description=Provide sequential execution instructions.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/"`
Templates TemplateSlice `yaml:"templates,omitempty" json:"templates,omitempty" jsonschema:"description=Provide the name of templates to expand.\nReference: https://go-vela.github.io/docs/reference/yaml/templates/"`
Deployment Deployment `yaml:"deployment,omitempty" json:"deployment,omitempty" jsonschema:"description=Provide deployment configuration.\nReference: https://go-vela.github.io/docs/reference/yaml/deployments/"`
Worker Worker `yaml:"worker,omitempty" json:"worker,omitempty" jsonschema:"description=Limit the pipeline to certain types of workers.\nReference: https://go-vela.github.io/docs/reference/yaml/worker/"`
Secrets SecretSlice `yaml:"secrets,omitempty" json:"secrets,omitempty" jsonschema:"description=Provide sensitive information.\nReference: https://go-vela.github.io/docs/reference/yaml/secrets/"`
Services ServiceSlice `yaml:"services,omitempty" json:"services,omitempty" jsonschema:"description=Provide detached (headless) execution instructions.\nReference: https://go-vela.github.io/docs/reference/yaml/services/"`
Stages StageSlice `yaml:"stages,omitempty" json:"stages,omitempty" jsonschema:"oneof_required=stages,description=Provide parallel execution instructions.\nReference: https://go-vela.github.io/docs/reference/yaml/stages/"`
Steps StepSlice `yaml:"steps,omitempty" json:"steps,omitempty" jsonschema:"oneof_required=steps,description=Provide sequential execution instructions.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/"`
Templates TemplateSlice `yaml:"templates,omitempty" json:"templates,omitempty" jsonschema:"description=Provide the name of templates to expand.\nReference: https://go-vela.github.io/docs/reference/yaml/templates/"`
Deployment Deployment `yaml:"deployment,omitempty" json:"deployment,omitempty" jsonschema:"description=Provide deployment configuration.\nReference: https://go-vela.github.io/docs/reference/yaml/deployments/"`
}

// ToPipelineAPI converts the Build type to an API Pipeline type.
Expand Down
14 changes: 7 additions & 7 deletions compiler/types/yaml/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ type (
// Deployment is the yaml representation of a
// deployment block in a pipeline.
Deployment struct {
Targets raw.StringSlice `yaml:"targets,omitempty" json:"targets,omitempty" jsonschema:"description=List of deployment targets for the deployment block.\nReference: https://go-vela.github.io/docs/reference/yaml/deployments/#the-targets-key"`
Targets raw.StringSlice `yaml:"targets,omitempty" json:"targets,omitempty" jsonschema:"description=List of deployment targets for the deployment block.\nReference: https://go-vela.github.io/docs/reference/yaml/deployments/#the-targets-key"`
Parameters ParameterMap `yaml:"parameters,omitempty" json:"parameters,omitempty" jsonschema:"description=List of parameters for the deployment block.\nReference: https://go-vela.github.io/docs/reference/yaml/deployments/#the-parameters-key"`
Template StepTemplate `yaml:"template,omitempty" json:"template,omitempty" jsonschema:"description=Name of template to expand in the deployment block.\nReference: https://go-vela.github.io/docs/reference/yaml/deployments/#the-template-key"`
Template StepTemplate `yaml:"template,omitempty" json:"template,omitempty" jsonschema:"description=Name of template to expand in the deployment block.\nReference: https://go-vela.github.io/docs/reference/yaml/deployments/#the-template-key"`
}

// ParameterMap is the yaml representation
Expand All @@ -24,11 +24,11 @@ type (
// from a deployment block in a pipeline.
Parameter struct {
Description string `yaml:"description,omitempty" json:"description,omitempty" jsonschema:"description=Description of the parameter.\nReference: https://go-vela.github.io/docs/reference/yaml/deployments/#the-parameters-key"`
Type string `yaml:"type,omitempty" json:"type,omitempty" jsonschema:"description=Type of the parameter.\nReference: https://go-vela.github.io/docs/reference/yaml/deployments/#the-parameters-key"`
Required bool `yaml:"required,omitempty" json:"required,omitempty" jsonschema:"description=Flag indicating if the parameter is required.\nReference: https://go-vela.github.io/docs/reference/yaml/deployments/#the-parameters-key"`
Options raw.StringSlice `yaml:"options,omitempty" json:"options,omitempty" jsonschema:"description=List of options for the parameter.\nReference: https://go-vela.github.io/docs/reference/yaml/deployments/#the-parameters-key"`
Min int `yaml:"min,omitempty" json:"min,omitempty" jsonschema:"description=Minimum value for the parameter.\nReference: https://go-vela.github.io/docs/reference/yaml/deployments/#the-parameters-key"`
Max int `yaml:"max,omitempty" json:"max,omitempty" jsonschema:"description=Maximum value for the parameter.\nReference: https://go-vela.github.io/docs/reference/yaml/deployments/#the-parameters-key"`
Type string `yaml:"type,omitempty" json:"type,omitempty" jsonschema:"description=Type of the parameter.\nReference: https://go-vela.github.io/docs/reference/yaml/deployments/#the-parameters-key"`
Required bool `yaml:"required,omitempty" json:"required,omitempty" jsonschema:"description=Flag indicating if the parameter is required.\nReference: https://go-vela.github.io/docs/reference/yaml/deployments/#the-parameters-key"`
Options raw.StringSlice `yaml:"options,omitempty" json:"options,omitempty" jsonschema:"description=List of options for the parameter.\nReference: https://go-vela.github.io/docs/reference/yaml/deployments/#the-parameters-key"`
Min int `yaml:"min,omitempty" json:"min,omitempty" jsonschema:"description=Minimum value for the parameter.\nReference: https://go-vela.github.io/docs/reference/yaml/deployments/#the-parameters-key"`
Max int `yaml:"max,omitempty" json:"max,omitempty" jsonschema:"description=Maximum value for the parameter.\nReference: https://go-vela.github.io/docs/reference/yaml/deployments/#the-parameters-key"`
}
)

Expand Down
Loading

0 comments on commit 9a8884c

Please sign in to comment.