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

Conversation

kskewes-sf
Copy link
Contributor

Preparation for adding new GHA CI for Google Artifact Registry container images as added for other Spinnaker services.

  • Consolidate on single Dockerfile
  • Pass Version and Release Phase through to go build so that spin --version execution in the final spin binary is correct
  • Run go build directly rather than calling build.sh script with the same arguments, then remove script as it is no longer referenced in the repo.

Note: the Jenkins instance which was publishing Spinnaker binaries via release.sh is no more so we can do a fresh start of https://spinnaker.io/docs/releases/release-manager-runbook/#one-week-after-branches-are-cut-monday

@kskewes-sf
Copy link
Contributor Author

kskewes-sf commented Mar 11, 2022

I would love to rip out RELEASE_PHASE entirely. I believe its purpose is covered by VERSION.
We can default VERSION to dev and move the var into main.go (EDIT: or cmd/..) so that the ldflag becomes simpler.

If this is amenable please advise and I can either add to this PR or do separately (for 1.28.x).

@kskewes-sf kskewes-sf changed the title fix(ci): Correctly pass Version & Release Phase to Docker builds refactor(ci): Correctly pass Version to Docker builds and remove Release Phase var Mar 13, 2022
Also correctly pass Version & Release Phase values via ldflags to `go
build` so `spin --version` outputs correct values.
Only `./Dockerfile` was calling `build.sh` and it doesn't in previous
commit.

Future CI jobs can run `go build` directly supplying OS & ARCH matrix and
LDFLAGS.

For local development we can simply run `go build`.
`Version` is SemVer so we can add release candidate and other
designations as required.

Continue to use `dev` as default version, overridable by building with
ldflag set.
@kskewes-sf
Copy link
Contributor Author

# build with default version
$ go build .
$ ./spin --version
version dev

# override version per Dockerfile
$ go build -ldflags "-X github.com/spinnaker/spin/version.Version=testing" .
$ ./spin --version
version testing

@dbyron-sf dbyron-sf added the ready to merge Approved and Reviewed and ready for merge label Mar 18, 2022
@mergify mergify bot added the auto merged label Mar 18, 2022
@mergify mergify bot merged commit 9e12725 into spinnaker:master Mar 18, 2022
@kskewes-sf kskewes-sf deleted the df-tidy branch April 28, 2022 00:01
@kskewes-sf kskewes-sf restored the df-tidy branch July 14, 2022 03:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto merged ready to merge Approved and Reviewed and ready for merge target-release/1.28
Projects
None yet
3 participants