Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package gitea-runner for openSUSE:Factory checked in at 2026-11-30 14:28:47 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/gitea-runner (Old) and /work/SRC/openSUSE:Factory/.gitea-runner.new.1340718 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "gitea-runner" Mon Nov 30 14:28:47 2026 rev:13 rq:1401591 version:6.1.0 Changes: -------- --- /work/SRC/openSUSE:Factory/gitea-runner/gitea-runner.changes 2026-11-23 12:33:16.246627145 +0100 +++ /work/SRC/openSUSE:Factory/.gitea-runner.new.1340718/gitea-runner.changes 2026-11-30 14:32:04.437277974 +0100 @@ -1,0 +2,11 @@ +Mon Nov 30 09:47:35 UTC 2026 - Elisei Roca <[email protected]> + +- Update to version 6.1.0: + * enhance: run JavaScript actions on a pinned Node.js (#1400) + * fix: composite action masks, systempaths option and locked action clones (#1424) + * fix: upload artifacts directly when jobs cannot reach the runner's cache (#1425) + * enhance: add host.stable_workdir for predictable host job paths (#1402) + * feat: add `runner.action_replacements` to rewrite step `uses` (#1417) + * enhance: align job execution closer to GitHub Actions (#1421) + +------------------------------------------------------------------- Old: ---- runner-6.0.1.tar.gz New: ---- runner-6.1.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ gitea-runner.spec ++++++ --- /var/tmp/diff_new_pack.6TlR3K/_old 2026-11-30 14:32:05.332315703 +0100 +++ /var/tmp/diff_new_pack.6TlR3K/_new 2026-11-30 14:32:05.338315956 +0100 @@ -17,7 +17,7 @@ Name: gitea-runner -Version: 6.0.1 +Version: 6.1.0 Release: 0 Summary: Gitea Runner for Gitea Actions License: MIT ++++++ _service ++++++ --- /var/tmp/diff_new_pack.6TlR3K/_old 2026-11-30 14:32:05.386317980 +0100 +++ /var/tmp/diff_new_pack.6TlR3K/_new 2026-11-30 14:32:05.390318148 +0100 @@ -5,7 +5,7 @@ <param name="exclude">.git</param> <param name="versionformat">@PARENT_TAG@</param> <param name="versionrewrite-pattern">v(.*)</param> - <param name="revision">v6.0.1</param> + <param name="revision">v6.1.0</param> <param name="changesgenerate">enable</param> </service> <service name="recompress" mode="manual"> ++++++ _servicedata ++++++ --- /var/tmp/diff_new_pack.6TlR3K/_old 2026-11-30 14:32:05.415319202 +0100 +++ /var/tmp/diff_new_pack.6TlR3K/_new 2026-11-30 14:32:05.419319371 +0100 @@ -1,6 +1,6 @@ <servicedata> <service name="tar_scm"> <param name="url">https://gitea.com/gitea/runner.git</param> - <param name="changesrevision">ff4f6268719bb97c12d12453cb560c9749d59102</param></service></servicedata> + <param name="changesrevision">a8d0d8a7e0836df7fc1d8c02139d31a31b1efa31</param></service></servicedata> (No newline at EOF) ++++++ runner-6.0.1.tar.gz -> runner-6.1.0.tar.gz ++++++ ++++ 12637 lines of diff (skipped) ++++++ vendor.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vendor/gitea.dev/actionslib/pkg/expreval/evaluator.go new/vendor/gitea.dev/actionslib/pkg/expreval/evaluator.go --- old/vendor/gitea.dev/actionslib/pkg/expreval/evaluator.go 2026-11-20 04:05:08.000000000 +0100 +++ new/vendor/gitea.dev/actionslib/pkg/expreval/evaluator.go 2026-11-27 17:31:36.000000000 +0100 @@ -5,10 +5,12 @@ package expreval import ( + "errors" "fmt" "math" "regexp" "slices" + "strconv" "strings" "gitea.dev/actionslib/pkg/exprparser" @@ -37,6 +39,10 @@ if err != nil { return "", err } + return ee.interpolateParts(in, parts) +} + +func (ee Evaluator) interpolateParts(in string, parts []part) (string, error) { if len(parts) == 1 && !parts[0].isExpr { return in, nil } @@ -65,7 +71,24 @@ if len(parts) == 1 && parts[0].isExpr { return ee.evaluate(parts[0].text, exprparser.DefaultStatusCheckNone) } - return ee.Interpolate(in) + return ee.interpolateParts(in, parts) +} + +// EvaluateTimeoutMinutes evaluates a timeout and converts it to whole minutes. +func (ee Evaluator) EvaluateTimeoutMinutes(raw string) (int32, error) { + value, err := ee.EvaluateScalar(raw) + if err != nil { + return 0, err + } + if minutes, ok := value.(float64); ok { + return int32(minutes), nil + } + text := exprparser.CoerceToString(value) + minutes, err := strconv.ParseFloat(text, 64) + if _, isString := value.(string); err != nil || isString && strings.Contains(raw, "${{") { + return 0, errors.New("Unexpected value '" + text + "'") + } + return int32(minutes), nil } // EvalBool reads bare expressions and interpolated strings as conditions, like GitHub's ConvertToIfCondition. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vendor/gitea.dev/actionslib/pkg/exprparser/interpreter.go new/vendor/gitea.dev/actionslib/pkg/exprparser/interpreter.go --- old/vendor/gitea.dev/actionslib/pkg/exprparser/interpreter.go 2026-11-20 04:05:08.000000000 +0100 +++ new/vendor/gitea.dev/actionslib/pkg/exprparser/interpreter.go 2026-11-27 17:31:36.000000000 +0100 @@ -137,8 +137,8 @@ return impl.evaluateNode(statusCheckNode(defaultStatusCheck), memory) } - parser := syntax.NewValidatingParser(impl.config.Context, isNamedValue) - exprNode, err := parser.Parse(NewExprLexer(input)) + validator := syntax.Validator{Job: impl.config.Context == "job", IsNamedValue: isNamedValue} + exprNode, err := validator.Parse(input) if err != nil { return nil, err } @@ -953,15 +953,7 @@ case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Float32, reflect.Float64: - number := numberValue(value) - if number == 0 { - return "0" // normalizes -0 - } else if math.IsInf(number, 1) { - return "Infinity" - } else if math.IsInf(number, -1) { - return "-Infinity" - } - return strconv.FormatFloat(number, 'G', 15, 64) + return syntax.FormatNumber(numberValue(value)) case reflect.Slice, reflect.Array: return "Array" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vendor/gitea.dev/actionslib/pkg/internal/syntax/expression.go new/vendor/gitea.dev/actionslib/pkg/internal/syntax/expression.go --- old/vendor/gitea.dev/actionslib/pkg/internal/syntax/expression.go 2026-11-20 04:05:08.000000000 +0100 +++ new/vendor/gitea.dev/actionslib/pkg/internal/syntax/expression.go 2026-11-27 17:31:36.000000000 +0100 @@ -6,23 +6,30 @@ import ( "errors" - "slices" + "math" + "strconv" "strings" ) // NamedValues are the contexts an expression may read. var NamedValues = []string{"github", "gitea", "env", "job", "jobs", "steps", "runner", "secrets", "vars", "strategy", "matrix", "needs", "inputs"} -// ValidateExpression parses an expression with every context and function, using the status function arity of a "job" or "step". -func ValidateExpression(expression, context string) error { - if _, err := NewValidatingParser(context, isNamedValue).Parse(NewExprLexer(expression)); err != nil { - return err +// FormatNumber renders an expression number as GitHub does. +func FormatNumber(number float64) string { + switch { + case number == 0: + return "0" // normalizes -0 + case math.IsInf(number, 1): + return "Infinity" + case math.IsInf(number, -1): + return "-Infinity" + default: + return strconv.FormatFloat(number, 'G', 15, 64) } - return nil } -// ValidateTemplate parses every `${{ }}` expression in value, like ValidateExpression. -func ValidateTemplate(value, context string) error { +// ValidateTemplate parses every `${{ }}` expression in value. +func (validator *Validator) ValidateTemplate(value string) error { for { _, rest, found := strings.Cut(value, "${{") if !found { @@ -33,7 +40,7 @@ return errors.New("unclosed expression") } if !isLiteral { - if err := ValidateExpression(strings.TrimSpace(rest[:end]), context); err != nil { + if _, err := validator.Parse(strings.TrimSpace(rest[:end])); err != nil { return err } } @@ -42,26 +49,27 @@ } // ValidateCondition parses an `if:` value the way it is evaluated, where a lone quoted literal is the condition itself. -func ValidateCondition(value, context string) error { - if !strings.Contains(value, "${{") { - if strings.TrimSpace(value) == "" { - return nil - } - return ValidateExpression(value, context) +func (validator *Validator) ValidateCondition(value string) error { + if literal, ok := LiteralExpression(value); ok { + value = literal + } else if strings.Contains(value, "${{") { + return validator.ValidateTemplate(value) } - if rest, ok := strings.CutPrefix(value, "${{"); ok { - if end, literal, isLiteral := ScanExpression(rest); end >= 0 && isLiteral && rest[end+len("}}"):] == "" { - if strings.TrimSpace(literal) == "" { - return nil - } - return ValidateExpression(literal, context) - } + if strings.TrimSpace(value) == "" { + return nil } - return ValidateTemplate(value, context) + _, err := validator.Parse(value) + return err } -func isNamedValue(name string) bool { - return slices.ContainsFunc(NamedValues, func(namedValue string) bool { return strings.EqualFold(namedValue, name) }) +// LiteralExpression unwraps a template that consists entirely of a quoted or blank expression. +func LiteralExpression(value string) (string, bool) { + if rest, ok := strings.CutPrefix(value, "${{"); ok { + if end, literal, isLiteral := ScanExpression(rest); isLiteral && end+len("}}") == len(rest) { + return literal, true + } + } + return "", false } // ScanExpression returns the closing `}}` offset after `${{`, or -1 if unclosed. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vendor/gitea.dev/actionslib/pkg/internal/syntax/parser.go new/vendor/gitea.dev/actionslib/pkg/internal/syntax/parser.go --- old/vendor/gitea.dev/actionslib/pkg/internal/syntax/parser.go 2026-11-20 04:05:08.000000000 +0100 +++ new/vendor/gitea.dev/actionslib/pkg/internal/syntax/parser.go 2026-11-27 17:31:36.000000000 +0100 @@ -11,19 +11,17 @@ import ( "fmt" "math" + "slices" "strings" ) // ExprParser parses an expression token stream. type ExprParser struct { - current Token - previous Token - lexer *ExprLexer - err *ExprError - validate bool // reject unknown names and wrong arities while parsing, as the runner does - context string // "job" or "step", which decides what success() and failure() accept - - isNamedValue func(name string) bool + current Token + previous Token + lexer *ExprLexer + err *ExprError + validator *Validator } const ( @@ -36,26 +34,49 @@ return &ExprParser{} } -// NewValidatingParser creates a parser that rejects unknown named values, functions and arities. -func NewValidatingParser(context string, isNamedValue func(name string) bool) *ExprParser { - return &ExprParser{validate: true, context: context, isNamedValue: isNamedValue} +// Validator checks names and function arity while parsing expressions. +type Validator struct { + IsNamedValue func(string) bool // nil permits every known context + SpecialFunctions []string // nil permits every known special function + Job bool // permits arguments to success() and failure() +} + +// Parse parses and validates an expression using the configured scope. +func (validator *Validator) Parse(source string) (ExprNode, error) { + node, err := (&ExprParser{validator: validator}).Parse(NewExprLexer(source)) + if err != nil { + return nil, err + } + return node, nil +} + +func (validator *Validator) allowsNamedValue(name string) bool { + if validator.IsNamedValue != nil { + return validator.IsNamedValue(name) + } + return slices.ContainsFunc(NamedValues, func(value string) bool { return strings.EqualFold(value, name) }) +} + +type functionSpec struct { + min, max int + special bool } // functionArity is GitHub's own table, enforced while parsing as GitHub does. -var functionArity = map[string]struct{ min, max int }{ - "contains": {2, 2}, - "startswith": {2, 2}, - "endswith": {2, 2}, - "format": {1, math.MaxUint8}, - "join": {1, 2}, - "tojson": {1, 1}, - "fromjson": {1, 1}, - "hashfiles": {1, math.MaxUint8}, - "case": {3, math.MaxUint8}, - "always": {0, 0}, - "success": {0, 0}, - "cancelled": {0, 0}, - "failure": {0, 0}, +var functionArity = map[string]functionSpec{ + "contains": {2, 2, false}, + "startswith": {2, 2, false}, + "endswith": {2, 2, false}, + "format": {1, math.MaxUint8, false}, + "join": {1, 2, false}, + "tojson": {1, 1, false}, + "fromjson": {1, 1, false}, + "hashfiles": {1, math.MaxUint8, true}, + "case": {3, math.MaxUint8, false}, + "always": {0, 0, true}, + "success": {0, 0, true}, + "cancelled": {0, 0, true}, + "failure": {0, 0, true}, } func (parser *ExprParser) setError(description string, token *Token) { @@ -96,13 +117,16 @@ return &NumberNode{Value: math.Inf(1)}, false } if parser.current.Kind != TokenKindLeftParen { - if parser.validate && !parser.isNamedValue(identifier.Value) { + if parser.validator != nil && !parser.validator.allowsNamedValue(identifier.Value) { parser.setError("Unrecognized named-value", &identifier) return nil, false } return &VariableNode{Name: identifier.Value}, true } - if _, known := functionArity[strings.ToLower(identifier.Value)]; parser.validate && !known { + callee := strings.ToLower(identifier.Value) + arity, known := functionArity[callee] + if validator := parser.validator; validator != nil && + (!known || arity.special && validator.SpecialFunctions != nil && !slices.Contains(validator.SpecialFunctions, callee)) { parser.setError("Unrecognized function", &identifier) return nil, false } @@ -110,7 +134,7 @@ open := parser.next() arguments := make([]ExprNode, 0, 2) if parser.current.Kind == TokenKindRightParen { - return parser.finishCall(identifier, open, arguments) + return parser.finishCall(identifier, open, arguments, callee, arity) } for { argument := parser.parseBinary(1) @@ -119,7 +143,7 @@ } arguments = append(arguments, argument) if parser.current.Kind == TokenKindRightParen { - return parser.finishCall(identifier, open, arguments) + return parser.finishCall(identifier, open, arguments, callee, arity) } if parser.current.Kind != TokenKindComma { parser.unexpected() @@ -130,16 +154,14 @@ } // finishCall checks arity as the call closes, before reading beyond it, and reports errors on the opening parenthesis. -func (parser *ExprParser) finishCall(identifier, open Token, arguments []ExprNode) (ExprNode, bool) { +func (parser *ExprParser) finishCall(identifier, open Token, arguments []ExprNode, callee string, arity functionSpec) (ExprNode, bool) { parser.next() - callee := strings.ToLower(identifier.Value) - arity := functionArity[callee] // GitHub's job-level schema widens both to `(0,MAX)`, documenting no meaning for the arguments - if parser.context == "job" && (callee == "success" || callee == "failure") { + if parser.validator != nil && parser.validator.Job && (callee == "success" || callee == "failure") { arity.max = math.MaxUint8 } switch { - case !parser.validate: + case parser.validator == nil: case len(arguments) < arity.min: parser.setError("Too few parameters supplied", &open) case len(arguments) > arity.max: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vendor/gitea.dev/actionslib/pkg/model/action.go new/vendor/gitea.dev/actionslib/pkg/model/action.go --- old/vendor/gitea.dev/actionslib/pkg/model/action.go 2026-11-20 04:05:08.000000000 +0100 +++ new/vendor/gitea.dev/actionslib/pkg/model/action.go 2026-11-27 17:31:36.000000000 +0100 @@ -140,6 +140,9 @@ if err != nil { return nil, err } + if err := validateActionExpressions(root, nil, false); err != nil { + return nil, err + } a := new(Action) if err := root.Decode(a); err != nil { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vendor/gitea.dev/actionslib/pkg/model/action_validate.go new/vendor/gitea.dev/actionslib/pkg/model/action_validate.go --- old/vendor/gitea.dev/actionslib/pkg/model/action_validate.go 1970-01-01 01:00:00.000000000 +0100 +++ new/vendor/gitea.dev/actionslib/pkg/model/action_validate.go 2026-11-27 17:31:36.000000000 +0100 @@ -0,0 +1,110 @@ +// Copyright 2026 The Gitea Authors. All rights reserved. +// SPDX-License-Identifier: MIT + +package model + +import ( + "errors" + "fmt" + "slices" + "strings" + + "gitea.dev/actionslib/pkg/internal/syntax" + + "go.yaml.in/yaml/v4" +) + +var errActionExpressionNotAllowed = errors.New("a template expression is not allowed in this context") + +var ( + actionBaseContexts = []string{"github", "gitea", "strategy", "matrix", "job", "runner"} + actionStepContexts = slices.Concat(actionBaseContexts, []string{"steps", "inputs", "env"}) + hashFilesOnly = []string{"hashfiles"} + actionPlain = actionValidator([]string{}, []string{}) + actionInput = actionValidator(actionBaseContexts, hashFilesOnly) + actionOutput = actionValidator(actionStepContexts, []string{}) + actionDocker = actionValidator([]string{"inputs"}, []string{}) + actionStep = actionValidator(actionStepContexts, hashFilesOnly) + actionStepIf = actionValidator(actionStepContexts, []string{"hashfiles", "always", "cancelled", "failure", "success"}) +) + +func actionValidator(namedValues, specialFunctions []string) syntax.Validator { + return syntax.Validator{IsNamedValue: namedValuesIn(namedValues...), SpecialFunctions: specialFunctions} +} + +func validateActionExpressions(node *yaml.Node, fields []string, mappingKey bool) error { + if node.Kind == yaml.ScalarNode { + if err := validateActionScalar(node, fields, mappingKey); err != nil { + return fmt.Errorf("(Line: %d, Col: %d): %w", node.Line, node.Column, err) + } + return nil + } + for i, child := range node.Content { + childFields := fields + if node.Kind == yaml.MappingNode && i%2 == 1 && node.Content[i-1].ShortTag() != "!!merge" { + childFields = append(childFields, node.Content[i-1].Value) + } + if err := validateActionExpressions(child, childFields, node.Kind == yaml.MappingNode && i%2 == 0); err != nil { + return err + } + } + return nil +} + +func validateActionScalar(node *yaml.Node, fields []string, mappingKey bool) error { + tag := node.ShortTag() + if !slices.Contains(workflowTags, tag) { + return fmt.Errorf("Unexpected tag '%s'", tag) + } + validator := &actionPlain + var condition bool + switch { + case len(fields) == 3 && fields[0] == "inputs" && fields[2] == "default": + validator = &actionInput + case len(fields) == 3 && fields[0] == "outputs" && fields[2] == "value": + validator = &actionOutput + case len(fields) >= 2 && fields[0] == "runs" && (fields[1] == "args" || fields[1] == "env"): + validator = &actionDocker + case len(fields) >= 3 && fields[0] == "runs" && fields[1] == "steps": + switch fields[2] { + case "if": + validator, condition = &actionStepIf, true + case "continue-on-error": + validator, condition = &actionStep, true + case "name", "run", "shell", "working-directory", "env", "with", "timeout-minutes": + validator = &actionStep + } + } + if condition { + if tag != "!!str" { + literal, err := conditionLiteral(node) + if err != nil { + return err + } + node.Value, node.Tag = literal, "!!str" + } + return validator.ValidateCondition(node.Value) + } + if !strings.Contains(node.Value, "${{") { + return nil + } + if mappingKey && isInsertDirective(node) { + if validator == &actionPlain { + return errActionExpressionNotAllowed + } + return nil + } + if err := validator.ValidateTemplate(node.Value); err != nil { + return err + } + if validator == &actionPlain { + literal, ok := syntax.LiteralExpression(node.Value) + if !ok { + return errActionExpressionNotAllowed + } + if !strings.Contains(literal, "${{") { // preserve escaped expressions through interpolation + node.Value = literal + } + } + return nil +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vendor/gitea.dev/actionslib/pkg/model/validate.go new/vendor/gitea.dev/actionslib/pkg/model/validate.go --- old/vendor/gitea.dev/actionslib/pkg/model/validate.go 2026-11-20 04:05:08.000000000 +0100 +++ new/vendor/gitea.dev/actionslib/pkg/model/validate.go 2026-11-27 17:31:36.000000000 +0100 @@ -6,8 +6,8 @@ import ( "errors" "fmt" - "math" "slices" + "strconv" "strings" "gitea.dev/actionslib/pkg/internal/syntax" @@ -17,38 +17,55 @@ var workflowTags = []string{"!!str", "!!int", "!!float", "!!bool", "!!null", "!!seq", "!!map", "!!merge"} +var jobConditionValidator = syntax.Validator{Job: true, IsNamedValue: namedValuesIn("github", "gitea", "needs", "vars", "inputs")} + +// ValidateJobCondition checks a job condition against the contexts available before matrix expansion. +func ValidateJobCondition(condition string) error { + return jobConditionValidator.ValidateCondition(condition) +} + +func namedValuesIn(allowed ...string) func(string) bool { + return func(name string) bool { + return slices.ContainsFunc(allowed, func(value string) bool { return syntax.OrdinalIgnoreCaseEqual(value, name) }) + } +} + func validateExpressions(root *yaml.Node) error { - conditions := map[*yaml.Node]string{} + stepCondition := syntax.Validator{} + template := syntax.Validator{Job: true} + conditions := map[*yaml.Node]*syntax.Validator{} jobs := mappingValue(root, "jobs") for i := 1; jobs != nil && i < len(jobs.Content); i += 2 { job := jobs.Content[i] - conditions[mappingValue(job, "if")] = "job" + conditions[mappingValue(job, "if")] = &jobConditionValidator if steps := mappingValue(job, "steps"); steps != nil { for _, step := range steps.Content { - conditions[mappingValue(step, "if")] = "step" + conditions[mappingValue(step, "if")] = &stepCondition } } } var errs []error var walk func(node *yaml.Node) walk = func(node *yaml.Node) { - if node.ShortTag() == "!!timestamp" { // YAML 1.2 has no timestamps - node.Tag = "!!str" + tag := node.ShortTag() + if tag == "!!timestamp" { // YAML 1.2 has no timestamps + tag, node.Tag = "!!str", "!!str" } - context, isCondition := conditions[node] + condition := conditions[node] var err error switch { - case node.Tag == "!" || node.Kind != yaml.DocumentNode && !slices.Contains(workflowTags, node.ShortTag()): + case node.Tag == "!" || node.Kind != yaml.DocumentNode && !slices.Contains(workflowTags, tag): err = fmt.Errorf("unexpected tag '%s'", strings.Replace(node.Tag, "tag:yaml.org,2002:", "!!", 1)) - case isCondition && node.Kind != yaml.ScalarNode: + case condition != nil && node.Kind != yaml.ScalarNode: err = errors.New("a condition must be a string") - case isCondition: - if node.ShortTag() != "!!str" { - node.Value, node.Tag = conditionLiteral(node), "!!str" + case condition != nil: + if tag != "!!str" { + node.Value, _ = conditionLiteral(node) + node.Tag = "!!str" } - err = syntax.ValidateCondition(node.Value, context) + err = condition.ValidateCondition(node.Value) case node.Kind == yaml.ScalarNode: - err = syntax.ValidateTemplate(node.Value, "job") + err = template.ValidateTemplate(node.Value) } if err != nil { errs = append(errs, fmt.Errorf("(Line: %d, Col: %d): %w", node.Line, node.Column, err)) @@ -65,20 +82,17 @@ } // conditionLiteral is the condition a boolean, null or number `if:` stands for, where null means none. -func conditionLiteral(node *yaml.Node) string { +func conditionLiteral(node *yaml.Node) (string, error) { var value any if err := node.Decode(&value); err != nil || value == nil { - return "" + return "", err } - switch number, _ := value.(float64); { - case math.IsNaN(number): - return "NaN" - case math.IsInf(number, 1): - return "Infinity" - case math.IsInf(number, -1): - return "-Infinity" + switch value.(type) { + case int, int64, uint64, float64: + number, _ := strconv.ParseFloat(fmt.Sprint(value), 64) + return syntax.FormatNumber(number), nil } - return fmt.Sprint(value) + return fmt.Sprint(value), nil } // isInsertDirective reports the `${{ insert }}` key, which merges a mapping into its parent instead of naming a value. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vendor/gitea.dev/actionslib/pkg/model/workflow.go new/vendor/gitea.dev/actionslib/pkg/model/workflow.go --- old/vendor/gitea.dev/actionslib/pkg/model/workflow.go 2026-11-20 04:05:08.000000000 +0100 +++ new/vendor/gitea.dev/actionslib/pkg/model/workflow.go 2026-11-27 17:31:36.000000000 +0100 @@ -8,6 +8,7 @@ package model import ( + "cmp" "crypto/sha256" "errors" "fmt" @@ -26,6 +27,9 @@ "go.yaml.in/yaml/v4" ) +// MaxWorkflowCallDepth is the maximum number of workflows in a call chain, including the root. +const MaxWorkflowCallDepth = 10 + // Workflow is the structure of the files in .github/workflows type Workflow struct { File string @@ -861,6 +865,16 @@ return s.ID } +// StepDisplayName names a step like GitHub, where evaluated is its String() after evaluation, or empty before it runs. +func StepDisplayName(step *Step, evaluated string) string { + if step.Name != "" { + return cmp.Or(evaluated, step.Name) + } + name := step.String() + first, _, _ := strings.Cut(strings.TrimSpace(cmp.Or(evaluated, name)), "\n") + return "Run " + cmp.Or(strings.TrimSpace(first), name) +} + // Environment returns string-based key=value map for a step func (s *Step) Environment() map[string]string { return environment(s.Env) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vendor/gitea.dev/actionslib/pkg/model/workflow_validate.go new/vendor/gitea.dev/actionslib/pkg/model/workflow_validate.go --- old/vendor/gitea.dev/actionslib/pkg/model/workflow_validate.go 1970-01-01 01:00:00.000000000 +0100 +++ new/vendor/gitea.dev/actionslib/pkg/model/workflow_validate.go 2026-11-27 17:31:36.000000000 +0100 @@ -0,0 +1,205 @@ +// Copyright 2026 The Gitea Authors. All rights reserved. +// SPDX-License-Identifier: MIT + +package model + +import ( + "errors" + "fmt" + "slices" + "strings" + + "gitea.dev/actionslib/pkg/internal/syntax" + + "go.yaml.in/yaml/v4" +) + +var ( + runNameValidator = syntax.Validator{Job: true, IsNamedValue: namedValuesIn("github", "gitea", "inputs", "vars")} + callerWithValidator = syntax.Validator{IsNamedValue: namedValuesIn("github", "gitea", "needs", "strategy", "matrix", "inputs", "vars"), SpecialFunctions: []string{}} +) + +// ValidateWorkflow checks job dependencies, job kinds, runs-on, caller inputs and run-name in an alias-expanded workflow document. +func ValidateWorkflow(root *yaml.Node) error { + if root.Kind == yaml.DocumentNode { + root = root.Content[0] + } + var jobs []*yaml.Node + if node := mappingValue(root, "jobs"); node != nil && node.Kind == yaml.MappingNode { + jobs = node.Content + } + if err := validateWorkflowStructure(jobs); err != nil { + return err + } + if err := validateJobKinds(jobs); err != nil { + return err + } + if node := mappingValue(root, "run-name"); node != nil { + var runName string + if err := node.Decode(&runName); err != nil { + return err + } + if err := runNameValidator.ValidateTemplate(runName); err != nil { + return fmt.Errorf("run-name: %w", err) + } + } + return nil +} + +func validateWorkflowStructure(jobs []*yaml.Node) error { + dependencies := map[string][]string{} + for i := 0; i+1 < len(jobs); i += 2 { + if jobs[i].ShortTag() != "!!null" { + dependencies[jobs[i].Value] = nil + } + } + if len(dependencies) == 0 { + return errors.New("the workflow must contain at least one job") + } + for i := 0; i+1 < len(jobs); i += 2 { + if jobs[i].ShortTag() == "!!null" { + continue + } + id, job := jobs[i].Value, jobs[i+1] + if job.ShortTag() == "!!null" { + return fmt.Errorf("job %q has no configuration", id) + } + if needs := mappingValue(job, "needs"); needs != nil { + dependencies[id] = nodeAsStringSlice(*needs) + } + for _, dependency := range dependencies[id] { + if _, ok := dependencies[dependency]; !ok { + return fmt.Errorf("job %q needs unknown job %q", id, dependency) + } + } + } + checked := make(map[string]bool, len(dependencies)) + var visit func(string) error + visit = func(id string) error { + if complete, seen := checked[id]; seen { + if !complete { + return fmt.Errorf("job %q has a dependency cycle", id) + } + return nil + } + checked[id] = false + for _, dependency := range dependencies[id] { + if err := visit(dependency); err != nil { + return err + } + } + checked[id] = true + return nil + } + for i := 0; i+1 < len(jobs); i += 2 { + if err := visit(jobs[i].Value); err != nil { + return err + } + } + return nil +} + +var ( + stepsJobKeys = []string{"cancel-timeout-minutes", "container", "continue-on-error", "defaults", "env", "environment", "outputs", "runs-on", "services", "snapshot", "steps", "timeout-minutes"} + callerJobKeys = []string{"secrets", "uses", "with"} + sharedJobKeys = []string{"cache-mode", "concurrency", "if", "name", "needs", "permissions", "strategy"} +) + +func validateJobKinds(jobs []*yaml.Node) error { + for i := 0; i+1 < len(jobs); i += 2 { + id, job := jobs[i].Value, jobs[i+1] + var required string + for j := 0; j+1 < len(job.Content); j += 2 { + key := job.Content[j].Value + switch { + case required != "uses" && slices.Contains(stepsJobKeys, key): + required = "runs-on" + case required != "runs-on" && slices.Contains(callerJobKeys, key): + required = "uses" + case slices.Contains(sharedJobKeys, key): + default: + return fmt.Errorf("job %s: Unexpected value '%s'", id, key) + } + } + if required == "" { + keys := slices.Concat(stepsJobKeys, callerJobKeys) + slices.Sort(keys) + return fmt.Errorf("job %s: There's not enough info to determine what you meant. Add one of these properties: %s", id, strings.Join(keys, ", ")) + } + value := mappingValue(job, required) + if value == nil { + return fmt.Errorf("job %s: Required property is missing: %s", id, required) + } + if required == "runs-on" { + if err := ValidateRunsOn(value); err != nil { + return fmt.Errorf("job %s: runs-on: %w", id, err) + } + } else if with := mappingValue(job, "with"); with != nil { + for k := 0; k+1 < len(with.Content); k += 2 { + if err := callerWithValidator.ValidateTemplate(with.Content[k+1].Value); err != nil { + return fmt.Errorf("job %s: with: %s: %w", id, with.Content[k].Value, err) + } + } + } + } + return nil +} + +// ValidateRunsOn checks a runs-on value against GitHub's schema. +func ValidateRunsOn(node *yaml.Node) error { + if node.Kind != yaml.MappingNode { + return validateRunsOnLabels(node) + } + for i := 0; i+1 < len(node.Content); i += 2 { + var err error + switch key := node.Content[i].Value; key { + case "labels": + err = validateRunsOnLabels(node.Content[i+1]) + case "group": + err = validateRunsOnGroup(node.Content[i+1]) + default: + return fmt.Errorf("Unexpected value '%s'", key) + } + if err != nil { + return err + } + } + return nil +} + +func validateRunsOnLabels(node *yaml.Node) error { + if node.Kind != yaml.SequenceNode { + return validateNonEmptyString(node) + } + for _, label := range node.Content { + if err := validateNonEmptyString(label); err != nil { + return err + } + } + return nil +} + +func validateRunsOnGroup(node *yaml.Node) error { + if err := validateNonEmptyString(node); err != nil || strings.Contains(node.Value, "${{") { + return err + } + switch prefix, name, found := strings.Cut(node.Value, "/"); { + case found && name == "": + return errors.New("Invalid runs-on group name '" + node.Value + "'.") + case found && (strings.Contains(name, "/") || !slices.Contains([]string{"org", "organization", "ent", "enterprise"}, prefix)): + return errors.New("Invalid runs-on group name '" + node.Value + "'. Please use 'organization/' or 'enterprise/' prefix to target a single runner group.") + } + return nil +} + +func validateNonEmptyString(node *yaml.Node) error { + switch { + case node.Kind == yaml.SequenceNode: + return errors.New("A sequence was not expected") + case node.Kind == yaml.MappingNode: + return errors.New("A mapping was not expected") + case node.Value == "" || node.ShortTag() == "!!null": + return errors.New("Unexpected value ''") + } + return nil +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vendor/gitea.dev/actionslib/pkg/protocol/limits.go new/vendor/gitea.dev/actionslib/pkg/protocol/limits.go --- old/vendor/gitea.dev/actionslib/pkg/protocol/limits.go 1970-01-01 01:00:00.000000000 +0100 +++ new/vendor/gitea.dev/actionslib/pkg/protocol/limits.go 2026-11-27 17:31:36.000000000 +0100 @@ -0,0 +1,13 @@ +// Copyright 2026 The Gitea Authors. All rights reserved. +// SPDX-License-Identifier: MIT + +package protocol + +const ( + // MaxOutputKeyLength is the maximum length of an output key in bytes. + MaxOutputKeyLength = 255 + // MaxOutputValueLength is the maximum length of an output value in bytes. + MaxOutputValueLength = 1 << 20 + // MaxStepSummarySize is the maximum size of a step summary in bytes. + MaxStepSummarySize = 1 << 20 +) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vendor/gitea.dev/actionslib/runner/v1/result.go new/vendor/gitea.dev/actionslib/runner/v1/result.go --- old/vendor/gitea.dev/actionslib/runner/v1/result.go 1970-01-01 01:00:00.000000000 +0100 +++ new/vendor/gitea.dev/actionslib/runner/v1/result.go 2026-11-27 17:31:36.000000000 +0100 @@ -0,0 +1,24 @@ +// Copyright 2026 The Gitea Authors. All rights reserved. +// SPDX-License-Identifier: MIT + +package runnerv1 + +import "strings" + +// Conclusion returns the lowercase result name without the RESULT_ prefix. +func (r Result) Conclusion() string { + return strings.ToLower(strings.TrimPrefix(r.String(), "RESULT_")) +} + +var conclusions = map[string]Result{ + "success": Result_RESULT_SUCCESS, + "failure": Result_RESULT_FAILURE, + "skipped": Result_RESULT_SKIPPED, + "cancelled": Result_RESULT_CANCELLED, +} + +// ParseConclusion looks up a supported lowercase conclusion name. +func ParseConclusion(name string) (Result, bool) { + result, ok := conclusions[name] + return result, ok +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vendor/github.com/docker/cli/opts/gpus.go new/vendor/github.com/docker/cli/opts/gpus.go --- old/vendor/github.com/docker/cli/opts/gpus.go 2026-11-20 04:05:08.000000000 +0100 +++ new/vendor/github.com/docker/cli/opts/gpus.go 2026-11-27 17:31:36.000000000 +0100 @@ -33,8 +33,6 @@ } // Set a new mount value -// -//nolint:gocyclo func (o *GpuOpts) Set(value string) error { csvReader := csv.NewReader(strings.NewReader(value)) fields, err := csvReader.Read() @@ -48,20 +46,14 @@ // Set writable as the default for _, field := range fields { key, val, withValue := strings.Cut(field, "=") + if !withValue { + key, val = "count", key + } if _, ok := seen[key]; ok { return fmt.Errorf("gpu request key '%s' can be specified only once", key) } seen[key] = struct{}{} - if !withValue { - seen["count"] = struct{}{} - req.Count, err = parseCount(key) - if err != nil { - return err - } - continue - } - switch key { case "driver": req.Driver = val diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vendor/github.com/moby/moby/api/types/network/endpoint.go new/vendor/github.com/moby/moby/api/types/network/endpoint.go --- old/vendor/github.com/moby/moby/api/types/network/endpoint.go 2026-11-20 04:05:08.000000000 +0100 +++ new/vendor/github.com/moby/moby/api/types/network/endpoint.go 2026-11-27 17:31:36.000000000 +0100 @@ -52,6 +52,7 @@ epCopy.Aliases = slices.Clone(es.Aliases) epCopy.DNSNames = slices.Clone(es.DNSNames) epCopy.DriverOpts = maps.Clone(es.DriverOpts) + epCopy.MacAddress = slices.Clone(es.MacAddress) return &epCopy } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vendor/github.com/moby/moby/api/types/plugin/.gitignore new/vendor/github.com/moby/moby/api/types/plugin/.gitignore --- old/vendor/github.com/moby/moby/api/types/plugin/.gitignore 2026-11-20 04:05:08.000000000 +0100 +++ new/vendor/github.com/moby/moby/api/types/plugin/.gitignore 1970-01-01 01:00:00.000000000 +0100 @@ -1 +0,0 @@ -testdata/rapid/** diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vendor/github.com/moby/moby/client/client.go new/vendor/github.com/moby/moby/client/client.go --- old/vendor/github.com/moby/moby/client/client.go 2026-11-20 04:05:08.000000000 +0100 +++ new/vendor/github.com/moby/moby/client/client.go 2026-11-27 17:31:36.000000000 +0100 @@ -108,7 +108,7 @@ // overriding the version and disable API-version negotiation. // // This version may be lower than the version of the api library module used. -const MaxAPIVersion = "1.56" +const MaxAPIVersion = "1.57" // MinAPIVersion is the minimum API version supported by the client. API versions // below this version are not considered when performing API-version negotiation. @@ -436,7 +436,7 @@ return dialPipeContext(ctx, cli.addr) default: if tlsConfig := cli.tlsConfig(); tlsConfig != nil { - return tls.Dial(cli.proto, cli.addr, tlsConfig) + return (&tls.Dialer{Config: tlsConfig}).DialContext(ctx, cli.proto, cli.addr) } return net.Dial(cli.proto, cli.addr) } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vendor/github.com/moby/moby/client/errors.go new/vendor/github.com/moby/moby/client/errors.go --- old/vendor/github.com/moby/moby/client/errors.go 2026-11-20 04:05:08.000000000 +0100 +++ new/vendor/github.com/moby/moby/client/errors.go 2026-11-27 17:31:36.000000000 +0100 @@ -4,10 +4,7 @@ "context" "errors" "fmt" - "net/http" - cerrdefs "github.com/containerd/errdefs" - "github.com/containerd/errdefs/pkg/errhttp" "github.com/moby/moby/client/pkg/versions" ) @@ -72,43 +69,3 @@ } return nil } - -type httpError struct { - err error - errdef error -} - -func (e *httpError) Error() string { - return e.err.Error() -} - -func (e *httpError) Unwrap() error { - return e.err -} - -func (e *httpError) Is(target error) bool { - return errors.Is(e.errdef, target) -} - -// httpErrorFromStatusCode creates an errdef error, based on the provided HTTP status-code -func httpErrorFromStatusCode(err error, statusCode int) error { - if err == nil { - return nil - } - base := errhttp.ToNative(statusCode) - if base != nil { - return &httpError{err: err, errdef: base} - } - - switch { - case statusCode >= http.StatusOK && statusCode < http.StatusBadRequest: - // it's a client error - return err - case statusCode >= http.StatusBadRequest && statusCode < http.StatusInternalServerError: - return &httpError{err: err, errdef: cerrdefs.ErrInvalidArgument} - case statusCode >= http.StatusInternalServerError && statusCode < 600: - return &httpError{err: err, errdef: cerrdefs.ErrInternal} - default: - return &httpError{err: err, errdef: cerrdefs.ErrUnknown} - } -} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vendor/github.com/moby/moby/client/hijack.go new/vendor/github.com/moby/moby/client/hijack.go --- old/vendor/github.com/moby/moby/client/hijack.go 2026-11-20 04:05:08.000000000 +0100 +++ new/vendor/github.com/moby/moby/client/hijack.go 2026-11-27 17:31:36.000000000 +0100 @@ -100,8 +100,10 @@ if err != nil { return nil, "", err } + // Closing the body ends the otelhttp span. A 101 response has no body, + // so this does not close the connection. + _ = resp.Body.Close() if resp.StatusCode != http.StatusSwitchingProtocols { - _ = resp.Body.Close() return nil, "", fmt.Errorf("unable to upgrade to %s, received %d", proto, resp.StatusCode) } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vendor/github.com/moby/moby/client/internal/httperror/httperror.go new/vendor/github.com/moby/moby/client/internal/httperror/httperror.go --- old/vendor/github.com/moby/moby/client/internal/httperror/httperror.go 1970-01-01 01:00:00.000000000 +0100 +++ new/vendor/github.com/moby/moby/client/internal/httperror/httperror.go 2026-11-27 17:31:36.000000000 +0100 @@ -0,0 +1,55 @@ +// Package httperror classifies errors using HTTP status codes. +package httperror + +import ( + "errors" + "net/http" + + cerrdefs "github.com/containerd/errdefs" + "github.com/containerd/errdefs/pkg/errhttp" +) + +type httpError struct { + err error + errDef error +} + +func (e *httpError) Error() string { + return e.err.Error() +} + +func (e *httpError) Unwrap() error { + return e.err +} + +func (e *httpError) Is(target error) bool { + return errors.Is(e.errDef, target) +} + +// FromStatusCode classifies err using the HTTP status code while preserving +// its message and error chain. +func FromStatusCode(err error, statusCode int) error { + if err == nil || statusCode == 0 { + return err + } + if statusCode >= http.StatusOK && statusCode < http.StatusBadRequest { + // The HTTP status indicates success or redirection, so err may originate + // from client-side processing. Preserve it without adding a classification. + return err + } + errDef := errhttp.ToNative(statusCode) + if cerrdefs.IsUnknown(errDef) { + switch { + case statusCode >= http.StatusBadRequest && statusCode < http.StatusInternalServerError: + errDef = cerrdefs.ErrInvalidArgument + case statusCode >= http.StatusInternalServerError && statusCode < 600: + errDef = cerrdefs.ErrInternal + default: + errDef = cerrdefs.ErrUnknown + } + } + return &httpError{ + err: err, + errDef: errDef, + } +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vendor/github.com/moby/moby/client/internal/jsonmessages.go new/vendor/github.com/moby/moby/client/internal/jsonmessages.go --- old/vendor/github.com/moby/moby/client/internal/jsonmessages.go 2026-11-20 04:05:08.000000000 +0100 +++ new/vendor/github.com/moby/moby/client/internal/jsonmessages.go 2026-11-27 17:31:36.000000000 +0100 @@ -8,7 +8,7 @@ "iter" "sync" - "github.com/containerd/errdefs/pkg/errhttp" + "github.com/moby/moby/client/internal/httperror" "github.com/moby/moby/api/types/jsonstream" ) @@ -96,40 +96,8 @@ } if jm.Error != nil { // push/pull failures. - return httpErrorFromStatusCode(jm.Error, jm.Error.Code) + return httperror.FromStatusCode(jm.Error, jm.Error.Code) } } return nil } - -type httpError struct { - err error - errdef error -} - -func (e *httpError) Error() string { - return e.err.Error() -} - -func (e *httpError) Unwrap() error { - return e.err -} - -func (e *httpError) Is(target error) bool { - return errors.Is(e.errdef, target) -} - -// httpErrorFromStatusCode creates an errdef error, based on the provided HTTP status-code -// -// TODO(thaJeztah): unify with the implementation in client and move to an internal package -// see https://github.com/moby/moby/blob/client/v0.4.0/client/errors.go#L76-L114 -func httpErrorFromStatusCode(err error, statusCode int) error { - if err == nil { - return nil - } - - return &httpError{ - err: err, - errdef: errhttp.ToNative(statusCode), - } -} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vendor/github.com/moby/moby/client/request.go new/vendor/github.com/moby/moby/client/request.go --- old/vendor/github.com/moby/moby/client/request.go 2026-11-20 04:05:08.000000000 +0100 +++ new/vendor/github.com/moby/moby/client/request.go 2026-11-27 17:31:36.000000000 +0100 @@ -15,6 +15,7 @@ "strings" "github.com/moby/moby/api/types/common" + "github.com/moby/moby/client/internal/httperror" ) // head sends an http request to the docker API using the method HEAD. @@ -226,7 +227,7 @@ return nil } defer func() { - retErr = httpErrorFromStatusCode(retErr, serverResp.StatusCode) + retErr = httperror.FromStatusCode(retErr, serverResp.StatusCode) }() var body []byte diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vendor/golang.org/x/sync/singleflight/singleflight.go new/vendor/golang.org/x/sync/singleflight/singleflight.go --- old/vendor/golang.org/x/sync/singleflight/singleflight.go 1970-01-01 01:00:00.000000000 +0100 +++ new/vendor/golang.org/x/sync/singleflight/singleflight.go 2026-11-27 17:31:36.000000000 +0100 @@ -0,0 +1,214 @@ +// Copyright 2013 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package singleflight provides a duplicate function call suppression +// mechanism. +package singleflight // import "golang.org/x/sync/singleflight" + +import ( + "bytes" + "errors" + "fmt" + "runtime" + "runtime/debug" + "sync" +) + +// errGoexit indicates runtime.Goexit was called in +// the user-given function. +var errGoexit = errors.New("runtime.Goexit was called") + +// A panicError is an arbitrary value recovered from a panic +// with the stack trace during the execution of the given function. +type panicError struct { + value any + stack []byte +} + +// Error implements error interface. +func (p *panicError) Error() string { + return fmt.Sprintf("%v\n\n%s", p.value, p.stack) +} + +func (p *panicError) Unwrap() error { + err, ok := p.value.(error) + if !ok { + return nil + } + + return err +} + +func newPanicError(v any) error { + stack := debug.Stack() + + // The first line of the stack trace is of the form "goroutine N [status]:" + // but by the time the panic reaches Do the goroutine may no longer exist + // and its status will have changed. Trim out the misleading line. + if line := bytes.IndexByte(stack[:], '\n'); line >= 0 { + stack = stack[line+1:] + } + return &panicError{value: v, stack: stack} +} + +// call is an in-flight or completed singleflight.Do call +type call struct { + wg sync.WaitGroup + + // These fields are written once before the WaitGroup is done + // and are only read after the WaitGroup is done. + val any + err error + + // These fields are read and written with the singleflight + // mutex held before the WaitGroup is done, and are read but + // not written after the WaitGroup is done. + dups int + chans []chan<- Result +} + +// Group represents a class of work and forms a namespace in +// which units of work can be executed with duplicate suppression. +type Group struct { + mu sync.Mutex // protects m + m map[string]*call // lazily initialized +} + +// Result holds the results of Do, so they can be passed +// on a channel. +type Result struct { + Val any + Err error + Shared bool +} + +// Do executes and returns the results of the given function, making +// sure that only one execution is in-flight for a given key at a +// time. If a duplicate comes in, the duplicate caller waits for the +// original to complete and receives the same results. +// The return value shared indicates whether v was given to multiple callers. +func (g *Group) Do(key string, fn func() (any, error)) (v any, err error, shared bool) { + g.mu.Lock() + if g.m == nil { + g.m = make(map[string]*call) + } + if c, ok := g.m[key]; ok { + c.dups++ + g.mu.Unlock() + c.wg.Wait() + + if e, ok := c.err.(*panicError); ok { + panic(e) + } else if c.err == errGoexit { + runtime.Goexit() + } + return c.val, c.err, true + } + c := new(call) + c.wg.Add(1) + g.m[key] = c + g.mu.Unlock() + + g.doCall(c, key, fn) + return c.val, c.err, c.dups > 0 +} + +// DoChan is like Do but returns a channel that will receive the +// results when they are ready. +// +// The returned channel will not be closed. +func (g *Group) DoChan(key string, fn func() (any, error)) <-chan Result { + ch := make(chan Result, 1) + g.mu.Lock() + if g.m == nil { + g.m = make(map[string]*call) + } + if c, ok := g.m[key]; ok { + c.dups++ + c.chans = append(c.chans, ch) + g.mu.Unlock() + return ch + } + c := &call{chans: []chan<- Result{ch}} + c.wg.Add(1) + g.m[key] = c + g.mu.Unlock() + + go g.doCall(c, key, fn) + + return ch +} + +// doCall handles the single call for a key. +func (g *Group) doCall(c *call, key string, fn func() (any, error)) { + normalReturn := false + recovered := false + + // use double-defer to distinguish panic from runtime.Goexit, + // more details see https://golang.org/cl/134395 + defer func() { + // the given function invoked runtime.Goexit + if !normalReturn && !recovered { + c.err = errGoexit + } + + g.mu.Lock() + defer g.mu.Unlock() + c.wg.Done() + if g.m[key] == c { + delete(g.m, key) + } + + if e, ok := c.err.(*panicError); ok { + // In order to prevent the waiting channels from being blocked forever, + // needs to ensure that this panic cannot be recovered. + if len(c.chans) > 0 { + go panic(e) + select {} // Keep this goroutine around so that it will appear in the crash dump. + } else { + panic(e) + } + } else if c.err == errGoexit { + // Already in the process of goexit, no need to call again + } else { + // Normal return + for _, ch := range c.chans { + ch <- Result{c.val, c.err, c.dups > 0} + } + } + }() + + func() { + defer func() { + if !normalReturn { + // Ideally, we would wait to take a stack trace until we've determined + // whether this is a panic or a runtime.Goexit. + // + // Unfortunately, the only way we can distinguish the two is to see + // whether the recover stopped the goroutine from terminating, and by + // the time we know that, the part of the stack trace relevant to the + // panic has been discarded. + if r := recover(); r != nil { + c.err = newPanicError(r) + } + } + }() + + c.val, c.err = fn() + normalReturn = true + }() + + if !normalReturn { + recovered = true + } +} + +// Forget tells the singleflight to forget about a key. Future calls +// to Do for this key will call the function rather than waiting for +// an earlier call to complete. +func (g *Group) Forget(key string) { + g.mu.Lock() + delete(g.m, key) + g.mu.Unlock() +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vendor/modules.txt new/vendor/modules.txt --- old/vendor/modules.txt 2026-11-20 04:05:08.000000000 +0100 +++ new/vendor/modules.txt 2026-11-27 17:31:36.000000000 +0100 @@ -5,7 +5,7 @@ connectrpc.com/connect/v2/connecthttp connectrpc.com/connect/v2/connectproto connectrpc.com/connect/v2/internal/bufferpool -# gitea.dev/actionslib v1.6.0 +# gitea.dev/actionslib v1.7.1 ## explicit; go 1.26.0 gitea.dev/actionslib/ping/v1 gitea.dev/actionslib/ping/v1/pingv1connect @@ -52,7 +52,7 @@ # github.com/distribution/reference v0.6.0 ## explicit; go 1.20 github.com/distribution/reference -# github.com/docker/cli v29.9.3+incompatible +# github.com/docker/cli v29.10.0+incompatible ## explicit github.com/docker/cli/cli/connhelper/internal/syntax github.com/docker/cli/cli/connhelper/ssh @@ -92,7 +92,7 @@ # github.com/moby/docker-image-spec v1.3.1 ## explicit; go 1.18 github.com/moby/docker-image-spec/specs-go/v1 -# github.com/moby/moby/api v1.56.1 +# github.com/moby/moby/api v1.57.0 ## explicit; go 1.24 github.com/moby/moby/api/pkg/authconfig github.com/moby/moby/api/pkg/stdcopy @@ -113,10 +113,11 @@ github.com/moby/moby/api/types/swarm github.com/moby/moby/api/types/system github.com/moby/moby/api/types/volume -# github.com/moby/moby/client v0.6.2 +# github.com/moby/moby/client v0.6.3 ## explicit; go 1.24 github.com/moby/moby/client github.com/moby/moby/client/internal +github.com/moby/moby/client/internal/httperror github.com/moby/moby/client/internal/mod github.com/moby/moby/client/internal/timestamp github.com/moby/moby/client/pkg/versions @@ -255,7 +256,7 @@ go.yaml.in/yaml/v4/plugin/errorformat/v4 go.yaml.in/yaml/v4/plugin/loaderlimits go.yaml.in/yaml/v4/plugin/mergekey -# golang.org/x/net v0.62.0 +# golang.org/x/net v0.63.0 ## explicit; go 1.26.0 golang.org/x/net/http/httpguts golang.org/x/net/http/httpproxy @@ -263,6 +264,7 @@ # golang.org/x/sync v0.25.0 ## explicit; go 1.26.0 golang.org/x/sync/errgroup +golang.org/x/sync/singleflight # golang.org/x/sys v0.50.0 ## explicit; go 1.26.0 golang.org/x/sys/plan9
