Use name in backend types instead of alias (#3142)

This commit is contained in:
6543 2024-01-09 15:22:59 +01:00 committed by GitHub
parent 1eacf74376
commit cd59a85230
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 48 additions and 108 deletions

View file

@ -31,7 +31,7 @@ func (r *Runner) createLogger(logger zerolog.Logger, uploads *sync.WaitGroup, wo
return func(step *backend.Step, rc multipart.Reader) error { return func(step *backend.Step, rc multipart.Reader) error {
loglogger := logger.With(). loglogger := logger.With().
Str("image", step.Image). Str("image", step.Image).
Str("stage", step.Alias). Str("workflowID", workflow.ID).
Logger() Logger()
part, rerr := rc.NextPart() part, rerr := rc.NextPart()

View file

@ -30,14 +30,14 @@ func (r *Runner) createTracer(ctxmeta context.Context, logger zerolog.Logger, wo
return func(state *pipeline.State) error { return func(state *pipeline.State) error {
steplogger := logger.With(). steplogger := logger.With().
Str("image", state.Pipeline.Step.Image). Str("image", state.Pipeline.Step.Image).
Str("stage", state.Pipeline.Step.Alias). Str("workflowID", workflow.ID).
Err(state.Process.Error). Err(state.Process.Error).
Int("exit_code", state.Process.ExitCode). Int("exit_code", state.Process.ExitCode).
Bool("exited", state.Process.Exited). Bool("exited", state.Process.Exited).
Logger() Logger()
stepState := rpc.State{ stepState := rpc.State{
Step: state.Pipeline.Step.Alias, Step: state.Pipeline.Step.Name,
Exited: state.Process.Exited, Exited: state.Process.Exited,
ExitCode: state.Process.ExitCode, ExitCode: state.Process.ExitCode,
Started: time.Now().Unix(), // TODO do not do this Started: time.Now().Unix(), // TODO do not do this

View file

@ -258,7 +258,7 @@ var defaultLogger = pipeline.LogFunc(func(step *backendTypes.Step, rc multipart.
return err return err
} }
logStream := NewLineWriter(step.Alias, step.UUID) logStream := NewLineWriter(step.Name, step.UUID)
_, err = io.Copy(logStream, part) _, err = io.Copy(logStream, part)
return err return err
}) })

View file

@ -16,7 +16,5 @@ package types
// Stage denotes a collection of one or more steps. // Stage denotes a collection of one or more steps.
type Stage struct { type Stage struct {
Name string `json:"name,omitempty"`
Alias string `json:"alias,omitempty"`
Steps []*Step `json:"steps,omitempty"` Steps []*Step `json:"steps,omitempty"`
} }

View file

@ -19,7 +19,6 @@ type Step struct {
Name string `json:"name"` Name string `json:"name"`
UUID string `json:"uuid"` UUID string `json:"uuid"`
Type StepType `json:"type,omitempty"` Type StepType `json:"type,omitempty"`
Alias string `json:"alias,omitempty"`
Image string `json:"image,omitempty"` Image string `json:"image,omitempty"`
Pull bool `json:"pull,omitempty"` Pull bool `json:"pull,omitempty"`
Detached bool `json:"detach,omitempty"` Detached bool `json:"detach,omitempty"`

View file

@ -27,8 +27,6 @@ import (
const ( const (
defaultCloneName = "clone" defaultCloneName = "clone"
nameServices = "services"
) )
// Registry represents registry credentials // Registry represents registry credentials
@ -161,20 +159,17 @@ func (c *Compiler) Compile(conf *yaml_types.Workflow) (*backend_types.Config, er
Settings: cloneSettings, Settings: cloneSettings,
Environment: c.cloneEnv, Environment: c.cloneEnv,
} }
name := fmt.Sprintf("%s_clone", c.prefix) step, err := c.createProcess(container, backend_types.StepTypeClone)
step, err := c.createProcess(name, container, backend_types.StepTypeClone)
if err != nil { if err != nil {
return nil, err return nil, err
} }
stage := new(backend_types.Stage) stage := new(backend_types.Stage)
stage.Name = name
stage.Alias = defaultCloneName
stage.Steps = append(stage.Steps, step) stage.Steps = append(stage.Steps, step)
config.Stages = append(config.Stages, stage) config.Stages = append(config.Stages, stage)
} else if !c.local && !conf.SkipClone { } else if !c.local && !conf.SkipClone {
for i, container := range conf.Clone.ContainerList { for _, container := range conf.Clone.ContainerList {
if match, err := container.When.Match(c.metadata, false, c.env); !match && err == nil { if match, err := container.When.Match(c.metadata, false, c.env); !match && err == nil {
continue continue
} else if err != nil { } else if err != nil {
@ -182,11 +177,8 @@ func (c *Compiler) Compile(conf *yaml_types.Workflow) (*backend_types.Config, er
} }
stage := new(backend_types.Stage) stage := new(backend_types.Stage)
stage.Name = fmt.Sprintf("%s_clone_%v", c.prefix, i)
stage.Alias = container.Name
name := fmt.Sprintf("%s_clone_%d", c.prefix, i) step, err := c.createProcess(container, backend_types.StepTypeClone)
step, err := c.createProcess(name, container, backend_types.StepTypeClone)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -212,18 +204,15 @@ func (c *Compiler) Compile(conf *yaml_types.Workflow) (*backend_types.Config, er
// add services steps // add services steps
if len(conf.Services.ContainerList) != 0 { if len(conf.Services.ContainerList) != 0 {
stage := new(backend_types.Stage) stage := new(backend_types.Stage)
stage.Name = fmt.Sprintf("%s_%s", c.prefix, nameServices)
stage.Alias = nameServices
for i, container := range conf.Services.ContainerList { for _, container := range conf.Services.ContainerList {
if match, err := container.When.Match(c.metadata, false, c.env); !match && err == nil { if match, err := container.When.Match(c.metadata, false, c.env); !match && err == nil {
continue continue
} else if err != nil { } else if err != nil {
return nil, err return nil, err
} }
name := fmt.Sprintf("%s_%s_%d", c.prefix, nameServices, i) step, err := c.createProcess(container, backend_types.StepTypeService)
step, err := c.createProcess(name, container, backend_types.StepTypeService)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -247,12 +236,11 @@ func (c *Compiler) Compile(conf *yaml_types.Workflow) (*backend_types.Config, er
return nil, err return nil, err
} }
name := fmt.Sprintf("%s_step_%d", c.prefix, pos)
stepType := backend_types.StepTypeCommands stepType := backend_types.StepTypeCommands
if container.IsPlugin() { if container.IsPlugin() {
stepType = backend_types.StepTypePlugin stepType = backend_types.StepTypePlugin
} }
step, err := c.createProcess(name, container, stepType) step, err := c.createProcess(container, stepType)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -274,7 +262,7 @@ func (c *Compiler) Compile(conf *yaml_types.Workflow) (*backend_types.Config, er
} }
// generate stages out of steps // generate stages out of steps
stepStages, err := newDAGCompiler(steps, c.prefix).compile() stepStages, err := newDAGCompiler(steps).compile()
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -295,15 +283,12 @@ func (c *Compiler) setupCache(conf *yaml_types.Workflow, ir *backend_types.Confi
} }
container := c.cacher.Restore(path.Join(c.metadata.Repo.Owner, c.metadata.Repo.Name), c.metadata.Curr.Commit.Branch, conf.Cache) container := c.cacher.Restore(path.Join(c.metadata.Repo.Owner, c.metadata.Repo.Name), c.metadata.Curr.Commit.Branch, conf.Cache)
name := fmt.Sprintf("%s_restore_cache", c.prefix) step, err := c.createProcess(container, backend_types.StepTypeCache)
step, err := c.createProcess(name, container, backend_types.StepTypeCache)
if err != nil { if err != nil {
return err return err
} }
stage := new(backend_types.Stage) stage := new(backend_types.Stage)
stage.Name = name
stage.Alias = "restore_cache"
stage.Steps = append(stage.Steps, step) stage.Steps = append(stage.Steps, step)
ir.Stages = append(ir.Stages, stage) ir.Stages = append(ir.Stages, stage)
@ -317,15 +302,12 @@ func (c *Compiler) setupCacheRebuild(conf *yaml_types.Workflow, ir *backend_type
} }
container := c.cacher.Rebuild(path.Join(c.metadata.Repo.Owner, c.metadata.Repo.Name), c.metadata.Curr.Commit.Branch, conf.Cache) container := c.cacher.Rebuild(path.Join(c.metadata.Repo.Owner, c.metadata.Repo.Name), c.metadata.Curr.Commit.Branch, conf.Cache)
name := fmt.Sprintf("%s_rebuild_cache", c.prefix) step, err := c.createProcess(container, backend_types.StepTypeCache)
step, err := c.createProcess(name, container, backend_types.StepTypeCache)
if err != nil { if err != nil {
return err return err
} }
stage := new(backend_types.Stage) stage := new(backend_types.Stage)
stage.Name = name
stage.Alias = "rebuild_cache"
stage.Steps = append(stage.Steps, step) stage.Steps = append(stage.Steps, step)
ir.Stages = append(ir.Stages, stage) ir.Stages = append(ir.Stages, stage)

View file

@ -79,11 +79,8 @@ func TestCompilerCompile(t *testing.T) {
}} }}
defaultCloneStage := &backend_types.Stage{ defaultCloneStage := &backend_types.Stage{
Name: "test_clone",
Alias: "clone",
Steps: []*backend_types.Step{{ Steps: []*backend_types.Step{{
Name: "test_clone", Name: "clone",
Alias: "clone",
Type: backend_types.StepTypeClone, Type: backend_types.StepTypeClone,
Image: constant.DefaultCloneImage, Image: constant.DefaultCloneImage,
OnSuccess: true, OnSuccess: true,
@ -127,11 +124,8 @@ func TestCompilerCompile(t *testing.T) {
Networks: defaultNetworks, Networks: defaultNetworks,
Volumes: defaultVolumes, Volumes: defaultVolumes,
Stages: []*backend_types.Stage{defaultCloneStage, { Stages: []*backend_types.Stage{defaultCloneStage, {
Name: "test_stage_0",
Alias: "dummy",
Steps: []*backend_types.Step{{ Steps: []*backend_types.Step{{
Name: "test_step_0", Name: "dummy",
Alias: "dummy",
Type: backend_types.StepTypePlugin, Type: backend_types.StepTypePlugin,
Image: "dummy_img", Image: "dummy_img",
OnSuccess: true, OnSuccess: true,
@ -164,11 +158,8 @@ func TestCompilerCompile(t *testing.T) {
Networks: defaultNetworks, Networks: defaultNetworks,
Volumes: defaultVolumes, Volumes: defaultVolumes,
Stages: []*backend_types.Stage{defaultCloneStage, { Stages: []*backend_types.Stage{defaultCloneStage, {
Name: "test_stage_0",
Alias: "echo env",
Steps: []*backend_types.Step{{ Steps: []*backend_types.Step{{
Name: "test_step_0", Name: "echo env",
Alias: "echo env",
Type: backend_types.StepTypeCommands, Type: backend_types.StepTypeCommands,
Image: "bash", Image: "bash",
Commands: []string{"env"}, Commands: []string{"env"},
@ -179,11 +170,8 @@ func TestCompilerCompile(t *testing.T) {
ExtraHosts: []backend_types.HostAlias{}, ExtraHosts: []backend_types.HostAlias{},
}}, }},
}, { }, {
Name: "test_stage_1",
Alias: "parallel echo 1",
Steps: []*backend_types.Step{{ Steps: []*backend_types.Step{{
Name: "test_step_1", Name: "parallel echo 1",
Alias: "parallel echo 1",
Type: backend_types.StepTypeCommands, Type: backend_types.StepTypeCommands,
Image: "bash", Image: "bash",
Commands: []string{"echo 1"}, Commands: []string{"echo 1"},
@ -193,8 +181,7 @@ func TestCompilerCompile(t *testing.T) {
Networks: []backend_types.Conn{{Name: "test_default", Aliases: []string{"parallel echo 1"}}}, Networks: []backend_types.Conn{{Name: "test_default", Aliases: []string{"parallel echo 1"}}},
ExtraHosts: []backend_types.HostAlias{}, ExtraHosts: []backend_types.HostAlias{},
}, { }, {
Name: "test_step_2", Name: "parallel echo 2",
Alias: "parallel echo 2",
Type: backend_types.StepTypeCommands, Type: backend_types.StepTypeCommands,
Image: "bash", Image: "bash",
Commands: []string{"echo 2"}, Commands: []string{"echo 2"},
@ -227,11 +214,8 @@ func TestCompilerCompile(t *testing.T) {
Networks: defaultNetworks, Networks: defaultNetworks,
Volumes: defaultVolumes, Volumes: defaultVolumes,
Stages: []*backend_types.Stage{defaultCloneStage, { Stages: []*backend_types.Stage{defaultCloneStage, {
Name: "test_stage_0",
Alias: "test_stage_0",
Steps: []*backend_types.Step{{ Steps: []*backend_types.Step{{
Name: "test_step_0", Name: "echo env",
Alias: "echo env",
Type: backend_types.StepTypeCommands, Type: backend_types.StepTypeCommands,
Image: "bash", Image: "bash",
Commands: []string{"env"}, Commands: []string{"env"},
@ -241,8 +225,7 @@ func TestCompilerCompile(t *testing.T) {
Networks: []backend_types.Conn{{Name: "test_default", Aliases: []string{"echo env"}}}, Networks: []backend_types.Conn{{Name: "test_default", Aliases: []string{"echo env"}}},
ExtraHosts: []backend_types.HostAlias{}, ExtraHosts: []backend_types.HostAlias{},
}, { }, {
Name: "test_step_2", Name: "echo 2",
Alias: "echo 2",
Type: backend_types.StepTypeCommands, Type: backend_types.StepTypeCommands,
Image: "bash", Image: "bash",
Commands: []string{"echo 2"}, Commands: []string{"echo 2"},
@ -253,11 +236,8 @@ func TestCompilerCompile(t *testing.T) {
ExtraHosts: []backend_types.HostAlias{}, ExtraHosts: []backend_types.HostAlias{},
}}, }},
}, { }, {
Name: "test_stage_1",
Alias: "test_stage_1",
Steps: []*backend_types.Step{{ Steps: []*backend_types.Step{{
Name: "test_step_1", Name: "echo 1",
Alias: "echo 1",
Type: backend_types.StepTypeCommands, Type: backend_types.StepTypeCommands,
Image: "bash", Image: "bash",
Commands: []string{"echo 1"}, Commands: []string{"echo 1"},

View file

@ -29,7 +29,7 @@ import (
"go.woodpecker-ci.org/woodpecker/v2/pipeline/frontend/yaml/utils" "go.woodpecker-ci.org/woodpecker/v2/pipeline/frontend/yaml/utils"
) )
func (c *Compiler) createProcess(name string, container *yaml_types.Container, stepType backend_types.StepType) (*backend_types.Step, error) { func (c *Compiler) createProcess(container *yaml_types.Container, stepType backend_types.StepType) (*backend_types.Step, error) {
var ( var (
uuid = ulid.Make() uuid = ulid.Make()
@ -171,10 +171,9 @@ func (c *Compiler) createProcess(name string, container *yaml_types.Container, s
} }
return &backend_types.Step{ return &backend_types.Step{
Name: name, Name: container.Name,
UUID: uuid.String(), UUID: uuid.String(),
Type: stepType, Type: stepType,
Alias: container.Name,
Image: container.Image, Image: container.Image,
Pull: container.Pull, Pull: container.Pull,
Detached: detached, Detached: detached,

View file

@ -15,7 +15,6 @@
package compiler package compiler
import ( import (
"fmt"
"sort" "sort"
backend_types "go.woodpecker-ci.org/woodpecker/v2/pipeline/backend/types" backend_types "go.woodpecker-ci.org/woodpecker/v2/pipeline/backend/types"
@ -30,14 +29,12 @@ type dagCompilerStep struct {
} }
type dagCompiler struct { type dagCompiler struct {
steps []*dagCompilerStep steps []*dagCompilerStep
prefix string
} }
func newDAGCompiler(steps []*dagCompilerStep, prefix string) dagCompiler { func newDAGCompiler(steps []*dagCompilerStep) dagCompiler {
return dagCompiler{ return dagCompiler{
steps: steps, steps: steps,
prefix: prefix,
} }
} }
@ -68,8 +65,6 @@ func (c dagCompiler) compileByGroup() ([]*backend_types.Stage, error) {
currentGroup = s.group currentGroup = s.group
currentStage = new(backend_types.Stage) currentStage = new(backend_types.Stage)
currentStage.Name = fmt.Sprintf("%s_stage_%v", c.prefix, s.position)
currentStage.Alias = s.name
stages = append(stages, currentStage) stages = append(stages, currentStage)
} }
@ -85,7 +80,7 @@ func (c dagCompiler) compileByDependsOn() ([]*backend_types.Stage, error) {
for _, s := range c.steps { for _, s := range c.steps {
stepMap[s.name] = s stepMap[s.name] = s
} }
return convertDAGToStages(stepMap, c.prefix) return convertDAGToStages(stepMap)
} }
func dfsVisit(steps map[string]*dagCompilerStep, name string, visited map[string]struct{}, path []string) error { func dfsVisit(steps map[string]*dagCompilerStep, name string, visited map[string]struct{}, path []string) error {
@ -107,7 +102,7 @@ func dfsVisit(steps map[string]*dagCompilerStep, name string, visited map[string
return nil return nil
} }
func convertDAGToStages(steps map[string]*dagCompilerStep, prefix string) ([]*backend_types.Stage, error) { func convertDAGToStages(steps map[string]*dagCompilerStep) ([]*backend_types.Stage, error) {
addedSteps := make(map[string]struct{}) addedSteps := make(map[string]struct{})
stages := make([]*backend_types.Stage, 0) stages := make([]*backend_types.Stage, 0)
@ -128,10 +123,7 @@ func convertDAGToStages(steps map[string]*dagCompilerStep, prefix string) ([]*ba
for len(steps) > 0 { for len(steps) > 0 {
addedNodesThisLevel := make(map[string]struct{}) addedNodesThisLevel := make(map[string]struct{})
stage := &backend_types.Stage{ stage := new(backend_types.Stage)
Name: fmt.Sprintf("%s_stage_%d", prefix, len(stages)),
Alias: fmt.Sprintf("%s_stage_%d", prefix, len(stages)),
}
var stepsToAdd []*dagCompilerStep var stepsToAdd []*dagCompilerStep
for name, step := range steps { for name, step := range steps {

View file

@ -36,7 +36,7 @@ func TestConvertDAGToStages(t *testing.T) {
dependsOn: []string{"step2"}, dependsOn: []string{"step2"},
}, },
} }
_, err := convertDAGToStages(steps, "") _, err := convertDAGToStages(steps)
assert.ErrorIs(t, err, &ErrStepDependencyCycle{}) assert.ErrorIs(t, err, &ErrStepDependencyCycle{})
steps = map[string]*dagCompilerStep{ steps = map[string]*dagCompilerStep{
@ -48,7 +48,7 @@ func TestConvertDAGToStages(t *testing.T) {
step: &backend_types.Step{}, step: &backend_types.Step{},
}, },
} }
_, err = convertDAGToStages(steps, "") _, err = convertDAGToStages(steps)
assert.NoError(t, err) assert.NoError(t, err)
steps = map[string]*dagCompilerStep{ steps = map[string]*dagCompilerStep{
@ -68,7 +68,7 @@ func TestConvertDAGToStages(t *testing.T) {
dependsOn: []string{"b", "c"}, dependsOn: []string{"b", "c"},
}, },
} }
_, err = convertDAGToStages(steps, "") _, err = convertDAGToStages(steps)
assert.NoError(t, err) assert.NoError(t, err)
steps = map[string]*dagCompilerStep{ steps = map[string]*dagCompilerStep{
@ -77,7 +77,7 @@ func TestConvertDAGToStages(t *testing.T) {
dependsOn: []string{"not-existing-step"}, dependsOn: []string{"not-existing-step"},
}, },
} }
_, err = convertDAGToStages(steps, "") _, err = convertDAGToStages(steps)
assert.ErrorIs(t, err, &ErrStepMissingDependency{}) assert.ErrorIs(t, err, &ErrStepMissingDependency{})
steps = map[string]*dagCompilerStep{ steps = map[string]*dagCompilerStep{
@ -86,10 +86,9 @@ func TestConvertDAGToStages(t *testing.T) {
name: "echo env", name: "echo env",
group: "", group: "",
step: &backend_types.Step{ step: &backend_types.Step{
Name: "test_step_0",
UUID: "01HJDPEW6R7J0JBE3F1T7Q0TYX", UUID: "01HJDPEW6R7J0JBE3F1T7Q0TYX",
Type: "commands", Type: "commands",
Alias: "echo env", Name: "echo env",
Image: "bash", Image: "bash",
}, },
}, },
@ -99,10 +98,9 @@ func TestConvertDAGToStages(t *testing.T) {
group: "", group: "",
dependsOn: []string{"echo env", "echo 2"}, dependsOn: []string{"echo env", "echo 2"},
step: &backend_types.Step{ step: &backend_types.Step{
Name: "test_step_1",
UUID: "01HJDPF770QGRZER8RF79XVS4M", UUID: "01HJDPF770QGRZER8RF79XVS4M",
Type: "commands", Type: "commands",
Alias: "echo 1", Name: "echo 1",
Image: "bash", Image: "bash",
}, },
}, },
@ -111,40 +109,32 @@ func TestConvertDAGToStages(t *testing.T) {
name: "echo 2", name: "echo 2",
group: "", group: "",
step: &backend_types.Step{ step: &backend_types.Step{
Name: "test_step_2",
UUID: "01HJDPFF5RMEYZW0YTGR1Y1ZR0", UUID: "01HJDPFF5RMEYZW0YTGR1Y1ZR0",
Type: "commands", Type: "commands",
Alias: "echo 2", Name: "echo 2",
Image: "bash", Image: "bash",
}, },
}, },
} }
stages, err := convertDAGToStages(steps, "test") stages, err := convertDAGToStages(steps)
assert.NoError(t, err) assert.NoError(t, err)
assert.EqualValues(t, []*backend_types.Stage{{ assert.EqualValues(t, []*backend_types.Stage{{
Name: "test_stage_0",
Alias: "test_stage_0",
Steps: []*backend_types.Step{{ Steps: []*backend_types.Step{{
Name: "test_step_0",
UUID: "01HJDPEW6R7J0JBE3F1T7Q0TYX", UUID: "01HJDPEW6R7J0JBE3F1T7Q0TYX",
Type: "commands", Type: "commands",
Alias: "echo env", Name: "echo env",
Image: "bash", Image: "bash",
}, { }, {
Name: "test_step_2",
UUID: "01HJDPFF5RMEYZW0YTGR1Y1ZR0", UUID: "01HJDPFF5RMEYZW0YTGR1Y1ZR0",
Type: "commands", Type: "commands",
Alias: "echo 2", Name: "echo 2",
Image: "bash", Image: "bash",
}}, }},
}, { }, {
Name: "test_stage_1",
Alias: "test_stage_1",
Steps: []*backend_types.Step{{ Steps: []*backend_types.Step{{
Name: "test_step_1",
UUID: "01HJDPF770QGRZER8RF79XVS4M", UUID: "01HJDPF770QGRZER8RF79XVS4M",
Type: "commands", Type: "commands",
Alias: "echo 1", Name: "echo 1",
Image: "bash", Image: "bash",
}}, }},
}}, stages) }}, stages)
@ -156,7 +146,7 @@ func TestIsDag(t *testing.T) {
step: &backend_types.Step{}, step: &backend_types.Step{},
}, },
} }
c := newDAGCompiler(steps, "") c := newDAGCompiler(steps)
assert.False(t, c.isDAG()) assert.False(t, c.isDAG())
steps = []*dagCompilerStep{ steps = []*dagCompilerStep{
@ -165,6 +155,6 @@ func TestIsDag(t *testing.T) {
dependsOn: []string{}, dependsOn: []string{},
}, },
} }
c = newDAGCompiler(steps, "") c = newDAGCompiler(steps)
assert.True(t, c.isDAG()) assert.True(t, c.isDAG())
} }

View file

@ -93,15 +93,15 @@ func (r *Runtime) MakeLogger() zerolog.Logger {
func (r *Runtime) Run(runnerCtx context.Context) error { func (r *Runtime) Run(runnerCtx context.Context) error {
logger := r.MakeLogger() logger := r.MakeLogger()
logger.Debug().Msgf("Executing %d stages, in order of:", len(r.spec.Stages)) logger.Debug().Msgf("Executing %d stages, in order of:", len(r.spec.Stages))
for _, stage := range r.spec.Stages { for stagePos, stage := range r.spec.Stages {
steps := []string{} stepNames := []string{}
for _, step := range stage.Steps { for _, step := range stage.Steps {
steps = append(steps, step.Name) stepNames = append(stepNames, step.Name)
} }
logger.Debug(). logger.Debug().
Str("Stage", stage.Name). Int("StagePos", stagePos).
Str("Steps", strings.Join(steps, ",")). Str("Steps", strings.Join(stepNames, ",")).
Msg("stage") Msg("stage")
} }

View file

@ -130,7 +130,7 @@ func setPipelineStepsOnPipeline(pipeline *model.Pipeline, pipelineItems []*stepb
gid = pidSequence gid = pidSequence
} }
step := &model.Step{ step := &model.Step{
Name: step.Alias, Name: step.Name,
UUID: step.UUID, UUID: step.UUID,
PipelineID: pipeline.ID, PipelineID: pipeline.ID,
PID: pidSequence, PID: pidSequence,