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

include commit in pre-release builds #988

Merged
merged 1 commit into from
Oct 21, 2019

Conversation

BenTheElder
Copy link
Member

xref: #986

@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Oct 21, 2019
@BenTheElder
Copy link
Member Author

later we'll also use this in kubernetes CI to record the kind commit used to test.

@BenTheElder
Copy link
Member Author

/cc @amwat

[bentheelder@bentheelder:~/go/src/sigs.k8s.io/kind·2019-10-21T15:37:22-0700·include-commit@dfbd929e]
$ make install
hack/go_container.sh go build -v -o /out/kind -ldflags "-X sigs.k8s.io/kind/cmd/kind/version.GitCommit=dfbd929e5ff1e665b07ff9bd46d966d281c51b4c"
install -d /usr/local/google/home/bentheelder/go/bin
install /usr/local/google/home/bentheelder/go/src/sigs.k8s.io/kind/bin/kind /usr/local/google/home/bentheelder/go/bin/kind

[bentheelder@bentheelder:~/go/src/sigs.k8s.io/kind·2019-10-21T15:45:20-0700·include-commit@dfbd929e]
$ kind version
v0.6.0-alpha+dfbd929e5ff1e665b07ff9bd46d966d281c51b4c

@k8s-ci-robot k8s-ci-robot requested a review from amwat October 21, 2019 22:45
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 21, 2019
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: amwat, BenTheElder

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot merged commit 458f818 into kubernetes-sigs:master Oct 21, 2019
v += "-" + VersionPreRelease
// if commit was set, add the + <build>
// we only do this for pre-release versions
if GitCommit != "" {
Copy link
Member Author

Choose a reason for hiding this comment

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

to consider in a follow-up: we might want to instead (or additionally) have the release scripts to export COMMIT="" to make it easier to reproducibly build the binaries from a source tarball. or instructions for doing COMMIT=<release-commit> make build

Copy link
Member Author

Choose a reason for hiding this comment

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

I think it is probably better to include the commit, and then if someone wants to reproduce the binaries without git they can set COMMIT= (the makefile should already support this)

@@ -28,6 +28,9 @@ INSTALL?=install
# make install will place binaries here
# the default path attempts to mimic go install
INSTALL_DIR?=$(shell hack/build/goinstalldir.sh)
# record the source commit in the binary
COMMIT?=$(shell git rev-parse HEAD 2>/dev/null)
Copy link
Contributor

@aojea aojea Oct 22, 2019

Choose a reason for hiding this comment

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

Why not the short commit id?

Copy link
Contributor

Choose a reason for hiding this comment

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

It's easier to read imho

Copy link
Member Author

Choose a reason for hiding this comment

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

The short version is just this truncated. We can truncate at runtime when formatting if we want, but this is the correct unambiguous commit ID.

Copy link
Member Author

Choose a reason for hiding this comment

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

@BenTheElder BenTheElder deleted the include-commit branch October 22, 2019 18:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants