Gitversion: Latest Docker Images for gitversion-fullfx do not exist on docker hub

Created on 9 Apr 2020  路  27Comments  路  Source: GitTools/GitVersion

I am a consumer of GitVersion.CommandLine intended for use with full .Net Framework, and not .Net Core.

I am unable to find the latest docker image for the latest release (5.2.4) at
https://hub.docker.com/r/gittools/gitversion-fullfx (This is last updated 1 year ago).

However, the docker images at (https://hub.docker.com/r/gittools/gitversion for .Net core) are being updated but not the gitversion-fullfx.

bug

All 27 comments

https://hub.docker.com/r/gittools/gitversion-fullfx and https://hub.docker.com/r/gittools/gitversion-dotnetcore are obsolete, we publish only to
https://hub.docker.com/r/gittools/gitversion

The issue with a fullfx docker image is that is huge in size (> 4gb), and usually it was taking 30-40 minutes just to build and push the image. We could not afford that much time for every build, so we decided to remove support of a fullFx docker image. As you've mentioned you use GitVersion.CommandLine and you don't need to use windows docker image at all. Just use the tool as is.

We are using this in our CICD framework and our build system fails upon the use of this new image because mono and dotnet SDK do not come pre-installed with gittools/gitversion.

For example this is my sample usage

gvOutput = execute(script: "mono /app/GitVersion.exe ${env.WORKSPACE} ${toolArgs} || dotnet /app/GitVersion.dll ${env.WORKSPACE} ${toolArgs}", returnStdout: true, this)

Which fails on Jenkins with the following logs

[2020-04-09T07:33:09.504Z] + mono /app/GitVersion.exe /home/jenkins/agent/workspace
[2020-04-09T07:33:09.504Z] /home/jenkins/agent/workspace@tmp/durable-6004378a/script.sh: 1: /home/jenkins/agent/workspace@tmp/durable-6004378a/script.sh: mono: not found
[2020-04-09T07:33:09.504Z] + dotnet /app/GitVersion.dll /home/jenkins/agent/workspace
[2020-04-09T07:33:09.960Z] Did you mean to run dotnet SDK commands? Please install dotnet SDK from:
[2020-04-09T07:33:09.961Z]   https://go.microsoft.com/fwlink/?LinkID=798306&clcid=0x40

Would you be kind enough to suggest a workaround?

As far as I understand you're using Linux Jenkins agent.
Use a docker image for netcore (run the docker as a tool) or you can use the dotnet global tool https://www.nuget.org/packages/GitVersion.Tool. Mono is not working as far as I know because there are some issues.

Thank you. Appreciate it!

I'm using a Linux agent but running the command dotnet /app/GitVersion.dll inside the container of the image gittools/gitversion.

Do you suggest I run dotnet-gitversion instead?

yes, I've got a question. How are you using the docker image in this case? as a builder or as a tool

I'm using it as a tool.

For example, this is its sample usage in my Jenkinsfile

container("GitVersion") {
   if(env.CHANGE_ID){
      gvOutput = execute(script: "JENKINS_URL='';export JENKINS_URL;mono /app/GitVersion.exe 
      ${env.WORKSPACE} ${toolArgs} || dotnet /app/GitVersion.dll ${env.WORKSPACE} ${toolArgs}", r. 
     returnStdout: true, this)
     }else{
        gvOutput = execute(script: "mono /app/GitVersion.exe ${env.WORKSPACE} ${toolArgs} || dotnet /app/GitVersion.dll ${env.WORKSPACE} ${toolArgs}", returnStdout: true, this)
     }
}

it's more like a builder that a tool, you're running some jenkins scripts inside of the container. A tool on the other side is just calling the docker image with some input and then you use the ouput

My bad, you are correct. I'm running the tool inside of the container and using its response json to create my own custom version object.

But you could just run the container mounting the git repo into the container and then consuming the output of the docker (it will be a json)

somthing similar to

docker run --rm -v "$(pwd):/repo" gittools/gitversion:latest-linux-netcoreapp2.1 /repo

just use the appropriate tag

In fact, I'm also running this under a different circumstance as my Jenkins agents are dynamic. But thanks again for the detailed explanation.

@arturcic Could you kindly tell me what is the suggested way of running the tool if I do not have docker installed in my Jenkins agent? Assuming I can only run it inside the container.

I wonder how you run the container without the docker installed

The container is running on Kubernetes pod.

All code that I run under let's say

container("GitVersion") {
   if(env.CHANGE_ID){
      gvOutput = execute(script: "JENKINS_URL='';export JENKINS_URL;mono /app/GitVersion.exe 
      ${env.WORKSPACE} ${toolArgs} || dotnet /app/GitVersion.dll ${env.WORKSPACE} ${toolArgs}", r. 
     returnStdout: true, this)
     }else{
        gvOutput = execute(script: "mono /app/GitVersion.exe ${env.WORKSPACE} ${toolArgs} || dotnet /app/GitVersion.dll ${env.WORKSPACE} ${toolArgs}", returnStdout: true, this)
     }
}

The above code creates a docker container out of Gitversion in Kubernetes and executes the code inside it.

Just run the dotnet-gitversion

That's the problem dotnet-gitversion does not work inside the gitversion:5.2.4-netcoreapp2.1 container.

It says

dotnet-gitversion: not found

Run it with /tools/dotnet-gitversion

That works! thank you :) Should I document it in this repository?

Not sure, as your specific case is not something that usually is used

Alright. Thanks again! Have a great day ahead!

@arturcic

How do I use the gittools/gitversion:5.1.3-windows docker image?

What is the location of Gitversion.exe in this container, or is it already added to PATH?

we don't publish windows images any more. They are too time and resource consuming to build.

Can you share the Dockerfile so that I can host it internally? Adding to the repository also will be helpful.

you can build it yourself, just use the dotnet core sdk nanoserver image and install GitVersion.Tool inside it

Got it, thanks

Was this page helpful?
0 / 5 - 0 ratings