Skip to content

Commit

Permalink
Merge branch 'main' of github.com:open-component-model/ocm into maven…
Browse files Browse the repository at this point in the history
…/access2
  • Loading branch information
hilmarf committed Apr 22, 2024
2 parents 7217f26 + 2fbf6fd commit 25ac35b
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ FROM golang:${GO_VERSION}-alpine${ALPINE_VERSION} AS build
WORKDIR /src
RUN go env -w GOMODCACHE=/root/.cache/go-build

COPY go.mod go.sum ./
COPY go.mod go.sum *.go VERSION ./

ARG GO_PROXY="https://proxy.golang.org"
ENV GOPROXY=${GO_PROXY}
Expand Down
2 changes: 1 addition & 1 deletion cmds/ocm/pkg/output/tableoutput.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ func (this *TableProcessingOutput) Out() error {
// a regular string comparison.
func compareColumn(c int, vers ...bool) CompareFunction {
if utils.Optional(vers...) {
return _compareColumn(c, semverutils.Compare)
return _compareColumn(c, semverutils.VersionCache{}.Compare)
} else {
return _compareColumn(c, strings.Compare)
}
Expand Down
2 changes: 1 addition & 1 deletion components/helminstaller/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ ARG COMMIT EFFECTIVE_VERSION GIT_TREE_STATE
ARG TARGETOS TARGETARCH

WORKDIR /go/src/github.com/open-component-model/ocm/
COPY go.* ./
COPY go.* *.go VERSION ./
COPY pkg pkg
COPY cmds cmds
COPY hack/generate-docs hack/generate-docs
Expand Down
9 changes: 9 additions & 0 deletions pkg/version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import (
"strings"

"github.com/Masterminds/semver/v3"

"github.com/open-component-model/ocm"
)

var (
Expand All @@ -16,6 +18,13 @@ var (
buildDate = "1970-01-01T00:00:00Z"
)

func init() {
if gitVersion == "0.0.0-dev" {
// gitVersion = strings.TrimSpace(string(MustAsset("../../VERSION")))
gitVersion = strings.TrimSpace(ocm.Version)
}
}

type Info struct {
Major string `json:"major"`
Minor string `json:"minor"`
Expand Down
10 changes: 10 additions & 0 deletions version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// SPDX-FileCopyrightText: 2024 SAP SE or an SAP affiliate company and Open Component Model contributors.
//
// SPDX-License-Identifier: Apache-2.0

package ocm

import _ "embed"

//go:embed VERSION
var Version string

0 comments on commit 25ac35b

Please sign in to comment.