Azure / apiops

APIOps applies the concepts of GitOps and DevOps to API deployment. By using practices from these two methodologies, APIOps can enable everyone involved in the lifecycle of API design, development, and deployment with self-service and automated tools to ensure the quality of the specifications and APIs that they’re building.
https://azure.github.io/apiops
MIT License
312 stars 181 forks source link

[BUG] Tools failing in second stage with error Exception: /home/vsts/work/_temp/c2e65d0b-f440-4d0f-b157-f4e17097471e.ps1:43 #566

Open Bi3thiru opened 3 months ago

Bi3thiru commented 3 months ago

Release version

v6.0.0-alpha.1.0.8

Describe the bug

2024-06-09T09:55:22.3229337Z ##[debug]Evaluating condition for step: 'Create pull request' 2024-06-09T09:55:22.3230249Z ##[debug]Evaluating: SucceededNode() 2024-06-09T09:55:22.3230495Z ##[debug]Evaluating SucceededNode: 2024-06-09T09:55:22.3230928Z ##[debug]=> True 2024-06-09T09:55:22.3231175Z ##[debug]Result: True 2024-06-09T09:55:22.3231461Z ##[section]Starting: Create pull request 2024-06-09T09:55:22.3237484Z ============================================================================== 2024-06-09T09:55:22.3237630Z Task : PowerShell 2024-06-09T09:55:22.3237695Z Description : Run a PowerShell script on Linux, macOS, or Windows 2024-06-09T09:55:22.3237801Z Version : 2.239.1 2024-06-09T09:55:22.3237866Z Author : Microsoft Corporation 2024-06-09T09:55:22.3237960Z Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/powershell 2024-06-09T09:55:22.3238089Z ============================================================================== 2024-06-09T09:55:22.3594959Z ##[debug]Resource Utilization warnings is disabled, switch "DISABLE_RESOURCE_UTILIZATION_WARNINGS" variable to "true" if you want to enable it 2024-06-09T09:55:23.5698985Z ##[debug]Using node path: /home/vsts/agents/3.240.1/externals/node20_1/bin/node 2024-06-09T09:55:24.8856403Z ##[debug]Agent environment resources - Disk: / Available 21546.00 MB out of 74244.00 MB, Memory: Used 689.00 MB out of 6921.00 MB, CPU: Usage 47.49% 2024-06-09T09:55:25.3068178Z ##[debug]agent.TempDirectory=/home/vsts/work/_temp 2024-06-09T09:55:25.3074424Z ##[debug]loading inputs and endpoints 2024-06-09T09:55:25.3079217Z ##[debug]loading INPUT_TARGETTYPE 2024-06-09T09:55:25.3218419Z ##[debug]loading INPUT_FILEPATH 2024-06-09T09:55:25.3221162Z ##[debug]loading INPUT_SCRIPT 2024-06-09T09:55:25.3223969Z ##[debug]loading INPUT_ERRORACTIONPREFERENCE 2024-06-09T09:55:25.3226524Z ##[debug]loading INPUT_WARNINGPREFERENCE 2024-06-09T09:55:25.3229067Z ##[debug]loading INPUT_INFORMATIONPREFERENCE 2024-06-09T09:55:25.3231434Z ##[debug]loading INPUT_VERBOSEPREFERENCE 2024-06-09T09:55:25.3234845Z ##[debug]loading INPUT_DEBUGPREFERENCE 2024-06-09T09:55:25.3237551Z ##[debug]loading INPUT_PROGRESSPREFERENCE 2024-06-09T09:55:25.3240464Z ##[debug]loading INPUT_FAILONSTDERR 2024-06-09T09:55:25.3243566Z ##[debug]loading INPUT_SHOWWARNINGS 2024-06-09T09:55:25.3247709Z ##[debug]loading INPUT_IGNORELASTEXITCODE 2024-06-09T09:55:25.3250613Z ##[debug]loading INPUT_PWSH 2024-06-09T09:55:25.3253795Z ##[debug]loading INPUT_WORKINGDIRECTORY 2024-06-09T09:55:25.3256844Z ##[debug]loading INPUT_RUNSCRIPTINSEPARATESCOPE 2024-06-09T09:55:25.3259112Z ##[debug]loading ENDPOINT_AUTH_SYSTEMVSSCONNECTION 2024-06-09T09:55:25.3261477Z ##[debug]loading ENDPOINT_AUTH_SCHEME_SYSTEMVSSCONNECTION 2024-06-09T09:55:25.3264546Z ##[debug]loading ENDPOINT_AUTH_PARAMETER_SYSTEMVSSCONNECTION_ACCESSTOKEN 2024-06-09T09:55:25.3269055Z ##[debug]loading SECRET_AZURE_SUBSCRIPTION_ID 2024-06-09T09:55:25.3271615Z ##[debug]loading SECRET_SYSTEM_ACCESSTOKEN 2024-06-09T09:55:25.3275646Z ##[debug]loaded 20 2024-06-09T09:55:25.3280944Z ##[debug]Agent.ProxyUrl=undefined 2024-06-09T09:55:25.3284617Z ##[debug]Agent.CAInfo=undefined 2024-06-09T09:55:25.3284896Z ##[debug]Agent.ClientCert=undefined 2024-06-09T09:55:25.3285180Z ##[debug]Agent.SkipCertValidation=undefined 2024-06-09T09:55:25.3307635Z ##[debug]check path : /home/vsts/work/_tasks/PowerShell_e213ff0f-5d5c-4791-802d-52ea3e7be1f1/2.239.1/task.json 2024-06-09T09:55:25.3310632Z ##[debug]adding resource file: /home/vsts/work/_tasks/PowerShell_e213ff0f-5d5c-4791-802d-52ea3e7be1f1/2.239.1/task.json 2024-06-09T09:55:25.3311062Z ##[debug]system.culture=en-US 2024-06-09T09:55:25.3331313Z ##[debug]errorActionPreference=stop 2024-06-09T09:55:25.3333921Z ##[debug]warningPreference=default 2024-06-09T09:55:25.3334855Z ##[debug]informationPreference=default 2024-06-09T09:55:25.3335905Z ##[debug]verbosePreference=default 2024-06-09T09:55:25.3336827Z ##[debug]debugPreference=default 2024-06-09T09:55:25.3338454Z ##[debug]progressPreference=silentlyContinue 2024-06-09T09:55:25.3339708Z ##[debug]showWarnings=false 2024-06-09T09:55:25.3340758Z ##[debug]failOnStderr=false 2024-06-09T09:55:25.3341753Z ##[debug]ignoreLASTEXITCODE=false 2024-06-09T09:55:25.3352319Z ##[debug]workingDirectory=/home/vsts/work/1/s 2024-06-09T09:55:25.3352660Z ##[debug]check path : /home/vsts/work/1/s 2024-06-09T09:55:25.3352975Z ##[debug]targetType=inline 2024-06-09T09:55:25.3360358Z ##[debug]script=Set-StrictMode -Version Latest $ErrorActionPreference = "Stop" $VerbosePreference = "Continue" $InformationPreference = "Continue"

Write-Information "Installing Azure DevOps extension..." az extension add --name "azure-devops" az devops configure --defaults organization="https://sydair-insights.visualstudio.com/" project="Insights - Data and Analytics Development"

Write-Information "Creating temporary folder..." $temporaryFolderPath = Join-Path "/home/vsts/work/_temp" "artifacts-from-portal" New-Item -Path "$temporaryFolderPath" -ItemType "Directory"

$branchName = "dev" $temporaryBranchName = "artifacts-from-portal-build-4274" $repositoryName = "sa-api-ops" Write-Information "Cloning branch $branchName in repository $repositoryName..." $cloneUrl = az repos show --repository "$repositoryName" --query "remoteUrl" --output tsv Write-Information "Clone URL is $cloneUrl" git -c http.extraheader="AUTHORIZATION: Bearer ***" clone --branch "$branchName" --depth 1 "$cloneUrl" "$temporaryFolderPath" if ($LASTEXITCODE -ne 0) { throw "Cloning branch $branchName in repository $repositoryName failed." }

Write-Information "Creating temporary branch $temporaryBranchName from $branchName..." git -C "$temporaryFolderPath" checkout -b "$temporaryBranchName" "$branchName" if ($LASTEXITCODE -ne 0) { throw "Creating temporary branch $temporaryBranchName from $branchName failed." }

Write-Information "Creating artifacts folder..." $artifactFolderPath = Join-Path "$temporaryFolderPath" "artifacts" if ((Test-Path -Path "$artifactFolderPath") -eq $false) { New-Item -Path "$artifactFolderPath" -ItemType "Directory" }

Write-Information "Synchronizing artifacts..." $extractorArtifactsFolderPath = Join-Path "/home/vsts/work/1" "artifacts-from-portal" artifacts if ("Linux" -like "win") { & robocopy "$extractorArtifactsFolderPath" "$artifactFolderPath" /zb /mir /mt if ($LASTEXITCODE -gt 7) { throw "Setting $artifactFolderPath to contents of $extractorArtifactsFolderPath failed." } } else { & rsync --verbose --archive --delete --force --recursive "$extractorArtifactsFolderPath/" "$artifactFolderPath/" if ($LASTEXITCODE -ne 0) { throw "Setting $artifactFolderPath to contents of $extractorArtifactsFolderPath failed." } }

Write-Information "Validating that changes exist to be published..." $gitStatus = git -C "$temporaryFolderPath" status --porcelain if ($LASTEXITCODE -ne 0) { throw "Getting git status failed." } if ([string]::IsNullOrWhiteSpace($gitStatus)) { Write-Information "No changes exist to be published." return }

Write-Information "Setting git user information..." git config --global user.email "azuredevopsagent@azuredevops.com" git config --global user.name "Azure Devops agent"

Write-Information "Adding changes..." git -C "$temporaryFolderPath" add --all if ($LASTEXITCODE -ne 0) { throw "Adding Git changes failed." }

Write-Information "Committing changes" $commitOutput = git -C "$temporaryFolderPath" commit --message "Initial commit" if ($LASTEXITCODE -ne 0) { if ($commitOutput.Contains("nothing to commit, working tree clean")) { Write-Information "No changes exist to be published." return } throw "Committing Git changes failed." }

Write-Information "Pushing changes" git -C "$temporaryFolderPath" -c http.extraheader="AUTHORIZATION: Bearer ***" push --set-upstream origin "$temporaryBranchName" if ($LASTEXITCODE -ne 0) { throw "Pushing Git changes failed." }

Write-Information "Creating pull request..." az repos pr create --source-branch "$temporaryBranchName" --target-branch "$branchName" --title "Merging artifacts from portal (Build 4274)" --squash --delete-source-branch "true" --repository "$repositoryName" if ($LASTEXITCODE -ne 0) { throw "Creating pull request failed." }

Write-Information "Deleting temporary folder contents..." Remove-Item -Path "$temporaryFolderPath" -Recurse -Force

Write-Information "Execution complete." 2024-06-09T09:55:25.3364563Z ##[debug]runScriptInSeparateScope=false 2024-06-09T09:55:25.3365534Z Generating script. 2024-06-09T09:55:25.3397369Z ##[debug]Processed: ##vso[task.logdetail id=acde0728-c31e-481a-b6f0-90b488499749;type=command;name=command;]Formatted command: Set-StrictMode -Version Latest $ErrorActionPreference = "Stop" $VerbosePreference = "Continue" $InformationPreference = "Continue"

Write-Information "Installing Azure DevOps extension..." az extension add --name "azure-devops" az devops configure --defaults organization="https://sydair-insights.visualstudio.com/" project="Insights - Data and Analytics Development"

Write-Information "Creating temporary folder..." $temporaryFolderPath = Join-Path "/home/vsts/work/_temp" "artifacts-from-portal" New-Item -Path "$temporaryFolderPath" -ItemType "Directory"

$branchName = "dev" $temporaryBranchName = "artifacts-from-portal-build-4274" $repositoryName = "sa-api-ops" Write-Information "Cloning branch $branchName in repository $repositoryName..." $cloneUrl = az repos show --repository "$repositoryName" --query "remoteUrl" --output tsv Write-Information "Clone URL is $cloneUrl" git -c http.extraheader="AUTHORIZATION: Bearer ***" clone --branch "$branchName" --depth 1 "$cloneUrl" "$temporaryFolderPath" if ($LASTEXITCODE -ne 0) { throw "Cloning branch $branchName in repository $repositoryName failed." }

Write-Information "Creating temporary branch $temporaryBranchName from $branchName..." git -C "$temporaryFolderPath" checkout -b "$temporaryBranchName" "$branchName" if ($LASTEXITCODE -ne 0) { throw "Creating temporary branch $temporaryBranchName from $branchName failed." }

Write-Information "Creating artifacts folder..." $artifactFolderPath = Join-Path "$temporaryFolderPath" "artifacts" if ((Test-Path -Path "$artifactFolderPath") -eq $false) { New-Item -Path "$artifactFolderPath" -ItemType "Directory" }

Write-Information "Synchronizing artifacts..." $extractorArtifactsFolderPath = Join-Path "/home/vsts/work/1" "artifacts-from-portal" artifacts if ("Linux" -like "win") { & robocopy "$extractorArtifactsFolderPath" "$artifactFolderPath" /zb /mir /mt if ($LASTEXITCODE -gt 7) { throw "Setting $artifactFolderPath to contents of $extractorArtifactsFolderPath failed." } } else { & rsync --verbose --archive --delete --force --recursive "$extractorArtifactsFolderPath/" "$artifactFolderPath/" if ($LASTEXITCODE -ne 0) { throw "Setting $artifactFolderPath to contents of $extractorArtifactsFolderPath failed." } }

Write-Information "Validating that changes exist to be published..." $gitStatus = git -C "$temporaryFolderPath" status --porcelain if ($LASTEXITCODE -ne 0) { throw "Getting git status failed." } if ([string]::IsNullOrWhiteSpace($gitStatus)) { Write-Information "No changes exist to be published." return }

Write-Information "Setting git user information..." git config --global user.email "azuredevopsagent@azuredevops.com" git config --global user.name "Azure Devops agent"

Write-Information "Adding changes..." git -C "$temporaryFolderPath" add --all if ($LASTEXITCODE -ne 0) { throw "Adding Git changes failed." }

Write-Information "Committing changes" $commitOutput = git -C "$temporaryFolderPath" commit --message "Initial commit" if ($LASTEXITCODE -ne 0) { if ($commitOutput.Contains("nothing to commit, working tree clean")) { Write-Information "No changes exist to be published." return } throw "Committing Git changes failed." }

Write-Information "Pushing changes" git -C "$temporaryFolderPath" -c http.extraheader="AUTHORIZATION: Bearer ***" push --set-upstream origin "$temporaryBranchName" if ($LASTEXITCODE -ne 0) { throw "Pushing Git changes failed." }

Write-Information "Creating pull request..." az repos pr create --source-branch "$temporaryBranchName" --target-branch "$branchName" --title "Merging artifacts from portal (Build 4274)" --squash --delete-source-branch "true" --repository "$repositoryName" if ($LASTEXITCODE -ne 0) { throw "Creating pull request failed." }

Write-Information "Deleting temporary folder contents..." Remove-Item -Path "$temporaryFolderPath" -Recurse -Force

Write-Information "Execution complete." 2024-06-09T09:55:25.3402411Z ##[debug]Agent.Version=3.240.1 2024-06-09T09:55:25.3402755Z ##[debug]agent.tempDirectory=/home/vsts/work/_temp 2024-06-09T09:55:25.3403088Z ##[debug]check path : /home/vsts/work/_temp 2024-06-09T09:55:25.3403355Z ========================== Starting Command Output =========================== 2024-06-09T09:55:25.3403702Z ##[debug]which 'pwsh' 2024-06-09T09:55:25.3404001Z ##[debug]found: '/usr/bin/pwsh' 2024-06-09T09:55:25.3404303Z ##[debug]which '/usr/bin/pwsh' 2024-06-09T09:55:25.3404604Z ##[debug]found: '/usr/bin/pwsh' 2024-06-09T09:55:25.3404911Z ##[debug]/usr/bin/pwsh arg: -NoLogo 2024-06-09T09:55:25.3405222Z ##[debug]/usr/bin/pwsh arg: -NoProfile 2024-06-09T09:55:25.3405544Z ##[debug]/usr/bin/pwsh arg: -NonInteractive 2024-06-09T09:55:25.3405860Z ##[debug]/usr/bin/pwsh arg: -Command 2024-06-09T09:55:25.3406217Z ##[debug]/usr/bin/pwsh arg: . '/home/vsts/work/_temp/c2e65d0b-f440-4d0f-b157-f4e17097471e.ps1' 2024-06-09T09:55:25.3406696Z ##[debug]exec tool: /usr/bin/pwsh 2024-06-09T09:55:25.3406995Z ##[debug]arguments: 2024-06-09T09:55:25.3407280Z ##[debug] -NoLogo 2024-06-09T09:55:25.3407563Z ##[debug] -NoProfile 2024-06-09T09:55:25.3407852Z ##[debug] -NonInteractive 2024-06-09T09:55:25.3408140Z ##[debug] -Command 2024-06-09T09:55:25.3408472Z ##[debug] . '/home/vsts/work/_temp/c2e65d0b-f440-4d0f-b157-f4e17097471e.ps1' 2024-06-09T09:55:25.3409142Z [command]/usr/bin/pwsh -NoLogo -NoProfile -NonInteractive -Command . '/home/vsts/work/_temp/c2e65d0b-f440-4d0f-b157-f4e17097471e.ps1' 2024-06-09T09:55:29.8887989Z ##[debug]Agent environment resources - Disk: / Available 21546.00 MB out of 74244.00 MB, Memory: Used 752.00 MB out of 6921.00 MB, CPU: Usage 33.58% 2024-06-09T09:55:30.4897878Z Installing Azure DevOps extension... 2024-06-09T09:55:34.8948804Z ##[debug]Agent environment resources - Disk: / Available 21546.00 MB out of 74244.00 MB, Memory: Used 784.00 MB out of 6921.00 MB, CPU: Usage 25.94% 2024-06-09T09:55:39.8998875Z ##[debug]Agent environment resources - Disk: / Available 21546.00 MB out of 74244.00 MB, Memory: Used 824.00 MB out of 6921.00 MB, CPU: Usage 21.13% 2024-06-09T09:55:44.9012552Z ##[debug]Agent environment resources - Disk: / Available 21546.00 MB out of 74244.00 MB, Memory: Used 877.00 MB out of 6921.00 MB, CPU: Usage 17.85% 2024-06-09T09:55:49.4485331Z WARNING: Default enabled including preview versions for extension installation now. Disabled in future release. Use '--allow-preview true' to enable it specifically if needed. Use '--allow-preview false' to install stable version only. 2024-06-09T09:55:49.9061011Z ##[debug]Agent environment resources - Disk: / Available 21545.00 MB out of 74244.00 MB, Memory: Used 929.00 MB out of 6921.00 MB, CPU: Usage 15.46% 2024-06-09T09:55:53.1044513Z WARNING: Extension 'azure-devops' 1.0.1 is already installed. 2024-06-09T09:55:54.6450454Z Creating temporary folder... 2024-06-09T09:55:54.7856782Z 2024-06-09T09:55:54.7863539Z Directory: /home/vsts/work/_temp 2024-06-09T09:55:54.7864529Z 2024-06-09T09:55:54.7914018Z UnixMode  User Group  LastWriteTime Size Name 2024-06-09T09:55:54.7919118Z --------   ---- -----   -------------  ---- ---- 2024-06-09T09:55:54.8123173Z drwxr-xr-x vsts docker 06/09/2024 09:55 4096 artifacts-from-p 2024-06-09T09:55:54.8123648Z ortal 2024-06-09T09:55:54.8124161Z Cloning branch dev in repository sa-api-ops... 2024-06-09T09:55:54.9089292Z ##[debug]Agent environment resources - Disk: / Available 21545.00 MB out of 74244.00 MB, Memory: Used 777.00 MB out of 6921.00 MB, CPU: Usage 13.68% 2024-06-09T09:55:56.2798123Z Clone URL is https://sydair-insights.visualstudio.com/Insights%20-%20Data%20and%20Analytics%20Development/_git/sa-api-ops 2024-06-09T09:55:56.2905945Z Cloning into '/home/vsts/work/_temp/artifacts-from-portal'... 2024-06-09T09:55:56.4689183Z Creating temporary branch artifacts-from-portal-build-4274 from dev... 2024-06-09T09:55:56.4809552Z Switched to a new branch 'artifacts-from-portal-build-4274' 2024-06-09T09:55:56.4818415Z Creating artifacts folder... 2024-06-09T09:55:56.4934113Z 2024-06-09T09:55:56.4935221Z Directory: /home/vsts/work/_temp/artifacts-from-portal 2024-06-09T09:55:56.4935333Z 2024-06-09T09:55:56.4935867Z UnixMode  User Group  LastWriteTime Size Name 2024-06-09T09:55:56.4936501Z --------   ---- -----   -------------  ---- ---- 2024-06-09T09:55:56.4941157Z drwxr-xr-x vsts docker 06/09/2024 09:55 4096 artifacts 2024-06-09T09:55:56.4941510Z Synchronizing artifacts... 2024-06-09T09:55:56.5514586Z sending incremental file list 2024-06-09T09:55:56.5515313Z rsync: [sender] change_dir "/home/vsts/work/1/artifacts-from-portal/artifacts" failed: No such file or directory (2) 2024-06-09T09:55:56.6743172Z 2024-06-09T09:55:56.6756036Z sent 19 bytes received 12 bytes 62.00 bytes/sec 2024-06-09T09:55:56.6756309Z total size is 0 speedup is 0.00 2024-06-09T09:55:56.6756724Z rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1338) [sender=3.2.7] 2024-06-09T09:55:57.1135914Z Exception: /home/vsts/work/_temp/c2e65d0b-f440-4d0f-b157-f4e17097471e.ps1:43 2024-06-09T09:55:57.1137705Z Line | 2024-06-09T09:55:57.1139077Z  43 |  … DE -ne 0) { throw "Setting $artifactFolderPath to contents of $extrac … 2024-06-09T09:55:57.1139957Z  |  ~~~~~~~~~~~~~ 2024-06-09T09:55:57.1140557Z  | Setting /home/vsts/work/_temp/artifacts-from-portal/artifacts to 2024-06-09T09:55:57.1141306Z  | contents of /home/vsts/work/1/artifacts-from-portal/artifacts failed. 2024-06-09T09:55:57.1825432Z 2024-06-09T09:55:57.1835308Z ##[debug]Exit code 1 received from tool '/usr/bin/pwsh' 2024-06-09T09:55:57.1839605Z ##[debug]STDIO streams have closed for tool '/usr/bin/pwsh' 2024-06-09T09:55:57.1850098Z ##[debug]task result: Failed 2024-06-09T09:55:57.1890527Z ##[error]PowerShell exited with code '1'. 2024-06-09T09:55:57.1898085Z ##[debug]Processed: ##vso[task.issue type=error;source=TaskInternal;]PowerShell exited with code '1'. 2024-06-09T09:55:57.1906258Z ##[debug]Processed: ##vso[task.complete result=Failed;]PowerShell exited with code '1'. 2024-06-09T09:55:57.1945340Z ##[section]Finishing: Create pull request

Expected behavior

Publish works

Actual behavior

total size is 0 speedup is 0.00 rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1338) [sender=3.2.7] Exception: /home/vsts/work/_temp/c2e65d0b-f440-4d0f-b157-f4e17097471e.ps1:43 Line | 43 | … DE -ne 0) { throw "Setting $artifactFolderPath to contents of $extrac … | ~~~~~~~~~~~~~ | Setting /home/vsts/work/_temp/artifacts-from-portal/artifacts to | contents of /home/vsts/work/1/artifacts-from-portal/artifacts failed.

Reproduction Steps

Configure with default behavoir, just json extractor, extract in Azure Devops

github-actions[bot] commented 3 months ago
  Thank you for opening this issue! Please be patient while we will look into it and get back to you as this is an open source project. In the meantime make sure you take a look at the [closed issues](https://github.com/Azure/apiops/issues?q=is%3Aissue+is%3Aclosed) in case your question has already been answered. Don't forget to provide any additional information if needed (e.g. scrubbed logs, detailed feature requests,etc.).
  Whenever it's feasible, please don't hesitate to send a Pull Request (PR) our way. We'd greatly appreciate it, and we'll gladly assess and incorporate your changes.
guythetechie commented 2 months ago

Can you try again with the latest RC version?

jhoops88 commented 1 month ago

I ran into the same issue in v6.0.1.1.

I resolved by changing the working directory of the power shell task “run extractor”

workingDirectory: '$(Build.ArtifactStagingDirectory)'

SamiKorhonen commented 1 month ago

I think this is a workaround for the bug. I got the error with newest version. In ADO "Run extractor" task has environment variable API_MANAGEMENT_SERVICE_OUTPUT_FOLDER_PATH: $(Build.ArtifactStagingDirectory)/${{ parameters.API_MANAGEMENT_SERVICE_OUTPUT_FOLDER_PATH }} , but the extractor does not save files to ArtifactStagingDirecotry path.

Log: info: extractor[0] Extracting tags... info: extractor[0] Writing tag information file /home/vsts/work/1/s/ApiManagement/tags/Authentication/tagInformation.json...

Thus the pipeline will never publish the artifact containing extracted APIM files. The bug is not in the second stage (creating PR), but in the extractor.

jhoops88 commented 1 month ago

I think this is a workaround for the bug. I got the error with newest version. In ADO "Run extractor" task has environment variable API_MANAGEMENT_SERVICE_OUTPUT_FOLDER_PATH: $(Build.ArtifactStagingDirectory)/${{ parameters.API_MANAGEMENT_SERVICE_OUTPUT_FOLDER_PATH }}, but the extractor does not save files to ArtifactStagingDirecotry path.

Log: info: extractor[0] Extracting tags... info: extractor[0] Writing tag information file /home/vsts/work/1/s/ApiManagement/tags/Authentication/tagInformation.json...

Thus the pipeline will never publish the artifact containing extracted APIM files. The bug is not in the second stage (creating PR), but in the extractor.

Confirming this is the same bug I experienced

waelkdouh commented 1 month ago

Have you guys checked the closed issues? This has been addressed before.

SamiKorhonen commented 1 month ago

I never though this is so old and odd behaviour. Yes, the same issue is in #552. This behaviour occured to me in version v6.0.1.1 when upgrading our pipeline and never in older versions. So I though this is related to v6. To me, misleading was also that older version has private static ServiceDirectory GetServiceDirectory(IConfiguration configuration) { var directoryPath = configuration.GetValue("API_MANAGEMENT_SERVICE_OUTPUT_FOLDER_PATH"); in https://github.com/Azure/apiops/blob/v5.1.4/tools/code/extractor/Program.cs, which I never found in v6.

Thanks @jhoops88 for the workaround, I think i can live with it.

ps. Oddly changing the working directory to $(Build.ArtifactStagingDirectory) has the correct path, but using the same variable in the extractor output path has incorrect path.

jhoops88 commented 1 month ago

I never though this is so old and odd behaviour. Yes, the same issue is in #552. This behaviour occured to me in version v6.0.1.1 when upgrading our pipeline and never in older versions. So I though this is related to v6. To me, misleading was also that older version has private static ServiceDirectory GetServiceDirectory(IConfiguration configuration) { var directoryPath = configuration.GetValue("API_MANAGEMENT_SERVICE_OUTPUT_FOLDER_PATH"); in https://github.com/Azure/apiops/blob/v5.1.4/tools/code/extractor/Program.cs, which I never found in v6.

Thanks @jhoops88 for the workaround, I think i can live with it.

ps. Oddly changing the working directory to $(Build.ArtifactStagingDirectory) has the correct path, but using the same variable in the extractor output path has incorrect path.

@SamiKorhonen no problem.

I attempted to change the extractor’s output path before I found the mentioned workaround, it appeared to be ignored completely in v6.0.1.1