Skip to content

Commit

Permalink
Merge pull request #13705 from jwmatthews/issue13690
Browse files Browse the repository at this point in the history
Add 'Os' to be queried via 'version' output
  • Loading branch information
openshift-merge-robot authored Mar 30, 2022
2 parents d0d805b + 1ffcc4a commit ff8834f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions libpod/define/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ type Version struct {
BuiltTime string
Built int64
OsArch string
Os string
}

// GetVersion returns a VersionOutput struct for API and podman
Expand All @@ -49,5 +50,6 @@ func GetVersion() (Version, error) {
BuiltTime: time.Unix(buildTime, 0).Format(time.ANSIC),
Built: buildTime,
OsArch: runtime.GOOS + "/" + runtime.GOARCH,
Os: runtime.GOOS,
}, nil
}
1 change: 1 addition & 0 deletions pkg/bindings/system/system.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ func Version(ctx context.Context, options *VersionOptions) (*entities.SystemVers
BuiltTime: time.Unix(b.Unix(), 0).Format(time.ANSIC),
Built: b.Unix(),
OsArch: fmt.Sprintf("%s/%s", component.Os, component.Arch),
Os: component.Os,
}

for _, c := range component.Components {
Expand Down
8 changes: 8 additions & 0 deletions test/e2e/version_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,18 @@ var _ = Describe("Podman version", func() {
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))

session = podmanTest.Podman([]string{"version", "--format", "{{ .Client.Os }}"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))

session = podmanTest.Podman([]string{"version", "--format", "{{ .Server.Version }}"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))

session = podmanTest.Podman([]string{"version", "--format", "{{ .Server.Os }}"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))

session = podmanTest.Podman([]string{"version", "--format", "{{ .Version }}"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expand Down

0 comments on commit ff8834f

Please sign in to comment.