actions icon indicating copy to clipboard operation
actions copied to clipboard

[Improvement] Allow for "Always check for new version" for AzDo task

Open walliski opened this issue 3 years ago • 4 comments

In scenarios where running self-hosted agents in Azure DevOps, and the agents are reused between jobs, later jobs will get the wrong version installed.

  • Build agent installs GitVersion with specific version 5.1, in job A.
  • After Job A is finished, Job B starts on the same build agent.
  • Job B requests GitVersion 5.x, which "5.1" will satisfy, meaning that the job does not get the latest version.

To get around these issues, add an option to the GitVersion install task to always recheck for the latest version.

Detailed Description

How to reproduce:

  • Build agent installs GitVersion with specific version 5.1, in job A.
  • After Job A is finished, Job B starts on the same build agent.
  • Job B requests GitVersion 5.x, which "5.1" will satisfy, meaning that the job does not get the latest version, as Job B would have wanted.

To get around these issues, add an option to the GitVersion install task to always recheck for the latest version.

Context

It reduces issues that happen when an older pipeline has pinned a specific version of GitVersion, but another pipeline wants to have the latest version at all times. In the scenario of re-using agents between jobs.

walliski avatar Jun 09 '22 10:06 walliski

This sounds more like an AzDO configuration issue than a GitVersion issue. Having a clean working directory is a prerequisite for GitVersion to be able to accurately generate a version. It is possible to ignore the cache with the /nocache argument, though. Have you tried that?

asbjornu avatar Aug 27 '22 22:08 asbjornu

Not related to the working directory to where it runs or GitVersion functionality, but to the tool installation folder/cache in AzDo agents and the way that the AzDo Task installs GitVersion.

EDIT: Aah, and now I see your comment was for moving repo. Yeah, it seems its better to have it here.

walliski avatar Aug 29 '22 08:08 walliski

I see, @walliski. Do you know whether we can control the caching/reuse of different installed versions of GitVersion within AzDO, @arturcic?

asbjornu avatar Sep 01 '22 11:09 asbjornu

This is the generic code that does the GitVersion.Tool installation - https://github.com/GitTools/actions/blob/416cbc1c2375b1f356f475f52f3eaf0953898b50/src/core/dotnet-tool.ts#L204. This is a generic code that has 2 implementations - one for AzDO and the other for Github Actions

If we add this ability we need to make sure it works for both implementations

arturcic avatar Sep 01 '22 11:09 arturcic