From d284aeb54564e9b45813d0c37c82759cdffee57d Mon Sep 17 00:00:00 2001 From: qwerty287 <80460567+qwerty287@users.noreply.github.com> Date: Fri, 3 Nov 2023 13:00:34 +0100 Subject: [PATCH] Fix default status (#2715) Regression #2695 probably closes #2716 --- cmd/server/flags.go | 2 +- docs/docs/30-administration/10-server-config.md | 2 +- server/forge/common/status.go | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/cmd/server/flags.go b/cmd/server/flags.go index cfeb763c8a..b274aaf834 100644 --- a/cmd/server/flags.go +++ b/cmd/server/flags.go @@ -244,7 +244,7 @@ var flags = append([]cli.Flag{ EnvVars: []string{"WOODPECKER_STATUS_CONTEXT_FORMAT"}, Name: "status-context-format", Usage: "status context format", - Value: "{{ .context }}/{{ .event }}/{{ .workflow }}{{if not (eq .axis_id 0}}/{{.axis_id}}{{end}}", + Value: "{{ .context }}/{{ .event }}/{{ .workflow }}{{if not (eq .axis_id 0)}}/{{.axis_id}}{{end}}", }, &cli.BoolFlag{ EnvVars: []string{"WOODPECKER_MIGRATIONS_ALLOW_LONG"}, diff --git a/docs/docs/30-administration/10-server-config.md b/docs/docs/30-administration/10-server-config.md index ba5ac735d1..26d775f798 100644 --- a/docs/docs/30-administration/10-server-config.md +++ b/docs/docs/30-administration/10-server-config.md @@ -517,7 +517,7 @@ Context prefix Woodpecker will use to publish status messages to SCM. You probab ### `WOODPECKER_STATUS_CONTEXT_FORMAT` -> Default: `{{ .context }}/{{ .event }}/{{ .workflow }}{{if not (eq .axis_id 0}}/{{.axis_id}}{{end}}` +> 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. Supported variables: diff --git a/server/forge/common/status.go b/server/forge/common/status.go index fca6ffe326..14f1cf6b32 100644 --- a/server/forge/common/status.go +++ b/server/forge/common/status.go @@ -34,6 +34,7 @@ func GetPipelineStatusContext(repo *model.Repo, pipeline *model.Pipeline, workfl tmpl, err := template.New("context").Parse(server.Config.Server.StatusContextFormat) if err != nil { + log.Error().Err(err).Msg("could not create status from template") return "" } var ctx bytes.Buffer