mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-12-22 08:27:06 +00:00
Unique status for matrix (#2695)
implement this fix but with an additional field on workflows to not change the workflow name closes #1840 closes #713 --------- Co-authored-by: 6543 <6543@obermui.de>
This commit is contained in:
parent
037703028e
commit
abb2f280eb
5 changed files with 9 additions and 3 deletions
|
@ -244,7 +244,7 @@ var flags = append([]cli.Flag{
|
||||||
EnvVars: []string{"WOODPECKER_STATUS_CONTEXT_FORMAT"},
|
EnvVars: []string{"WOODPECKER_STATUS_CONTEXT_FORMAT"},
|
||||||
Name: "status-context-format",
|
Name: "status-context-format",
|
||||||
Usage: "status context format",
|
Usage: "status context format",
|
||||||
Value: "{{ .context }}/{{ .event }}/{{ .workflow }}",
|
Value: "{{ .context }}/{{ .event }}/{{ .workflow }}{{if not (eq .axis_id 0}}/{{.axis_id}}{{end}}",
|
||||||
},
|
},
|
||||||
&cli.BoolFlag{
|
&cli.BoolFlag{
|
||||||
EnvVars: []string{"WOODPECKER_MIGRATIONS_ALLOW_LONG"},
|
EnvVars: []string{"WOODPECKER_MIGRATIONS_ALLOW_LONG"},
|
||||||
|
|
|
@ -517,7 +517,7 @@ Context prefix Woodpecker will use to publish status messages to SCM. You probab
|
||||||
|
|
||||||
### `WOODPECKER_STATUS_CONTEXT_FORMAT`
|
### `WOODPECKER_STATUS_CONTEXT_FORMAT`
|
||||||
|
|
||||||
> Default: `{{ .context }}/{{ .event }}/{{ .workflow }}`
|
> Default: `{{ .context }}/{{ .event }}/{{ .workflow }}{{if not (eq .axis_id 0}}/{{.axis_id}}{{end}}`
|
||||||
|
|
||||||
Template for the status messages published to forges, uses [Go templates](https://pkg.go.dev/text/template) as template language.
|
Template for the status messages published to forges, uses [Go templates](https://pkg.go.dev/text/template) as template language.
|
||||||
Supported variables:
|
Supported variables:
|
||||||
|
|
|
@ -77,12 +77,13 @@ func (b *StepBuilder) Build() ([]*Item, error) {
|
||||||
axes = append(axes, matrix.Axis{})
|
axes = append(axes, matrix.Axis{})
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, axis := range axes {
|
for i, axis := range axes {
|
||||||
workflow := &model.Workflow{
|
workflow := &model.Workflow{
|
||||||
PID: pidSequence,
|
PID: pidSequence,
|
||||||
State: model.StatusPending,
|
State: model.StatusPending,
|
||||||
Environ: axis,
|
Environ: axis,
|
||||||
Name: SanitizePath(y.Name),
|
Name: SanitizePath(y.Name),
|
||||||
|
AxisID: i + 1,
|
||||||
}
|
}
|
||||||
item, err := b.genItemForWorkflow(workflow, axis, string(y.Data))
|
item, err := b.genItemForWorkflow(workflow, axis, string(y.Data))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -19,6 +19,8 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"text/template"
|
"text/template"
|
||||||
|
|
||||||
|
"github.com/rs/zerolog/log"
|
||||||
|
|
||||||
"github.com/woodpecker-ci/woodpecker/server"
|
"github.com/woodpecker-ci/woodpecker/server"
|
||||||
"github.com/woodpecker-ci/woodpecker/server/model"
|
"github.com/woodpecker-ci/woodpecker/server/model"
|
||||||
)
|
)
|
||||||
|
@ -41,8 +43,10 @@ func GetPipelineStatusContext(repo *model.Repo, pipeline *model.Pipeline, workfl
|
||||||
"workflow": workflow.Name,
|
"workflow": workflow.Name,
|
||||||
"owner": repo.Owner,
|
"owner": repo.Owner,
|
||||||
"repo": repo.Name,
|
"repo": repo.Name,
|
||||||
|
"axis_id": workflow.AxisID,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
log.Error().Err(err).Msg("could not create status context")
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,7 @@ type Workflow struct {
|
||||||
AgentID int64 `json:"agent_id,omitempty" xorm:"workflow_agent_id"`
|
AgentID int64 `json:"agent_id,omitempty" xorm:"workflow_agent_id"`
|
||||||
Platform string `json:"platform,omitempty" xorm:"workflow_platform"`
|
Platform string `json:"platform,omitempty" xorm:"workflow_platform"`
|
||||||
Environ map[string]string `json:"environ,omitempty" xorm:"json 'workflow_environ'"`
|
Environ map[string]string `json:"environ,omitempty" xorm:"json 'workflow_environ'"`
|
||||||
|
AxisID int `json:"-" xorm:"workflow_axis_id"`
|
||||||
Children []*Step `json:"children,omitempty" xorm:"-"`
|
Children []*Step `json:"children,omitempty" xorm:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue