Skip to content

[Bug]Segmentation Fault on docker alpine 3.13 #2656

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

Closed
PedroCigaw opened this issue Apr 12, 2021 · 5 comments
Closed

[Bug]Segmentation Fault on docker alpine 3.13 #2656

PedroCigaw opened this issue Apr 12, 2021 · 5 comments

Comments

@PedroCigaw
Copy link

Describe the bug
I rely on GitVersion.MSBuild on all my .net core projects. When creating docker images of these project all the versioning was working fine up until I needed to create more compact docker images. When converting my docker files to build an image based on alpine the projected failed to compile with a Segmentation Fault. Initially I thought it was an issue with the build task, but when I was creating a reproducible sample I found that the problem wasn't related to the build task, but gitversion tools also has the problem.

Expected Behavior

running dotnet-gitversion should return version information

Actual Behavior

returns Segmentation Fault

Steps to Reproduce

From within a git repository. Create a Dockerfile
`
ARG VERSION=5.0-alpine

#FROM mcr.microsoft.com/dotnet/aspnet:$VERSION AS base
FROM mcr.microsoft.com/dotnet/runtime-deps:$VERSION AS base
WORKDIR /app

FROM mcr.microsoft.com/dotnet/sdk:$VERSION AS sdkwithgitversion
RUN dotnet tool install -g GitVersion.Tool
ENV PATH="$PATH:/root/.dotnet/tools"

FROM sdkwithgitversion AS build
WORKDIR /src
COPY . .
`
run the docker file and bash into it. Then run dotnet-gitversion to see the error.

Alternatively I have created a reproducable repo here
https://github.com/PedroCigaw/gitversionalpinebug

  1. clone repo above
  2. run: docker build -t alpinebug -f .\Dockerfile.alpine.base .
  3. run: docker run -it alpinebug /bin/ash
  4. type: dotnet-gitversion

Context

Our docker images have to be built on alpine from a security and size perspective, this has meant I been forced exclude the GitVersion.MSBuild references when building the docker images, which in turn means no versioning. I'm hoping there is a simple solution in the offing before going to the time and expense of rethinking how I can manage versions consistently between docker builds, CI Builds and nuget packages

@PedroCigaw PedroCigaw added the bug label Apr 12, 2021
@PedroCigaw PedroCigaw changed the title [Bug]Segmentation Fault on docker alpine 3.1.3 [Bug]Segmentation Fault on docker alpine 3.13 Apr 13, 2021
@PedroCigaw
Copy link
Author

Upon further investigation I found this works if I specifically target the version to "5.0-alpine3.12" of the dotnet docker images.

@asbjornu
Copy link
Member

I assume it's LibGit2Sharp that is crashing. There's not much we can do in GitVersion but upgrade once libgit2/libgit2sharp#1872 and possibly dotnet/runtime#50739 are resolved.

@seanamos
Copy link

If you pull down the .nupkg file, unzip it and dotnet run gitversion.dll in the netcoreapp3.1 folder it works.
The net5.0 variant segfaults.

I haven't had time to debug this any further though.

@asbjornu
Copy link
Member

With libgit2/libgit2sharp#1872 and dotnet/runtime#50739 both resolved, I hope #2916 may fix this bug.

@github-actions
Copy link

github-actions bot commented Apr 7, 2023

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.

@github-actions github-actions bot added the stale label Apr 7, 2023
@arturcic arturcic closed this as completed Apr 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants