Virtual-environments: GitVersion not working in Ubuntu 20.04

Created on 18 Dec 2020  路  4Comments  路  Source: actions/virtual-environments

Description
When the ubuntu-latest VM image switched to 20.04 we started getting the following error from GitVersion:
System.TypeInitializationException: The type initializer for 'LibGit2Sharp.Core.NativeMethods' threw an exception. ---> System.DllNotFoundException: Unable to load shared library 'git2-572e4d8' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: libgit2-572e4d8: cannot open shared object file: No such file or directory

There was another error logged in the preceding step to install the .NET Core SDK:
get-os-distro: Error: Distribution specific OS name and version could not be detected: UName = Linux

This error didn't fail the install of .NET Core, but it seemed to make it so it didn't recognize what version of Linux it was running on. In the step's log it listed this as the version:
Primary:linux-x64 Legacy:-x64
Where in the previous build it listed this:
Primary:linux-x64 Legacy:ubuntu.18.04-x64

We are unsure if the two are connected, but changing the VM over to windows-latest fixed both issues.

Area for Triage:
Unknown

Question, Bug, or Feature?:
"Bug"

Virtual environments affected

  • [ ] Ubuntu 16.04
  • [ ] Ubuntu 18.04
  • [x] Ubuntu 20.04
  • [ ] macOS 10.15
  • [ ] macOS 11.0
  • [ ] Windows Server 2016 R2
  • [ ] Windows Server 2019

Expected behavior
GitVersion runs successfully

Actual behavior
Bug displayed above

Repro steps
Failed build - Only preserved for a week.

  1. Have an azure devops environment with the GitVersion extension
  2. Run this pipeline template (.yml file)
jobs:
- job: Semver
  pool:
    vmImage: 'ubuntu-latest'
  steps:
  - task: UseDotNet@2
    displayName: 'Use .NET Core sdk (for GitVersion)'
    inputs:
      packageType: sdk
      version: 2.1.x

  - task: GitVersion@5
    displayName: 'GitVersion'
    inputs:
      configFilePath: '$(Build.SourcesDirectory)/GitVersion.yml'
Git Ubuntu awaiting-deployment investigate

Most helpful comment

Hello everyone, I think this issue related to GitVersion. It was fixed in new release (5.6.0) for ubuntu 20.04. You can try to use this snippet:

  - task: UseDotNet@2
    displayName: 'Use .NET Core sdk (for GitVersion)'
    inputs:
      packageType: sdk
      version: 5.x
  - task: gitversion/setup@0
    inputs:
      versionSpec: '5.6.0'
  - task: gitversion/execute@0
    inputs:
      useConfigFile: true
      configFilePath: '$(Build.SourcesDirectory)/GitVersion.yml'

Another way change ubuntu image to 18.04, because previously builds were run on ubuntu 18.04 and it worked.

All 4 comments

the same here!

Hello everyone, I think this issue related to GitVersion. It was fixed in new release (5.6.0) for ubuntu 20.04. You can try to use this snippet:

  - task: UseDotNet@2
    displayName: 'Use .NET Core sdk (for GitVersion)'
    inputs:
      packageType: sdk
      version: 5.x
  - task: gitversion/setup@0
    inputs:
      versionSpec: '5.6.0'
  - task: gitversion/execute@0
    inputs:
      useConfigFile: true
      configFilePath: '$(Build.SourcesDirectory)/GitVersion.yml'

Another way change ubuntu image to 18.04, because previously builds were run on ubuntu 18.04 and it worked.

Hello everyone. We're going to deploy new image with GitVersion (5.6.0) on January.

Hello everyone, I think this issue related to GitVersion. It was fixed in new release (5.6.0) for ubuntu 20.04. You can try to use this snippet:

  - task: UseDotNet@2
    displayName: 'Use .NET Core sdk (for GitVersion)'
    inputs:
      packageType: sdk
      version: 5.x
  - task: gitversion/setup@0
    inputs:
      versionSpec: '5.6.0'
  - task: gitversion/execute@0
    inputs:
      useConfigFile: true
      configFilePath: '$(Build.SourcesDirectory)/GitVersion.yml'

Another way change ubuntu image to 18.04, because previously builds were run on ubuntu 18.04 and it worked.

Hello Dmitry, Thanks a lot, I put the tasks as you suggested and It worked to me in Ubuntu 20.04

I only didnt put the task "task: UseDotNet@2" because I use de SonarQube and It isnt compatible with this DotNet version.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mxschmitt picture mxschmitt  路  3Comments

adamsiembida picture adamsiembida  路  3Comments

ydnar picture ydnar  路  3Comments

frankieroberto picture frankieroberto  路  4Comments

mcooley picture mcooley  路  3Comments