Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(ci): Correctly pass Version to Docker builds and remove Release Phase var #328

Merged
merged 3 commits into from
Mar 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ ARG VERSION
WORKDIR /app
COPY ./ ./

RUN ./build.sh --go-os linux --go-arch amd64 --version "${VERSION:-}"
ENV LD_VERSION="-X github.com/spinnaker/spin/version.Version=${VERSION}"

RUN GOARCH=amd64 GOOS=linux CGO_ENABLED=0 go build \
-ldflags "${LD_VERSION}" .

FROM alpine

Expand Down
9 changes: 0 additions & 9 deletions Dockerfile.slim

This file was deleted.

83 changes: 0 additions & 83 deletions build.sh

This file was deleted.

14 changes: 1 addition & 13 deletions version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,13 @@

package version

import (
"fmt"
)

// Main version number being run right now.
var Version = ""

// A pre-release marker for the version. If this is an empty string,
// then the release is a final release. Otherwise this is a pre-release
// version e.g. "dev", "alpha", etc.
var ReleasePhase = "dev"
var Version = "dev"

// User Agent name set in requests.
const UserAgent = "Spin-CLI"

// String prints the version of the Spin CLI.
func String() string {
if ReleasePhase != "" {
return fmt.Sprintf("%s-%s", Version, ReleasePhase)
}
return Version
}