Closed bjornbouetsmith closed 2 years ago
The . is something in the extension. When using the OAuth system token. The build identity: Project Collection Build Service ({OrgName}) should have the permissions to see the pipelines and you should also make sure to make the accesstoken available in the flow.
https://msftplayground.com/2022/02/version-number-counter-now-supports-the-build-identity/
The above article shows an example with one of my other extensions
Hmm,
I have tried the following:
I have this:
And:
But it just fails every time - this time though it does not say 'Unauthorized' - it just says it cannot find the build.
##[error]Unable to find a build definition for Project common with the build id: 571.
Any other hints?
Also - if I take the example script from microsoft and tweak it a little:
$build = Invoke-RestMethod -Uri 'http://devops.root.dom/ROOT/common/_apis/build/builds/568?api-version=5.1' -Headers @{
Authorization = "Bearer $env:SYSTEM_ACCESSTOKEN"
}
Write-Host "Build= $($build | ConvertTo-Json -Depth 100)"
It just works - so the access token is working it seems - even accessing the exact same url your extension tries to access.
This script I have set to run immediately before "version number counter"
Could you share the complete logs with a system.debug variable added with the value true
2022-09-22T17:44:59.7692962Z ##[debug]Evaluating condition for step: 'Increment version number'
2022-09-22T17:44:59.7695122Z ##[debug]Evaluating: succeeded()
2022-09-22T17:44:59.7695808Z ##[debug]Evaluating succeeded:
2022-09-22T17:44:59.7697219Z ##[debug]=> True
2022-09-22T17:44:59.7698387Z ##[debug]Result: True
2022-09-22T17:44:59.7699338Z ##[section]Starting: Increment version number
2022-09-22T17:44:59.7829171Z ==============================================================================
2022-09-22T17:44:59.7830115Z Task : Version number counter
2022-09-22T17:44:59.7831012Z Description : Build and release task for a version number counter
2022-09-22T17:44:59.7831715Z Version : 2.0.10
2022-09-22T17:44:59.7832432Z Author : Maik van der Gaag
2022-09-22T17:44:59.7833142Z Help :
2022-09-22T17:44:59.7833870Z ==============================================================================
2022-09-22T17:45:00.9230141Z ##[debug]VstsTaskSdk 0.1 commit _COMMITHASH
2022-09-22T17:45:01.0488862Z ##[debug]Entering D:\agent1_work_tasks\versioncounter_84f23c57-8c65-4709-bc94-5cbd44e96a99\2.0.10\run-task.ps1.
2022-09-22T17:45:01.0904085Z ##[debug]INPUT_VERSIONVARIABLE: 'Version'
2022-09-22T17:45:01.0972938Z ##[debug]INPUT_UPDATEMINORVERSION: 'false'
2022-09-22T17:45:01.1006339Z ##[debug]INPUT_MAXVALUEPATCHVERSION: '0'
2022-09-22T17:45:01.1039544Z ##[debug]INPUT_MAXVALUEMINORVERSION: '0'
2022-09-22T17:45:01.1073993Z ##[debug]INPUT_UPDATEMAJORVERSION: 'false'
2022-09-22T17:45:01.1108772Z ##[debug]INPUT_ONLYUPDATEMINOR: 'false'
2022-09-22T17:45:01.1170022Z ##[debug] Converted to bool: False
2022-09-22T17:45:01.1230370Z ##[debug]INPUT_DEVOPSPAT: '~~~~~~~~~~~~~~~~~
2022-09-22T17:45:01.3550081Z ##[debug] + CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
2022-09-22T17:45:01.3569808Z ##[debug] + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,run-task.ps1
2022-09-22T17:45:01.3594712Z ##[debug]
2022-09-22T17:45:01.3623112Z ##[debug]Script stack trace:
2022-09-22T17:45:01.3680049Z ##[debug]at
Hi Bjorn please remove the log or change it. Currently it it showing your PAT.
Another thing that I noticed it that you are using a on prem Azure DevOps. Will check it further for you
Hi, Yes I am using a on prem Azure DevOps - Azure DevOps Server 2020 Update 1.1
Regards
Describe the issue Using PAT works great. When using the new oAuth system - it seems like the code adds a '.' after the url - so whatever version I chose in the drop down for the API version - I get the following error:
Extension
To Reproduce Steps to reproduce the behavior:
Expected behavior Version number gets updated - just like when using a PAT
Situation (please complete the following information):
~~~~~~~~~~~~~~~~~ 2022-09-21T16:20:24.5568553Z ##[debug] + CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException 2022-09-21T16:20:24.5592224Z ##[debug] + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,run-task.ps1 2022-09-21T16:20:24.5616444Z ##[debug] 2022-09-21T16:20:24.5660579Z ##[debug]Script stack trace: 2022-09-21T16:20:24.5731793Z ##[debug]at