build(deps): bump ermite-api to the merged run name; log unreadable registered workflow names at debug
- commit
- 38090f16af867192017f80551bb50e22c92ca5f5
- author
- brice · · 2026-10-13 03:51 UTC
- parent
- 20985cc
- signature
- GPG Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· arch-gpg Verified for the committer email
3 files · +36 -15
M go.mod +1 -1
| @@ -13,7 +13,7 @@ tool ( | |||
| 13 | 13 | ||
| 14 | 14 | require ( | |
| 15 | 15 | bnema.dev/ermite-actions v0.0.0-20261013033114-44b8f3fa08d1 | |
| 16 | - | bnema.dev/ermite-api v0.0.0-20261013033228-5a86d44af445 | |
| 16 | + | bnema.dev/ermite-api v0.0.0-20261013034722-4db3b8badaf6 | |
| 17 | 17 | bnema.dev/ermite-git v0.1.0 | |
| 18 | 18 | bnema.dev/ermite-kv v0.0.0-20261010031554-5e09b48f81c3 | |
| 19 | 19 | connectrpc.com/connect v1.21.0 | |
| @@ -13,7 +13,7 @@ tool ( | |||||
| 13 | 13 | ||||
| 14 | require ( | 14 | require ( | ||
| 15 | bnema.dev/ermite-actions v0.0.0-20261013033114-44b8f3fa08d1 | 15 | bnema.dev/ermite-actions v0.0.0-20261013033114-44b8f3fa08d1 | ||
| 16 | - | bnema.dev/ermite-api v0.0.0-20261013033228-5a86d44af445 | 16 | + | bnema.dev/ermite-api v0.0.0-20261013034722-4db3b8badaf6 |
| 17 | bnema.dev/ermite-git v0.1.0 | 17 | bnema.dev/ermite-git v0.1.0 | ||
| 18 | bnema.dev/ermite-kv v0.0.0-20261010031554-5e09b48f81c3 | 18 | bnema.dev/ermite-kv v0.0.0-20261010031554-5e09b48f81c3 | ||
| 19 | connectrpc.com/connect v1.21.0 | 19 | connectrpc.com/connect v1.21.0 | ||
M go.sum +2 -2 generated file: collapsed
M internal/usecase/ci_trigger.go +33 -12
| @@ -477,36 +477,57 @@ func workflowName(wf *workflow.Workflow, path string) string { | |||
| 477 | 477 | ||
| 478 | 478 | // registeredName is the name GitHub shows for a tag run without run-name: the | |
| 479 | 479 | // name of the workflow registered for the path, here the "name:" of the file on | |
| 480 | - | // the default branch (the path when that file has none). It is own, the name of | |
| 481 | - | // the workflow of the run, when the default branch has no such file, the file | |
| 482 | - | // does not parse, or anything cannot be read. | |
| 480 | + | // the default branch (the path when that file has none). It falls back to own, | |
| 481 | + | // the name of the workflow of the run, when the default branch has no such | |
| 482 | + | // file, the file does not parse, or anything cannot be read; a failure other | |
| 483 | + | // than a missing file is logged at debug. | |
| 483 | 484 | func (c *CI) registeredName(ctx context.Context, repo domain.RepoName, wfPath, own string) string { | |
| 484 | - | def, exists, err := c.cfg.Repos.DefaultBranch(ctx, repo) | |
| 485 | - | if err != nil || !exists { | |
| 485 | + | name, err := c.registeredNameOf(ctx, repo, wfPath) | |
| 486 | + | if err != nil { | |
| 487 | + | if !errors.Is(err, domain.ErrNotFound) { | |
| 488 | + | log := zerowrap.FromCtx(ctx) | |
| 489 | + | log.Debug().Err(err).Str("workflow", wfPath).Msg("ci tag run title: the registered workflow name is not readable, using the run's own") | |
| 490 | + | } | |
| 486 | 491 | return own | |
| 487 | 492 | } | |
| 493 | + | return name | |
| 494 | + | } | |
| 495 | + | ||
| 496 | + | // registeredNameOf is registeredName without the fallback; a missing default | |
| 497 | + | // branch or file is domain.ErrNotFound. | |
| 498 | + | func (c *CI) registeredNameOf(ctx context.Context, repo domain.RepoName, wfPath string) (string, error) { | |
| 499 | + | def, exists, err := c.cfg.Repos.DefaultBranch(ctx, repo) | |
| 500 | + | if err != nil { | |
| 501 | + | return "", err | |
| 502 | + | } | |
| 503 | + | if !exists { | |
| 504 | + | return "", domain.ErrNotFound | |
| 505 | + | } | |
| 488 | 506 | tip, err := c.cfg.Git.BranchHead(ctx, repo, def) | |
| 489 | 507 | if err != nil { | |
| 490 | - | return own | |
| 508 | + | return "", err | |
| 491 | 509 | } | |
| 492 | 510 | tp, err := domain.ParseTreePath(wfPath) | |
| 493 | 511 | if err != nil { | |
| 494 | - | return own | |
| 512 | + | return "", err | |
| 495 | 513 | } | |
| 496 | 514 | _, rc, err := c.cfg.Reader.OpenBlob(ctx, repo, domain.RevisionOf(tip), tp) | |
| 497 | 515 | if err != nil { | |
| 498 | - | return own | |
| 516 | + | return "", err | |
| 499 | 517 | } | |
| 500 | 518 | content, err := io.ReadAll(io.LimitReader(rc, maxCIWorkflowBytes+1)) | |
| 501 | 519 | _ = rc.Close() | |
| 502 | - | if err != nil || len(content) > maxCIWorkflowBytes { | |
| 503 | - | return own | |
| 520 | + | if err != nil { | |
| 521 | + | return "", err | |
| 522 | + | } | |
| 523 | + | if len(content) > maxCIWorkflowBytes { | |
| 524 | + | return "", fmt.Errorf("workflow file over %d bytes", maxCIWorkflowBytes) | |
| 504 | 525 | } | |
| 505 | 526 | wf, errs := workflow.Parse(wfPath, content) | |
| 506 | 527 | if len(errs) > 0 { | |
| 507 | - | return own | |
| 528 | + | return "", fmt.Errorf("workflow does not parse: %v", errs[0]) | |
| 508 | 529 | } | |
| 509 | - | return workflowName(wf, wfPath) | |
| 530 | + | return workflowName(wf, wfPath), nil | |
| 510 | 531 | } | |
| 511 | 532 | ||
| 512 | 533 | // evalRunName evaluates the run-name of a workflow with the github, inputs and | |
| @@ -477,36 +477,57 @@ func workflowName(wf *workflow.Workflow, path string) string { | |||||
| 477 | 477 | ||||
| 478 | // registeredName is the name GitHub shows for a tag run without run-name: the | 478 | // registeredName is the name GitHub shows for a tag run without run-name: the | ||
| 479 | // name of the workflow registered for the path, here the "name:" of the file on | 479 | // name of the workflow registered for the path, here the "name:" of the file on | ||
| 480 | - | // the default branch (the path when that file has none). It is own, the name of | 480 | + | // the default branch (the path when that file has none). It falls back to own, |
| 481 | - | // the workflow of the run, when the default branch has no such file, the file | 481 | + | // the name of the workflow of the run, when the default branch has no such |
| 482 | - | // does not parse, or anything cannot be read. | 482 | + | // file, the file does not parse, or anything cannot be read; a failure other |
| 483 | + | // than a missing file is logged at debug. | |||
| 483 | func (c *CI) registeredName(ctx context.Context, repo domain.RepoName, wfPath, own string) string { | 484 | func (c *CI) registeredName(ctx context.Context, repo domain.RepoName, wfPath, own string) string { | ||
| 484 | - | def, exists, err := c.cfg.Repos.DefaultBranch(ctx, repo) | 485 | + | name, err := c.registeredNameOf(ctx, repo, wfPath) |
| 485 | - | if err != nil || !exists { | 486 | + | if err != nil { |
| 487 | + | if !errors.Is(err, domain.ErrNotFound) { | |||
| 488 | + | log := zerowrap.FromCtx(ctx) | |||
| 489 | + | log.Debug().Err(err).Str("workflow", wfPath).Msg("ci tag run title: the registered workflow name is not readable, using the run's own") | |||
| 490 | + | } | |||
| 486 | return own | 491 | return own | ||
| 487 | } | 492 | } | ||
| 493 | + | return name | |||
| 494 | + | } | |||
| 495 | + | ||||
| 496 | + | // registeredNameOf is registeredName without the fallback; a missing default | |||
| 497 | + | // branch or file is domain.ErrNotFound. | |||
| 498 | + | func (c *CI) registeredNameOf(ctx context.Context, repo domain.RepoName, wfPath string) (string, error) { | |||
| 499 | + | def, exists, err := c.cfg.Repos.DefaultBranch(ctx, repo) | |||
| 500 | + | if err != nil { | |||
| 501 | + | return "", err | |||
| 502 | + | } | |||
| 503 | + | if !exists { | |||
| 504 | + | return "", domain.ErrNotFound | |||
| 505 | + | } | |||
| 488 | tip, err := c.cfg.Git.BranchHead(ctx, repo, def) | 506 | tip, err := c.cfg.Git.BranchHead(ctx, repo, def) | ||
| 489 | if err != nil { | 507 | if err != nil { | ||
| 490 | - | return own | 508 | + | return "", err |
| 491 | } | 509 | } | ||
| 492 | tp, err := domain.ParseTreePath(wfPath) | 510 | tp, err := domain.ParseTreePath(wfPath) | ||
| 493 | if err != nil { | 511 | if err != nil { | ||
| 494 | - | return own | 512 | + | return "", err |
| 495 | } | 513 | } | ||
| 496 | _, rc, err := c.cfg.Reader.OpenBlob(ctx, repo, domain.RevisionOf(tip), tp) | 514 | _, rc, err := c.cfg.Reader.OpenBlob(ctx, repo, domain.RevisionOf(tip), tp) | ||
| 497 | if err != nil { | 515 | if err != nil { | ||
| 498 | - | return own | 516 | + | return "", err |
| 499 | } | 517 | } | ||
| 500 | content, err := io.ReadAll(io.LimitReader(rc, maxCIWorkflowBytes+1)) | 518 | content, err := io.ReadAll(io.LimitReader(rc, maxCIWorkflowBytes+1)) | ||
| 501 | _ = rc.Close() | 519 | _ = rc.Close() | ||
| 502 | - | if err != nil || len(content) > maxCIWorkflowBytes { | 520 | + | if err != nil { |
| 503 | - | return own | 521 | + | return "", err |
| 522 | + | } | |||
| 523 | + | if len(content) > maxCIWorkflowBytes { | |||
| 524 | + | return "", fmt.Errorf("workflow file over %d bytes", maxCIWorkflowBytes) | |||
| 504 | } | 525 | } | ||
| 505 | wf, errs := workflow.Parse(wfPath, content) | 526 | wf, errs := workflow.Parse(wfPath, content) | ||
| 506 | if len(errs) > 0 { | 527 | if len(errs) > 0 { | ||
| 507 | - | return own | 528 | + | return "", fmt.Errorf("workflow does not parse: %v", errs[0]) |
| 508 | } | 529 | } | ||
| 509 | - | return workflowName(wf, wfPath) | 530 | + | return workflowName(wf, wfPath), nil |
| 510 | } | 531 | } | ||
| 511 | 532 | ||||
| 512 | // evalRunName evaluates the run-name of a workflow with the github, inputs and | 533 | // evalRunName evaluates the run-name of a workflow with the github, inputs and | ||