fix: 🚨 release: inject main.Version + use 'version' subcommand in smoke-test #149

Merged
goern merged 0 commits from refs/pull/149/head into main 2026-05-25 08:36:40 +00:00
goern commented 2026-05-25 08:34:41 +00:00 (Migrated from codeberg.org)

Fixes v2.23.0 release run #172. Two bugs in the v2.23.0 pipeline:

  1. .goreleaser.yml ldflags injected -X main.BuildTag={{.Version}} but main.go declares var Version. main.BuildTag does not exist — injection is a no-op; shipped binaries report forgejo-mcp dev.
  2. Smoke-test ran $BIN --help, but cmd.go uses flag.NewFlagSet(..., flag.ExitOnError) with no -help flag. Exits non-zero, captured banner is the Usage block, regex never matches.

Fix:

  • .goreleaser.yml: -X main.BuildTag-X main.Version (drop unused BuildCommit/BuildDate).
  • .forgejo/workflows/release.yml: $BIN --help$BIN version (handled by cmd.isVersionRequest).

Verified locally:

$ go build -ldflags='-s -w -X main.Version=2.23.1-test' -o /tmp/x .
$ /tmp/x version
forgejo-mcp 2.23.1-test

Closes forgejo-mcp-hvr. Refs run #172.

Fixes v2.23.0 release run #172. Two bugs in the v2.23.0 pipeline: 1. `.goreleaser.yml` ldflags injected `-X main.BuildTag={{.Version}}` but `main.go` declares `var Version`. `main.BuildTag` does not exist — injection is a no-op; shipped binaries report `forgejo-mcp dev`. 2. Smoke-test ran `$BIN --help`, but `cmd.go` uses `flag.NewFlagSet(..., flag.ExitOnError)` with no `-help` flag. Exits non-zero, captured banner is the Usage block, regex never matches. Fix: - `.goreleaser.yml`: `-X main.BuildTag` → `-X main.Version` (drop unused BuildCommit/BuildDate). - `.forgejo/workflows/release.yml`: `$BIN --help` → `$BIN version` (handled by `cmd.isVersionRequest`). Verified locally: ``` $ go build -ldflags='-s -w -X main.Version=2.23.1-test' -o /tmp/x . $ /tmp/x version forgejo-mcp 2.23.1-test ``` Closes `forgejo-mcp-hvr`. Refs run #172.
op1st-gitops commented 2026-05-25 08:34:46 +00:00 (Migrated from codeberg.org)

op1st Pipelines as Code/on-pull-request-8kdlj is running.

Starting Pipelinerun on-pull-request-8kdlj in namespace op1st-pipelines

You can monitor the execution using the op1st Pipelines as Code PipelineRun viewer or through the command line by
using the tkn CLI with the following command:

tkn pr logs -n op1st-pipelines on-pull-request-8kdlj -f

op1st Pipelines as Code/on-pull-request-8kdlj is running. Starting Pipelinerun <b>[on-pull-request-8kdlj](https://console-openshift-console.apps.nostromo.erdgeschoss.b4mad.emea.operate-first.cloud/k8s/ns/op1st-pipelines/tekton.dev~v1~PipelineRun/on-pull-request-8kdlj)</b> in namespace <b>op1st-pipelines</b> You can monitor the execution using the [op1st Pipelines as Code](https://console-openshift-console.apps.nostromo.erdgeschoss.b4mad.emea.operate-first.cloud/k8s/ns/op1st-pipelines/tekton.dev~v1~PipelineRun/on-pull-request-8kdlj) PipelineRun viewer or through the command line by using the [tkn](https://tekton.dev/docs/cli/#installation) CLI with the following command: <code>tkn pr logs -n op1st-pipelines on-pull-request-8kdlj -f</code>
op1st-gitops commented 2026-05-25 08:34:46 +00:00 (Migrated from codeberg.org)

op1st Pipelines as Code/code-scans-nphmp is running.

Starting Pipelinerun code-scans-nphmp in namespace op1st-pipelines

You can monitor the execution using the op1st Pipelines as Code PipelineRun viewer or through the command line by
using the tkn CLI with the following command:

tkn pr logs -n op1st-pipelines code-scans-nphmp -f

op1st Pipelines as Code/code-scans-nphmp is running. Starting Pipelinerun <b>[code-scans-nphmp](https://console-openshift-console.apps.nostromo.erdgeschoss.b4mad.emea.operate-first.cloud/k8s/ns/op1st-pipelines/tekton.dev~v1~PipelineRun/code-scans-nphmp)</b> in namespace <b>op1st-pipelines</b> You can monitor the execution using the [op1st Pipelines as Code](https://console-openshift-console.apps.nostromo.erdgeschoss.b4mad.emea.operate-first.cloud/k8s/ns/op1st-pipelines/tekton.dev~v1~PipelineRun/code-scans-nphmp) PipelineRun viewer or through the command line by using the [tkn](https://tekton.dev/docs/cli/#installation) CLI with the following command: <code>tkn pr logs -n op1st-pipelines code-scans-nphmp -f</code>
op1st-gitops commented 2026-05-25 08:35:08 +00:00 (Migrated from codeberg.org)

op1st Pipelines as Code/code-scans-nphmp has successfully validated your commit.


Task Statuses:

StatusDurationName
Succeeded 12 seconds

fetch-source

Succeeded 9 seconds

gitleaks-version

Succeeded 10 seconds

gitleaks

op1st Pipelines as Code/code-scans-nphmp has <b>successfully</b> validated your commit. <ul> <li><b>Namespace</b>: <a href="https://detailurl.setting.custom-console-url-namespace.is.not.configured">op1st-pipelines</a></li> <li><b>PipelineRun:</b> <a href="https://console-openshift-console.apps.nostromo.erdgeschoss.b4mad.emea.operate-first.cloud/k8s/ns/op1st-pipelines/tekton.dev~v1~PipelineRun/code-scans-nphmp">code-scans-nphmp</a></li> </ul> <hr> <h4>Task Statuses:</h4> <table> <tr><th>Status</th><th>Duration</th><th>Name</th></tr> <tr> <td>Succeeded</td> <td>12 seconds</td><td> [fetch-source](https://console-openshift-console.apps.nostromo.erdgeschoss.b4mad.emea.operate-first.cloud/k8s/ns/op1st-pipelines/tekton.dev~v1~PipelineRun/code-scans-nphmp/logs/fetch-source) </td></tr> <tr> <td>Succeeded</td> <td>9 seconds</td><td> [gitleaks-version](https://console-openshift-console.apps.nostromo.erdgeschoss.b4mad.emea.operate-first.cloud/k8s/ns/op1st-pipelines/tekton.dev~v1~PipelineRun/code-scans-nphmp/logs/gitleaks-version) </td></tr> <tr> <td>Succeeded</td> <td>10 seconds</td><td> [gitleaks](https://console-openshift-console.apps.nostromo.erdgeschoss.b4mad.emea.operate-first.cloud/k8s/ns/op1st-pipelines/tekton.dev~v1~PipelineRun/code-scans-nphmp/logs/gitleaks) </td></tr> </table>
op1st-gitops commented 2026-05-25 08:36:18 +00:00 (Migrated from codeberg.org)

op1st Pipelines as Code/on-pull-request-8kdlj has successfully validated your commit.


Task Statuses:

StatusDurationName
Succeeded 10 seconds

fetch-source

Succeeded 1 minute

build-and-test

op1st Pipelines as Code/on-pull-request-8kdlj has <b>successfully</b> validated your commit. <ul> <li><b>Namespace</b>: <a href="https://detailurl.setting.custom-console-url-namespace.is.not.configured">op1st-pipelines</a></li> <li><b>PipelineRun:</b> <a href="https://console-openshift-console.apps.nostromo.erdgeschoss.b4mad.emea.operate-first.cloud/k8s/ns/op1st-pipelines/tekton.dev~v1~PipelineRun/on-pull-request-8kdlj">on-pull-request-8kdlj</a></li> </ul> <hr> <h4>Task Statuses:</h4> <table> <tr><th>Status</th><th>Duration</th><th>Name</th></tr> <tr> <td>Succeeded</td> <td>10 seconds</td><td> [fetch-source](https://console-openshift-console.apps.nostromo.erdgeschoss.b4mad.emea.operate-first.cloud/k8s/ns/op1st-pipelines/tekton.dev~v1~PipelineRun/on-pull-request-8kdlj/logs/fetch-source) </td></tr> <tr> <td>Succeeded</td> <td>1 minute</td><td> [build-and-test](https://console-openshift-console.apps.nostromo.erdgeschoss.b4mad.emea.operate-first.cloud/k8s/ns/op1st-pipelines/tekton.dev~v1~PipelineRun/on-pull-request-8kdlj/logs/build-and-test) </td></tr> </table>
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
agentic-forges/forgejo-mcp!149
No description provided.