question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

AddBuildTag fails for git repos (Not Found)

See original GitHub issue

Required Information

Question, Bug, or Feature?
Type: Bug

Enter Task Name: AddBuildTag

Environment

  • Server - Azure Pipelines
  • Agent - Hosted vs2017-win2016

Issue Description

I’m trying to add a build tag that provides additional build metadata - essentially a semver-like identifier for each build (which runs across multiple differing pipelines). I’m using git repos.

I’m adding the tag via an inline powershell task, that imports and calls a cmdlet in a custom powershell module. The pipeline task looks like this:

      - task: PowerShell@2
        condition: succeeded()
        displayName: Detect and validate version
        inputs:
          targetType: inline
          script: |
            Set-PSDebug -Strict;
            $ErrorActionPreference = 'Stop';
            Import-Module 'Utils\Scripts\VersionHelpers' -Force;
            $prSourcebranch = "$env:SYSTEM_PULLREQUEST_SOURCEBRANCH";
            $buildSourceBranch = "$env:BUILD_SOURCEBRANCH";

            Set-Version -buildSourceBranch "$($buildSourceBranch)" -pipelineBuildNumber $(pipelineBuildNumber) -version "$(overrideVersion)" -prSourceBranch "$($prSourcebranch)" -Verbose;
          failOnStderr: true

The script calls out to a number of (well tested) powershell cmdlets that does some fancy processing on various git refs, but eventually does this:

    echo "##vso[task.setvariable variable=semverVersion]$semVerString";

The “Not Found” error I’m getting isn’t particularly helpful…

Task logs

Pertinent logs + error here:

##[debug]Processed: ##vso[task.setvariable variable=semverVersion]1.0.x-ci+6
##[debug]Add build tag: 1.0.x-ci+6 to build: 741 at backend.
##[debug]Processed: ##vso[build.addbuildtag]1.0.x-ci+6
##[debug]$LASTEXITCODE is not set.
##[debug]Exit code: 0
##[debug]Leaving Invoke-VstsTool.
##[debug]Leaving D:\a\_tasks\PowerShell_e213ff0f-5d5c-4791-802d-52ea3e7be1f1\2.170.1\powershell.ps1.
Async Command Start: Add Build Tag
Async Command End: Add Build Tag
##[error]Not Found
##[debug]Microsoft.VisualStudio.Services.WebApi.VssServiceResponseException: Not Found
   at Microsoft.VisualStudio.Services.WebApi.VssHttpClientBase.HandleResponseAsync(HttpResponseMessage response, CancellationToken cancellationToken)
   at Microsoft.VisualStudio.Services.WebApi.VssHttpClientBase.SendAsync(HttpRequestMessage message, HttpCompletionOption completionOption, Object userState, CancellationToken cancellationToken)
   at Microsoft.TeamFoundation.Build.WebApi.BuildHttpClientCompatBase.SendAsync[T](HttpRequestMessage message, Object userState, CancellationToken cancellationToken, Func`3 processResponse)
   at Microsoft.TeamFoundation.Build.WebApi.BuildHttpClientCompatBase.SendAsync[T](HttpMethod method, IEnumerable`1 additionalHeaders, Guid locationId, Object routeValues, ApiResourceVersion version, HttpContent content, IEnumerable`1 queryParameters, Object userState, CancellationToken cancellationToken, Func`3 processResponse)
   at Microsoft.VisualStudio.Services.Agent.Worker.Build.BuildServer.AddBuildTag(Int32 buildId, Guid projectId, String buildTag, CancellationToken cancellationToken)
   at Microsoft.VisualStudio.Services.Agent.Worker.Build.BuildAddBuildTagCommand.AddBuildTagAsync(IAsyncCommandContext context, VssConnection connection, Guid projectId, Int32 buildId, String buildTag, CancellationToken cancellationToken)
   at Microsoft.VisualStudio.Services.Agent.Worker.AsyncCommandContext.WaitAsync()
   at Microsoft.VisualStudio.Services.Agent.Worker.StepsRunner.RunStepAsync(IStep step, CancellationToken jobCancellationToken)
Finishing: Detect and validate version

Full log for the task here (for information):

    ##[debug]Evaluating condition for step: 'Detect and validate version'
    ##[debug]Evaluating: succeeded()
    ##[debug]Evaluating succeeded:
    ##[debug]=> True
    ##[debug]Result: True
    Starting: Detect and validate version
    ==============================================================================
    Task         : PowerShell
    Description  : Run a PowerShell script on Linux, macOS, or Windows
    Version      : 2.170.1
    Author       : Microsoft Corporation
    Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/powershell
    ==============================================================================
    ##[debug]VstsTaskSdk 0.11.0 commit 7ff27a3e0bdd6f7b06690ae5f5b63cb84d0f23f4
    ##[debug]Entering D:\a\_tasks\PowerShell_e213ff0f-5d5c-4791-802d-52ea3e7be1f1\2.170.1\powershell.ps1.
    ##[debug]Loading resource strings from: D:\a\_tasks\PowerShell_e213ff0f-5d5c-4791-802d-52ea3e7be1f1\2.170.1\task.json
    ##[debug]Loaded 11 strings.
    ##[debug]SYSTEM_CULTURE: 'en-US'
    ##[debug]Loading resource strings from: D:\a\_tasks\PowerShell_e213ff0f-5d5c-4791-802d-52ea3e7be1f1\2.170.1\Strings\resources.resjson\en-US\resources.resjson
    ##[debug]Loaded 11 strings.
    ##[debug]INPUT_ERRORACTIONPREFERENCE: 'stop'
    ##[debug]INPUT_FAILONSTDERR: 'true'
    ##[debug] Converted to bool: True
    ##[debug]INPUT_IGNORELASTEXITCODE: 'false'
    ##[debug] Converted to bool: False
    ##[debug]INPUT_PWSH: 'false'
    ##[debug] Converted to bool: False
    ##[debug]INPUT_WORKINGDIRECTORY: 'd:\a\1\s'
    ##[debug]Asserting container path exists: 'd:\a\1\s'
    ##[debug]INPUT_TARGETTYPE: 'inline'
    ##[debug]INPUT_SCRIPT: 'Set-PSDebug -Strict;
    ##[debug]$ErrorActionPreference = 'Stop';
    ##[debug]Import-Module 'd:\a\1\s\MyProduct\Utils\Scripts\VersionHelpers' -Force;
    ##[debug]$prSourcebranch = "$env:SYSTEM_PULLREQUEST_SOURCEBRANCH";
    ##[debug]$buildSourceBranch = "$env:BUILD_SOURCEBRANCH";
    ##[debug]
    ##[debug]Set-Version -buildSourceBranch "$buildSourceBranch" -pipelineBuildNumber 6 -version "" -prSourceBranch "$prSourcebranch" -Verbose;'
    Generating script.
    ##[debug]AGENT_VERSION: '2.170.1'
    ##[debug]AGENT_TEMPDIRECTORY: 'd:\a\_temp'
    ##[debug]Asserting container path exists: 'd:\a\_temp'
    ##[debug]Asserting leaf path exists: 'C:\windows\System32\WindowsPowerShell\v1.0\powershell.exe'
    ========================== Starting Command Output ===========================
    ##[debug]Entering Invoke-VstsTool.
    ##[debug] Arguments: '-NoLogo -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command ". 'd:\a\_temp\a8eb2604-0a95-4702-bcd9-b2c955990a59.ps1'"'
    ##[debug] FileName: 'C:\windows\System32\WindowsPowerShell\v1.0\powershell.exe'
    ##[debug] WorkingDirectory: 'd:\a\1\s'
    "C:\windows\System32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command ". 'd:\a\_temp\a8eb2604-0a95-4702-bcd9-b2c955990a59.ps1'"
    VERBOSE: Parsing version from git ref 'refs/heads/release/generic/1.0.x'
    VERBOSE: Ref is branch
    VERBOSE: Detected branch type 'release' with suffix 'generic/1.0.x'
    VERBOSE: Setting version number variables
    ##[debug]Processed: ##vso[task.setvariable variable=versionMajor]1
    ##[debug]Processed: ##vso[task.setvariable variable=versionMinor]0
    ##[debug]Processed: ##vso[task.setvariable variable=versionRevision]x
    ##[debug]Processed: ##vso[task.setvariable variable=versionBuild]6
    ##[debug]Processed: ##vso[task.setvariable variable=semverVersion]1.0.x-ci+6
    ##[debug]Add build tag: 1.0.x-ci+6 to build: 741 at backend.
    ##[debug]Processed: ##vso[build.addbuildtag]1.0.x-ci+6
    ##[debug]$LASTEXITCODE is not set.
    ##[debug]Exit code: 0
    ##[debug]Leaving Invoke-VstsTool.
    ##[debug]Leaving D:\a\_tasks\PowerShell_e213ff0f-5d5c-4791-802d-52ea3e7be1f1\2.170.1\powershell.ps1.
    Async Command Start: Add Build Tag
    Async Command End: Add Build Tag
    ##[error]Not Found
    ##[debug]Microsoft.VisualStudio.Services.WebApi.VssServiceResponseException: Not Found
       at Microsoft.VisualStudio.Services.WebApi.VssHttpClientBase.HandleResponseAsync(HttpResponseMessage response, CancellationToken cancellationToken)
       at Microsoft.VisualStudio.Services.WebApi.VssHttpClientBase.SendAsync(HttpRequestMessage message, HttpCompletionOption completionOption, Object userState, CancellationToken cancellationToken)
       at Microsoft.TeamFoundation.Build.WebApi.BuildHttpClientCompatBase.SendAsync[T](HttpRequestMessage message, Object userState, CancellationToken cancellationToken, Func`3 processResponse)
       at Microsoft.TeamFoundation.Build.WebApi.BuildHttpClientCompatBase.SendAsync[T](HttpMethod method, IEnumerable`1 additionalHeaders, Guid locationId, Object routeValues, ApiResourceVersion version, HttpContent content, IEnumerable`1 queryParameters, Object userState, CancellationToken cancellationToken, Func`3 processResponse)
       at Microsoft.VisualStudio.Services.Agent.Worker.Build.BuildServer.AddBuildTag(Int32 buildId, Guid projectId, String buildTag, CancellationToken cancellationToken)
       at Microsoft.VisualStudio.Services.Agent.Worker.Build.BuildAddBuildTagCommand.AddBuildTagAsync(IAsyncCommandContext context, VssConnection connection, Guid projectId, Int32 buildId, String buildTag, CancellationToken cancellationToken)
       at Microsoft.VisualStudio.Services.Agent.Worker.AsyncCommandContext.WaitAsync()
       at Microsoft.VisualStudio.Services.Agent.Worker.StepsRunner.RunStepAsync(IStep step, CancellationToken jobCancellationToken)
    Finishing: Detect and validate version

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
Bidthedogcommented, Jun 18, 2020

I’d say it belongs on here:

https://docs.microsoft.com/en-us/azure/devops/pipelines/scripts/logging-commands?view=azure-devops&tabs=bash

Though that page also needs a good spring cleaning!

0reactions
damccormcommented, Jun 18, 2020

Agreed!

Read more comments on GitHub >

github_iconTop Results From Across the Web

github - Git - remote: Repository not found - Stack Overflow
I received the repo-not-found message after cloning a gitHub repository ... Then this problem is may occur because you don't have repo present...
Read more >
Fix Git's 'fatal: repository not found' error quickly | TheServerSide
Frustrated by Git's 'fatal: repository not found' error message? Here are five ways to fix that problem and successfully clone, ...
Read more >
git failed with a fatal error: repository not found
I'm now trying to clone a repository and I'm getting: Git failed with a fatal error. fatal: repository 'https://triad.visualstudio.com/Customer ...
Read more >
Git clone or Git push fails to an Azure DevOps repository
This article discusses problems that might occur when you try to perform Git clone or Git push function to an Azure DevOps repository....
Read more >
Running jobs using notebooks in a remote Azure DevOps ...
... (Repos) Git repository is generating "Notebook not found" error. ... In the Databricks workspace git provider configuration (User ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found