Skip to content

feat: add version command and improve --version output#296

Merged
mathieu-benoit merged 1 commit intomainfrom
copilot/adapt-feature-from-score-compose
Apr 16, 2026
Merged

feat: add version command and improve --version output#296
mathieu-benoit merged 1 commit intomainfrom
copilot/adapt-feature-from-score-compose

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 16, 2026

Ports the same feature from score-compose#467 to score-k8s.

Description

Improves version output and adds a new version subcommand with Score logo and update check.

--version output — before:

score-k8s 0.1.0 (build: 2026-01-01T18:28:02Z, sha: abc123-dirty)

--version output — after:

score-k8s 0.1.0 (go1.26.2 - linux/amd64)
git commit: abc123
build date: 2026-01-01T18:28:02Z

New score-k8s version command:

                   ...    .............
               .......   .............
           .........     ............
       .........        .....
      .......           ....   ..
       ..........      .....   ......
           ........   ......   ..........
              .....   .....       ..........
                      ....          ........
              ...........       .........
           ..............    .........
         ................   ......
         ...............    ..
          ............

score-k8s 0.1.0 (go1.26.2 - linux/amd64)
git commit: abc123
build date: 2026-01-01T18:28:02Z

A newer version is available: v0.2.0
Update at: https://github.com/score-spec/score-k8s/releases/tag/v0.2.0

What does this PR do?

  • internal/version/version.go: Replaces debug.ReadBuildInfo() with injected GitCommit/BuildDate ldflags + runtime.GOOS/runtime.GOARCH. Fixes -dirty suffix issue and broken version info in container images.
  • internal/command/version.go (new): version subcommand with Score logo (--no-logo), version string, and GitHub releases update check (--no-updates-check).
  • internal/command/root.go: Exports ScoreImplementationName = "score-k8s" for reuse; updates version template.
  • .goreleaser.yaml: Injects GitCommit/BuildDate at release build time.
  • Dockerfile: Adds GIT_COMMIT/BUILD_DATE build args and passes them as ldflags.
  • .github/workflows/release.yaml: Passes github.sha and github.event.head_commit.timestamp as GIT_COMMIT/BUILD_DATE build-args.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • New chore (expected functionality to be implemented)

Checklist:

  • My change requires a change to the documentation.
    • I have updated the documentation accordingly.
  • I've signed off with an email address that matches the commit author.

Agent-Logs-Url: https://github.com/score-spec/score-k8s/sessions/121099cf-86ba-4cca-a966-aa8b08ba8154

Co-authored-by: mathieu-benoit <11720844+mathieu-benoit@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 16, 2026

Overview

Image reference score-k8s:latest score-k8s:latest
- digest 70755a5b596e 16537aa16552
- tag latest latest
- provenance 3c8f3a5 a6ba66b
- vulnerabilities critical: 0 high: 0 medium: 0 low: 0 critical: 0 high: 0 medium: 0 low: 0
- platform linux/amd64 linux/amd64
- size 8.2 MB 8.2 MB (-2.7 kB)
- packages 64 64
Policies (0 improved, 0 worsened)
Policy Name score-k8s:latest score-k8s:latest Change Standing
Default non-root user No Change
No AGPL v3 licenses No Change
No fixable critical or high vulnerabilities No Change
No high-profile vulnerabilities No Change
No outdated base images No Change
No unapproved base images No Change
Supply chain attestations No Change
Valid Docker Hardened Image (DHI) or DHI base image ⚠️ 2 ⚠️ 2 No Change
Packages and Vulnerabilities (1 package changes and 0 vulnerability changes)
  • ♾️ 1 packages changed
  • 63 packages unchanged
Changes for packages of type golang (1 changes)
Package Version
score-k8s:latest
Version
score-k8s:latest
♾️ github.com/score-spec/score-k8s 0.0.0-20260415141349-3c8f3a536dbf+dirty 0.0.0-20260416012532-a6ba66b29c4d+dirty

Copy link
Copy Markdown
Contributor

@mathieu-benoit mathieu-benoit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mathieu-benoit mathieu-benoit merged commit 68df589 into main Apr 16, 2026
20 checks passed
@mathieu-benoit mathieu-benoit deleted the copilot/adapt-feature-from-score-compose branch April 16, 2026 01:53
@mathieu-benoit
Copy link
Copy Markdown
Contributor

mathieu-benoit commented Apr 16, 2026

Now included in this release https://github.com/score-spec/score-k8s/releases/tag/0.11.0.

docker run --rm -it scorespec/score-k8s:0.11.0 version:

                   ...    .............
               .......   .............
           .........     ............
       .........        .....
      .......           ....   ..
       ..........      .....   ......
           ........   ......   ..........
              .....   .....       ..........
                      ....          ........
              ...........       .........
           ..............    .........
         ................   ......
         ...............    ..
          ............

score-k8s 0.11.0 (go1.26.2 - linux/amd64)
git commit: 68df589ac4b6a53629169fded6279e00c15f602c
build date: 2026-04-15T21:53:40-04:00

@mathieu-benoit
Copy link
Copy Markdown
Contributor

FYI: associated docs now updated score-spec/docs#277

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants