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 is based on git state or BUILD_VERSION #1042

Merged
merged 5 commits into from
Nov 2, 2017

Conversation

chrisplo
Copy link
Contributor

@chrisplo chrisplo commented Oct 31, 2017

Git version to be calculated by 'git describe --tags --always' and add
'-unsupported' when the local workspace has an uncommitted change.

the rules are:

  • BUILD_VERSION will override any calculated version if set as env/make
    cli variable
  • if current commit is tagged, use just the tag
  • else <tag>-<num commits since>-g<commit id>

release target will use CURRENT_VERSION to make it simple to set in the
release branch

Signed-off-by: Chris Plock chrisplo@cisco.com

@chrisplo
Copy link
Contributor Author

some testing results:

make release:
----
Version: 1.0.0-beta
GitCommit: 0e9fdd7-unsupported
BuildTime: 10-31-2017.23-14-26.UTC

netplugin-1.0.0-beta.tar.bz2


make tar
----
Version: 1.1.0-rc.1-207-g0e9fdd7c-unsupported
GitCommit: 0e9fdd7-unsupported
BuildTime: 10-31-2017.23-22-49.UTC

netplugin-1.1.0-rc.1-207-g0e9fdd7c-unsupported.tar.bz2


BUILD_VERSION=1.2.3 make tar
---------------------------
Version: 1.2.3
GitCommit: 0e9fdd7-unsupported
BuildTime: 10-31-2017.23-50-36.UTC

./netplugin-1.2.3.tar.bz2


make compile (on VM)
--------
[vagrant@netplugin-node1 netplugin]$ bin/netplugin --version
Version: 1.1.0-rc.1-207-g0e9fdd7-unsupported
GitCommit: 0e9fdd7-unsupported
BuildTime: 10-31-2017.23-41-11.UTC

@chrisplo chrisplo changed the title WIP: version is based on git state or BUILD_VERSION version is based on git state or BUILD_VERSION Nov 1, 2017
@unclejack
Copy link
Contributor

build PR

@unclejack
Copy link
Contributor

@chrisplo: Can you remove the version file if it's not needed any more?

Git version to be calculated by 'git describe --tags --always' and add
'-unsupported' when the local workspace has an uncommitted change.

the rules are:
* BUILD_VERSION will override any calculated version if set as env/make
  cli variable
* if current commit is tagged, use just the tag
* else <tag>-<num commits since>-g<commit id>

release target will use CURRENT_VERSION to make it simple to set in the
release branch

Signed-off-by: Chris Plock <chrisplo@cisco.com>
@chrisplo
Copy link
Contributor Author

chrisplo commented Nov 2, 2017

@unclejack the change is such that the file is no longer generated needed (it was never checked in, it was generated), for some reason i thought contiv-install read this in but looks like it was only netplugin, will remove

I rebased on master to pick up the objdb fix instead of having it as a commit in this PR

@chrisplo
Copy link
Contributor Author

chrisplo commented Nov 2, 2017

build PR

@tiewei
Copy link
Contributor

tiewei commented Nov 2, 2017

you might need to shfmt because i can't tell if it's tab or space in the script

scripts/build.sh Outdated
GIT_COMMIT=$(./scripts/getGitCommit.sh)

echo $BUILD_VERSION >$VERSION_FILE
# TODO(chrisplo): remove when contiv/install no longer needs
echo $BUILD_VERSION > netplugin-version
Copy link
Contributor

Choose a reason for hiding this comment

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

What is this new filename for? I don't see it referenced anywhere else

Copy link
Contributor Author

Choose a reason for hiding this comment

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

VERSION was $NAME-version, name was netplugin

Copy link
Contributor Author

Choose a reason for hiding this comment

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

let me double check, but I thought contiv/install uses it still

@chrisplo
Copy link
Contributor Author

chrisplo commented Nov 2, 2017

rechecked tar,release,BUILD_VERSION

@chrisplo
Copy link
Contributor Author

chrisplo commented Nov 2, 2017

build PR

Makefile Outdated
release: tar
TAR_FILENAME=$(TAR_FILENAME) TAR_FILE=$(TAR_FILE) \
OLD_VERSION=${OLD_VERSION} BUILD_VERSION=${BUILD_VERSION} \
release-built-version: tar
Copy link
Contributor

Choose a reason for hiding this comment

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

Was this meant to be release-built-version or does it refer to the built version of netplugin?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is a helper for release target, the release target sets BUILD_VERSION so that version is externally set instead of through scripts/getGitVersion.sh

Though I see I have BUILD_VERSION duplicated in the release target, should be able to remove one, will update

Makefile Outdated
NIGHTLY_RELEASE=${NIGHTLY_RELEASE} scripts/release.sh
@make clean-tar
release: export BUILD_VERSION=$(shell cat version/CURRENT_VERSION)
Copy link
Contributor

@unclejack unclejack Nov 2, 2017

Choose a reason for hiding this comment

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

This seems wrong. There are two release targets.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@chrisplo
Copy link
Contributor Author

chrisplo commented Nov 2, 2017

latest run of release:

Version: 1.0.0-beta
GitCommit: 9dac643-unsupported
BuildTime: 11-02-2017.17-35-33.UTC

creates netplugin-1.0.0-beta.tar.bz2

@unclejack
Copy link
Contributor

build PR

Copy link
Contributor

@unclejack unclejack left a comment

Choose a reason for hiding this comment

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

LGTM - please squash on merge

@chrisplo chrisplo merged commit d125eb7 into contiv:master Nov 2, 2017
@chrisplo chrisplo deleted the determined_versions branch November 2, 2017 22:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants