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

Fix checkout behavior and FileVersion #3337

Merged
merged 1 commit into from
Oct 12, 2021

Conversation

crazy-max
Copy link
Member

Looks like

VERSION=${VERSION:-$(git describe --match 'v[0-9]*' --dirty='.m' --always --tags | sed 's/^v//' 2>/dev/null || echo "unknown-version" )}
returns 0530566 which is the commit and not the actual tag.

image

Seems related to GitHub Actions checkout behavior. We need to fetch all tags otherwise it fails:

image

cc @thaJeztah

Signed-off-by: CrazyMax crazy-max@users.noreply.github.com

@crazy-max

This comment has been minimized.

@codecov-commenter
Copy link

codecov-commenter commented Oct 11, 2021

Codecov Report

Merging #3337 (41446ab) into master (6d2820b) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master    #3337   +/-   ##
=======================================
  Coverage   57.99%   57.99%           
=======================================
  Files         302      302           
  Lines       21764    21764           
=======================================
  Hits        12621    12621           
  Misses       8219     8219           
  Partials      924      924           

@thaJeztah
Copy link
Member

thaJeztah commented Oct 11, 2021

Actually wondering now; shouldn't it show the commit? Because the commit it was built from is not an exact match for a tag (see the ProductVersion)

@crazy-max
Copy link
Member Author

crazy-max commented Oct 11, 2021

You mean for FileVersion?

Edit: Yes should be like ProductVersion.

@crazy-max crazy-max force-pushed the fix-checkout branch 2 times, most recently from d8271a1 to 41446ab Compare October 11, 2021 18:03
@crazy-max crazy-max changed the title Fix GHA checkout behavior Fix checkout behavior and ProductVersion Oct 11, 2021
@crazy-max
Copy link
Member Author

@thaJeztah Fixed

image

@crazy-max crazy-max changed the title Fix checkout behavior and ProductVersion Fix checkout behavior and FileVersion Oct 11, 2021
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
"FileVersion": "${VERSION_QUAD}",
"FileVersion": "${VERSION}",
Copy link
Member

Choose a reason for hiding this comment

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

Given that this previously used VERSION_QUAD, is this field expected to be SemVer(ish)? If so, this will break if our CalVer version has a leading 0 (19.03.9, e.g.)

Copy link
Member

Choose a reason for hiding this comment

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

from https://docs.microsoft.com/en-us/windows/win32/menurc/versioninfo-resource

FILEVERSION

Binary version number for the file. The version consists of two 32-bit integers, defined by four 16-bit integers. For example, "FILEVERSION 3,10,0,61" is translated into two doublewords: 0x0003000a and 0x0000003d, in that order. Therefore, if version is defined by the DWORD values dw1 and dw2, they need to appear in the FILEVERSION statement as follows: HIWORD(dw1), LOWORD(dw1), HIWORD(dw2), LOWORD(dw2).

PRODUCTVERSION

Binary version number for the product with which the file is distributed. The version parameter is two 32-bit integers, defined by four 16-bit integers. For more information about version, see the FILEVERSION description.

Copy link
Member

Choose a reason for hiding this comment

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

Further down, the description is different (sigh)

FileVersion
Version number of the file for example, "3.10" or "5.00.RC2". This string is required.

ProductVersion
Version of the product with which the file is distributed?for example, "3.10" or "5.00.RC2". This string is required

Copy link
Member Author

@crazy-max crazy-max Oct 12, 2021

Choose a reason for hiding this comment

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

Further down, the description is different (sigh)

Yeah can be misleading, VERSIONINFO.FILEVERSION != StringFileInfo.FileVersion. In our case:

VERSIONINFO.FILEVERSION = goversioninfo FixedFileInfo.FileVersion

"FixedFileInfo":
  {
    "FileVersion": {
      "Major": $(echo "$VERSION_QUAD" | cut -d. -f1),
      "Minor": $(echo "$VERSION_QUAD" | cut -d. -f2),
      "Patch": $(echo "$VERSION_QUAD" | cut -d. -f3),
      "Build": $(echo "$VERSION_QUAD" | cut -d. -f4)
    },
  }

StringFileInfo.FileVersion = goversioninfo StringFileInfo.FileVersion

"StringFileInfo":
  {
    "FileVersion": "${VERSION}",
  }

Copy link
Member

Choose a reason for hiding this comment

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

Argh.. yes, that's confusing, thanks!

Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

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

LGTM

@thaJeztah thaJeztah merged commit 9fab13b into docker:master Oct 12, 2021
@crazy-max crazy-max deleted the fix-checkout branch October 12, 2021 14:05
@thaJeztah thaJeztah added this to the 22.06.0 milestone May 13, 2022
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.

None yet

3 participants