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

[version] Display version when booting operator #350

Merged

Conversation

surajssd
Copy link
Contributor

@surajssd surajssd commented Sep 5, 2018

Operator shows it's version when it starts. This version information
is embedded inside the binary while building it. It is a good
practice to show the operator version when it is booting up.

Fixes #348

@surajssd surajssd changed the title [version] Display version when booting operator [WIP][version] Display version when booting operator Sep 6, 2018
@surajssd surajssd force-pushed the surajssd/add-version-on-bootup branch from 07a77db to 3ce35fc Compare September 6, 2018 06:41
@surajssd surajssd force-pushed the surajssd/add-version-on-bootup branch from 3ce35fc to 5bc5018 Compare September 6, 2018 10:23
@surajssd surajssd changed the title [WIP][version] Display version when booting operator [version] Display version when booting operator Sep 6, 2018
Makefile Outdated Show resolved Hide resolved
examples/habitat-operator.yml Outdated Show resolved Hide resolved
examples/rbac/habitat-operator.yml Outdated Show resolved Hide resolved
helm/habitat-operator/values.yaml Outdated Show resolved Hide resolved
test/e2e/v1beta1/resources/operator/deployment.yml Outdated Show resolved Hide resolved
@surajssd
Copy link
Contributor Author

surajssd commented Sep 7, 2018

@krnowak I did not understand the part where you are saying

And our release steps will need to be extended with a check for a proper version of the operator.

@surajssd surajssd force-pushed the surajssd/add-version-on-bootup branch from 5bc5018 to 3d2afc5 Compare September 7, 2018 12:09
@krnowak
Copy link
Contributor

krnowak commented Sep 7, 2018

I did not understand the part where you are saying

@surajssd: Basically, when doing a release of the operator, we want to make sure that the version it prints is something like v0.7.2, not v0.7.2-31-g9eae1e5d nor v0.7.2-31-g9eae1e5d-dirty nor v0.7.2-dirty.

@surajssd surajssd force-pushed the surajssd/add-version-on-bootup branch from 3d2afc5 to dc8ff10 Compare September 7, 2018 14:13
@surajssd
Copy link
Contributor Author

surajssd commented Sep 7, 2018

@krnowak

And our release steps will need to be extended with a check for a proper version of the operator.

this is done :-)

@@ -28,7 +28,7 @@ main() {
echo "Script is running in dry run mode. Following commands will be executed if you pass the -r or --run flag:"
fi

run make image
run make VERSION=$(git describe --abbrev=0 --tags) image
Copy link
Contributor

Choose a reason for hiding this comment

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

What I actually meant is to see if the operator, after being built without overriding the VERSION Make variable, prints a version like 0.7.2 without commit checksum or "dirty" string. The reason is to guard against building the operator from the dirty tree or from untagged commit by accident.

But this kind of check might be hard/annoying to execute… So I just got an idea that you could add a rule to Makefile like:

print-version:
	@echo $(VERSION)

and then, in this script, right after the readonly VERSION="v$(cat VERSION)" line, you could compare the output of make print-version with the VERSION variable. If they are different, bail out.

What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@krnowak is this check needed? Because this will be only called from hack/publish-release.sh which makes sure that the directory is setup properly and then binary build happens?

@surajssd surajssd force-pushed the surajssd/add-version-on-bootup branch from dc8ff10 to 9f347c7 Compare September 10, 2018 08:46
Copy link
Contributor

@krnowak krnowak left a comment

Choose a reason for hiding this comment

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

One nit, otherwise LFAD.

hack/publish-release.sh Outdated Show resolved Hide resolved
Operator shows it's version when it starts. This version information
is embedded inside the binary while building it. It is a good
practice to show the operator version when it is booting up, helps
while resolving/reporting issues even if the latest/untagged docker
image is run by the user.

Signed-off-by: Suraj Deshmukh <suraj@kinvolk.io>
@surajssd surajssd force-pushed the surajssd/add-version-on-bootup branch from 545fc9e to a173b59 Compare September 10, 2018 11:30
@krnowak
Copy link
Contributor

krnowak commented Sep 10, 2018

LFAD if tests pass.

@surajssd surajssd merged commit a87db96 into habitat-sh:master Sep 10, 2018
@surajssd surajssd deleted the surajssd/add-version-on-bootup branch September 10, 2018 11:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants