Skip to content

Conversation

@dhaiducek
Copy link
Member

@dhaiducek dhaiducek commented Jul 14, 2023

Adds a generator version flag with the Git SHA in the output:

v1.12.2-ab49eaf2a21d44265784bbd1f8381ec6e8928828

Also adds verification that the VERSION.txt file was updated so that a release isn't created without the version being updated.

This is my first time adding version information to anything, so if anyone has other ideas/pointers, do share!

ref: https://issues.redhat.com/browse/ACM-5803

Closes #118

@dhaiducek dhaiducek force-pushed the generator-version branch 3 times, most recently from 0ae2ed9 to 0a01472 Compare July 17, 2023 19:38
@dhaiducek dhaiducek force-pushed the generator-version branch from 0a01472 to aa03f1c Compare July 17, 2023 19:47
@dhaiducek
Copy link
Member Author

dhaiducek commented Jul 17, 2023

I've used @JustinKuli's idea in the latest code to default with fallbacks in the following order:

  1. Native git describe output when available (v1.12.1-3-gaa03f1c)
  2. <branch>-<Git SHA> when tags aren't available like in Stolostron (release-2.9-8466f8c)
  3. <git SHA>-dev when a branch isn't available like a detached HEAD (8466f8c-dev)
  4. Default string Unversioned binary when built without setting Version variable

We could maybe add the org in there, but this ought to be enough information/fallbacks to find the version at play (or figure out that it wasn't built by us).

Copy link
Member

@JustinKuli JustinKuli left a comment

Choose a reason for hiding this comment

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

/hold for @mprahl

This seems nicely automatic for now, with the possibility to override the setting for specific use cases in the future if we ever need to.

############################################################
# build section
############################################################
GIT_VERSION := $(shell git describe --dirty 2>/dev/null)
Copy link
Member

Choose a reason for hiding this comment

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

Why do we want to use --dirty?

Copy link
Member Author

Choose a reason for hiding this comment

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

More of a safety/notification thing than anything. Without it, the -dirty suffix isn't added when there have been local changes:

When the working tree matches HEAD, the output is the same as "git describe HEAD". If the working tree has local modification "-dirty" is appended to it.

https://git-scm.com/docs/git-describe#Documentation/git-describe.txt---dirtyltmarkgt

@openshift-ci
Copy link

openshift-ci bot commented Jul 18, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dhaiducek, JustinKuli, mprahl, yiraeChristineKim

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:
  • OWNERS [JustinKuli,dhaiducek,mprahl,yiraeChristineKim]

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

@dhaiducek
Copy link
Member Author

/unhold

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.

RFE: Add version information

5 participants