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

[ISSUE]: gitversion/setup, Azure DevOps, pipeline task, not finding local/cached GitVersion.Tool when versionSpec uses wildcard (e.g. 5.x) #1110

Open
2 tasks done
SphenicPaul opened this issue Apr 8, 2024 · 0 comments

Comments

@SphenicPaul
Copy link

SphenicPaul commented Apr 8, 2024

Prerequisites

  • I have written a descriptive issue title
  • I have searched issues to ensure it has not already been reported

GitVersion package

GitVersion.Tool

GitVersion version

Any

Operating system

Windows

What are you seeing?

When using the gitversion/setup@0 (or gitversion/setup@1), GitVersion tasks within an Azure DevOps, YAML pipeline, specifically when using a wildcard, versionSpec value, like so...

- task: gitversion/setup@0
  name: gitVersionSetup
  displayName: GitVersion - Setup
  inputs:
    versionSpec: '5.x'

...it seems that the GitVersion Setup task/step is still trying to connect externally/online to download a version of the package/tool.

This has been noticed on an internal/self-hosted, Azure DevOps, build agent that does NOT have access to the internet (and therefore any public, NuGet/package repositories), and where build tools are typically installed into the Azure DevOps agent, tool cache directory, within the (default) <agent_install_directory>/_work/_tool directory, so they can be found/installed without accessing the internet.

In this case, we have copied/setup a version (5.6.11, in this case) of GitVersion.Tool within the tool cache, but using the versionSpec of 5.x fails to find the package/tool in the cache.

Related Links

Workaround

It seems that if the full/exact version is fixed/defined explicitly (e.g. versionSpec: '5.6.11') then the GitVersion task successfully finds the cached/installed tool, and does NOT attempt to download the cache. For example...

- task: gitversion/setup@0
  name: gitVersionSetup
  displayName: GitVersion - Setup
  inputs:
    versionSpec: '5.6.11'

What is expected?

If a local, cached version of the GitVersion.Tool exists, that would be expected to match the wildcard value provided in the versionSpec property (e.g. Version 5.6.11 is in the cache/directory, and versionSpec of 5.x is provided), then the GitVersion setup task should be finding the cached version of the package, and NOT trying to connect to the internet (and related, public package feeds) to attempt to download the tool.

Only when NO version in the Azure DevOps agent, tool cache matches the wildcard-versionSpec, should GitVersion attempt to download from the internet.

Steps to Reproduce

  1. Setup/Use a build server that does not have public/internet access

  2. Setup a copy/version (e.g. 5.6.11) of the GitVersion.Tools tool in the location of the Azure DevOps, Agent.ToolDirectory (tool cache)

  3. Setup an Azure DevOps, YAML pipeline using the gitversion/setup@0 or gitversion/setup@1 tasks, where the versionSpec property uses a wildcard (seems to need to use x not *, but neither work), like this:

- task: gitversion/setup@0
  name: gitVersionSetup
  displayName: GitVersion - Setup
  inputs:
    versionSpec: '5.x'
  1. Run the Azure DevOps pipeline, and GitVersion Setup task will fail because it's seemingly:
  • Not finding the local, cached, tool in the agent's tool cache
  • Trying to connect online to download a relevant package (which it can't connect to, because the agent doesn't have access)
  • Likely to get a timeout or ECONNRESET message/error.

RepositoryFixture Test

(Not provided)

Output log or link to your CI build (if appropriate).

##[debug]Evaluating condition for step: 'GitVersion - Setup'
##[debug]Evaluating: SucceededNode()
##[debug]Evaluating SucceededNode:
##[debug]=> True
##[debug]Result: True
Starting: GitVersion - Setup
==============================================================================
Task         : Setup GitVersion Task
Description  : Easy Semantic Versioning (https://semver.org) for projects using Git
Version      : 0.13.4
Author       : GitTools Contributors
Help         : See the [documentation](https://gitversion.net/docs/) for help
==============================================================================
##[debug]Using node path: C:\adoagents\someAgentName\externals\node20\bin\node.exe
##[debug]agent.TempDirectory=C:\adoagents\someAgentName\_work\_temp
##[debug]loading inputs and endpoints
##[debug]loading ENDPOINT_AUTH_PARAMETER_SYSTEMVSSCONNECTION_ACCESSTOKEN
##[debug]loading ENDPOINT_AUTH_SCHEME_SYSTEMVSSCONNECTION
##[debug]loading ENDPOINT_AUTH_SYSTEMVSSCONNECTION
##[debug]loading INPUT_IGNOREFAILEDSOURCES
##[debug]loading INPUT_INCLUDEPRERELEASE
##[debug]loading INPUT_PREFERLATESTVERSION
##[debug]loading INPUT_VERSIONSPEC
##[debug]loading SECRET_SYSTEM_ACCESSTOKEN
##[debug]loaded 9
##[debug]Agent.ProxyUrl=undefined
##[debug]Agent.CAInfo=C:\adoagents\someAgentName\certs\ado.ca.pem
##[debug]Agent.ClientCert=undefined
##[debug]expose agent certificate configuration.
##[debug]Agent.SkipCertValidation=undefined
##[debug]Agent.ProxyUrl=undefined
##[debug]Agent.CAInfo=C:\adoagents\someAgentName\certs\ado.ca.pem
##[debug]Agent.ClientCert=undefined
##[debug]check path : C:\adoagents\someAgentName\_work\_tasks\gitversion\setup_a06c02ae-7b9a-4082-90dc-fe27b500e54f\0.13.4\lib.json
##[debug]adding resource file: C:\adoagents\someAgentName\_work\_tasks\gitversion\setup_a06c02ae-7b9a-4082-90dc-fe27b500e54f\0.13.4\lib.json
##[debug]system.culture=en-US
##[debug]Agent.ProxyUrl=undefined
##[debug]Agent.CAInfo=C:\adoagents\someAgentName\certs\ado.ca.pem
##[debug]Agent.ClientCert=undefined
##[debug]Agent.SkipCertValidation=undefined
##[debug]set DOTNET_CLI_TELEMETRY_OPTOUT=true
##[debug]Processed: ##vso[task.setvariable variable=DOTNET_CLI_TELEMETRY_OPTOUT;isOutput=false;issecret=false;]true
##[debug]set DOTNET_NOLOGO=true
##[debug]Processed: ##vso[task.setvariable variable=DOTNET_NOLOGO;isOutput=false;issecret=false;]true
Agent: 'Azure Pipelines'
##[debug]versionSpec=5.x
##[debug]includePrerelease=false
##[debug]ignoreFailedSources=false
##[debug]preferLatestVersion=false
##[debug]cleaning: 5.x

--------------------------
Acquiring GitVersion.Tool version spec: 5.x
--------------------------
##[debug]isExplicit: null
##[debug]explicit? false
##[debug]querying tool versions for GitVersion.Tool@5.x 
##[debug]task result: Failed
##[error]read ECONNRESET
##[debug]Processed: ##vso[task.issue type=error;source=TaskInternal;]read ECONNRESET
##[debug]Processed: ##vso[task.complete result=Failed;done=true;]read ECONNRESET
Finishing: GitVersion - Setup
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

1 participant