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

GitVersion 5.1 or later fails in Docker for Windows 1809 #2681

Closed
hotchkj opened this issue May 6, 2021 · 8 comments
Closed

GitVersion 5.1 or later fails in Docker for Windows 1809 #2681

hotchkj opened this issue May 6, 2021 · 8 comments

Comments

@hotchkj
Copy link

hotchkj commented May 6, 2021

Executing command line GitVersion fails when run inside a Docker container on Windows 1809. This appears to be related to PublishSingleFile and specific Docker Windows images, as a manifestation of dotnet/sdk#13784.

If I consume GitVersion.CommandLine.5.0.1 which pre-dates the introduction of PublishSingleFile, this does not occur.

In our specific case, our images are built from mcr.microsoft.com/dotnet/framework/runtime:4.8-20200714-windowsservercore-ltsc2019 which as the name implies is Microsoft's Long Term Support for Server 2019. Since Windows Server 2019 LTS is forever on 1809, we don't have the option of changing the Docker side of the equation for some significant time to come (or until such time as PublishSingleFile is fixed).

Expected Behavior

GitVersion should load & run

Actual Behavior

Executing: "C:/BUILD/tools/GitVersion.CommandLine.5.6.9/tools/gitversion.exe" -verbosity Debug
Failed to map file. CreateFileMappingW(C:\BUILD\tools\GitVersion.CommandLine.5.6.9\tools\gitversion.exe) failed with error 5
Failure processing application bundle.

Possible Fix

Currently the tools package folder is just the single EXE and sundries for all possible uses. One possible workaround is to supply subfolders in the package for more specific targeting, and have the NET Framework folder use the older type of packaging, since as I understand it, the single-file model is most applicable to usage in NET Core 3 or NET 5.

Steps to Reproduce

  • Run GitVersion.CommandLine on an 1809-based Docker Windows image

Context

Using GitVersion in Docker-based builds, and would prefer to be able to upgrade beyond 5.0.1.

Your Environment

  • Version Used: 5.6.9
  • Docker version: 19.03.14
  • Docker image: mcr.microsoft.com/dotnet/framework/runtime:4.8-20200714-windowsservercore-ltsc2019
  • Operating System and version: Windows Server 2019 17763.1879
@anderson-dev
Copy link

@hotchkj where can I find GitVersion.CommandLine.5.0.1? I need a workaround.

I'm using GitVersion.Tool in my build image that contains .net sdk but I really don't want the whole sdk on my purposefully minimal jenkins agent. Installing GitVersion.Portable via choco was working but for some reason, after I rebuilt, I get the same issues with that image and so my options are to either 1. install the full .net sdk on my jenkins agent for one program or 2. install a compatible version of GitVersion.Portable...

@hotchkj
Copy link
Author

hotchkj commented Jul 21, 2021

@anderson-dev I'm just using the NuGet package, hope that helps!

@stale
Copy link

stale bot commented Mar 2, 2022

This issue has been automatically marked as stale because it has not had recent activity. After 30 days from now, it will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Mar 2, 2022
@hotchkj
Copy link
Author

hotchkj commented Mar 2, 2022

This is still an issue that blocks upgrading beyond 5.0.1

@stale stale bot removed the stale label Mar 2, 2022
@arturcic
Copy link
Member

arturcic commented Apr 4, 2023

@hotchkj please use the win*zip from the latest release instead https://github.com/GitTools/GitVersion/releases/tag/5.12.0. It also embeds the needed code to run without an sdk, and GitVersion.CommandLine will be discontinued starting with version 6.0

@arturcic arturcic closed this as completed Apr 4, 2023
@hotchkj
Copy link
Author

hotchkj commented Apr 4, 2023

Thanks @arturcic. Where can I learn more about the discontinuation and resulting options? Tooling like Cake tends to acquire tools via NuGet so I'm curious as to what will be available in future. I don't see anything in Breaking Changes. Apologies if I'm jumping the gun since 6.0 is not released yet.

@arturcic
Copy link
Member

arturcic commented Apr 4, 2023

This is not a breaking change as it's not affecting the functionality of the version calculation at all. It's just discontinuing a distribution channel in favor of other more popular channels.

See #3375.

Cake does support running GitVersion.Tool, or GitVersion.Portable

@arturcic
Copy link
Member

arturcic commented Apr 4, 2023

Or if you decide to use the zip file that actually contains only the exe file, you can specify the ToolPath in cake, or just add the exe to the Path variable

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

No branches or pull requests

3 participants