Azure DevOps, AppCenter Distribute fails for iOS native ap - azure-devops

I am trying to publish an IPA to App Center, the YAML for my build definition is the following :
# Xcode
# Build, test, and archive an Xcode workspace on macOS.
# Add steps that install certificates, test, sign, and distribute an app, save build artifacts, and more:
# https://learn.microsoft.com/azure/devops/pipelines/languages/xcode
pool:
vmImage: 'macOS-10.13'
trigger: none
variables:
- name: SDK
value: iphoneos
- name: Configuration
value: ReleasePPD
steps:
- task: DeleteFiles#1
inputs:
SourceFolder: '$(system.defaultWorkingDirectory)'
Contents: 'AuraApp.xcworkspace'
- task: CocoaPods#0
inputs:
forceRepoUpdate: false
displayName: 'pod install using the CocoaPods task'
- task: InstallAppleCertificate#2
inputs:
certSecureFile: 'ios_distribution.p12'
- task: InstallAppleProvisioningProfile#1
inputs:
provisioningProfileLocation: 'secureFiles' # Options: secureFiles, sourceRepository
provProfileSecureFile: 'Aura_PPD_Distribution_Profile.mobileprovision'
removeProfile: true
- task: Xcode#5
inputs:
xcWorkspacePath: '$(system.defaultWorkingDirectory)/AuraApp.xcworkspace'
actions: 'build'
sdk: $(SDK)
configuration: $(Configuration)
xcodeVersion: '10' # Options: 8, 9, 10, default, specifyPath
exportPath: '$(Build.ArtifactStagingDirectory)/PPD'
packageApp: true
#exportMethod: 'package'
exportOptions: 'auto'
#exportOptionsPlist: ''
scheme: 'Aura PPD'
signingOption: manual
signingIdentity: $(APPLE_CERTIFICATE_SIGNING_IDENTITY)
provisioningProfileUuid: $(APPLE_PROV_PROFILE_UUID)
- task: AppCenterDistribute#1
inputs:
serverEndpoint: 'Azure App Center'
appSlug: aurafoundation/Aura
appFile: $(Build.ArtifactStagingDirectory)/**/*.ipa
releaseNotesOption: 'input'
releaseNotesInput: 'Test'
The Xcode build task seems to be working well :
##[debug]exec tool: /usr/bin/xcodebuild
##[debug]arguments:
##[debug] -exportArchive
##[debug] -archivePath
##[debug] /Users/vsts/agent/2.146.0/work/1/s/Aura PPD.xcarchive
##[debug] -exportPath
##[debug] /Users/vsts/agent/2.146.0/work/1/a/PPD
##[debug] -exportOptionsPlist
##[debug] _XcodeTaskExportOptions.plist
[command]/usr/bin/xcodebuild -exportArchive -archivePath /Users/vsts/agent/2.146.0/work/1/s/Aura PPD.xcarchive -exportPath /Users/vsts/agent/2.146.0/work/1/a/PPD -exportOptionsPlist _XcodeTaskExportOptions.plist | /usr/local/lib/ruby/gems/2.6.0/bin/xcpretty --no-color
2019-02-12 11:03:58.404 xcodebuild[1595:20747] [MT] IDEDistribution: -[IDEDistributionLogging _createLoggingBundleAtPath:]: Created bundle at path '/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/Aura PPD_2019-02-12_11-03-58.402.xcdistributionlogs'.
▸ Export Succeeded
##[debug]success of first tool:true
##[debug]rc:0
##[debug]success:true
##[debug]task result: Succeeded
##[debug]Processed: ##vso[task.complete result=Succeeded;]Xcode task execution completed with no errors.
##[debug]Agent.Version=2.146.0
##[debug]Processed: ##vso[telemetry.publish area=TaskHub;feature=Xcode]{"xcodeVersionSelection":"10","actions":["build"],"packageApp":true,"xcodeVersion":"10.1","signingOption":"manual","exportOptions":"auto"}
##[section]Finishing: Xcode
The resulting IPA file shoud be located in /Users/vsts/agent/2.146.0/work/1/a/PPD according to the -exportPath parameter.
BUT ! The AppCenterDistribute step fails :
##[section]Starting: AppCenterDistribute
==============================================================================
Task : App Center Distribute
Description : Distribute app builds to testers and users via App Center
Version : 1.147.0
Author : Microsoft Corporation
Help : For help with this task, visit the Visual Studio App Center [support site](https://aka.ms/appcentersupport/).
==============================================================================
##[error]Error: Cannot find any file based on /Users/vsts/agent/2.146.0/work/1/a/**/*.ipa.
##[section]Finishing: AppCenterDistribute
So the question is : where is my .ipa located ? Why can't I find my .ipa in the exportPath ?
EDIT :
I changed the exportPath parameter to specify a full path : Users/vsts/agent/2.146.0/work/1/a/PPD/Aura.ipa
Now i get another error on the AppCenter Distribute task :
##[debug]found 1 paths
##[debug]applying include pattern
##[debug]1 matches
##[debug]1 final results
##[debug]....... selectedPaths: /Users/vsts/agent/2.146.0/work/1/s
##[debug]....... uniquePaths: /Users/vsts/agent/2.146.0/work/1/s
##[debug]-- Prepare symbols
##[debug]-- Prepare for uploading release.
##[debug]---- url: https://api.appcenter.ms/v0.1/apps/aurafoundation/Aura/release_uploads
##[debug]---- "{\"upload_id\":\"a349d7a0-10f2-0137-9dfa-12f79a9ee306\",\"upload_url\":\"https://rink.hockeyapp.net/api/sonoma/apps/a761af0d-7844-46a9-bf7b-701fa1db6b9c/app_versions/upload?upload_id=a349d7a0-10f2-0137-9dfa-12f79a9ee306\"}"
##[debug]---- http call status code: 201
##[debug]-- Uploading release...
##[debug]---- url: https://rink.hockeyapp.net/api/sonoma/apps/a761af0d-7844-46a9-bf7b-701fa1db6b9c/app_versions/upload?upload_id=a349d7a0-10f2-0137-9dfa-12f79a9ee306
##[debug]---- Failed with error: Error: form-data: EISDIR: illegal operation on a directory, read
##[debug]task result: Failed
##[error]Error: form-data: EISDIR: illegal operation on a directory, read
##[debug]Processed: ##vso[task.issue type=error;]Error: form-data: EISDIR: illegal operation on a directory, read
##[debug]Processed: ##vso[task.complete result=Failed;]Error: form-data: EISDIR: illegal operation on a directory, read
##[section]Finishing: AppCenterDistribute

Related

Azure Pipeline - DevOps19 + VS22: Building Solution with two different projects

This post will be a bit longer, as I not only describe my problem, but also show my different attempts to solve the problem.
I have a solution contaning .Net-6-Web-Api-Project (csproj) and a C++/CLI-Wrapper-Project (vcxproj). I have a reference from the C#-Project to the c++-Project. I use DevOps 2019 and VS22 on my local building agent.
I'm not able to successfully run this solution through an Azure DevOps Pipeline using the task DotNetCoreCLI#2, VSBuild#1 or a custom script as a workaround for the MSBuild#1 to publish.
VSBuild
My initial approach was to simply use the VSBuild#1 task. Using this task does not allow the pipeline to start, with the following error:
##[Error 1]
No agent found in pool My_Pool which satisfies the specified demands:
agent.name -equals My_Agend_Unity_1
Cmd
msbuild
visualstudio
Agent.Version -gtVersion 2.153.1
The cause is the compatibility issue between DevOps 2019 and VS2022. The agent does not recognize VS2022 and therefore does not create system capabilities for it. Its the same issue for the MSBuild#1 and why I tried a custom script to work around, because it couldn't find MSBuild.
DotNetCoreCLI
The first error I got was:
error MSB4019: The imported project "C:\Microsoft.Cpp.Default.props" was not found. Confirm that the expression in the Import declaration "\Microsoft.Cpp.Default.props" is correct, and that the file exists on disk.
So I fixed that by adding the env variable to the task:
env:
PATH: 'C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170'
The resulting further error was:
##[error]Error: Unable to locate executable file: 'dotnet'. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also verify the file has a valid extension for an executable file.
So I tried to fix it by using the Task UseDotNet#2, even though it doesn't make sense to me. But at the end I still get an error similar to the first error.:
MSBuild version 17.3.2+561848881 for .NET
C:\agent\_work\2\s\XXX\YYY\CPPWrapper\MyProject.vcxproj : warning NU1503: Skipping restore for project "C:\agent\_work\2\s\XXX\YYY\CPPWrapper\MyProject.vcxproj". The project file may be invalid or missing targets required for restore. [C:\agent\_work\2\s\XXX\YYY\MySolution.sln]
Determining projects to restore...
"C:\agent\_work\2\s\XXX\YYY\DotNet6Project\MyProject.csproj" restored (in "2,4 sec").
C:\agent\_work\2\s\XXX\YYY\CPPWrapper\MyProject.vcxproj(21,3):error MSB4019: The imported project "C:\Microsoft.Cpp.Default.props" was not found. Confirm that the expression in the Import declaration "\Microsoft.Cpp.Default.props" is correct, and that the file exists on disk.
C:\agent\_work\2\s\XXX\YYY\CPPWrapper\MyProject.vcxproj(21,3): error MSB4019: The imported project "C:\Microsoft.Cpp.Default.props" was not found. Confirm that the expression in the Import declaration "\Microsoft.Cpp.Default.props" is correct, and that the file exists on disk.
##[error]Error: The process 'C:\agent\_work\_tool\dotnet\dotnet.exe' failed with exit code 1
##[error]Dotnet command failed with non-zero exit code on the following projects : C:\agent\_work\2\s\XXX\YYY\MySolution.sln
##[section]Finishing: Build & Publish XXX Service - DotNetCoreCLI#2
MSBuild
My last hope then was my custom script that I already use in another pipeline that accesses the same agent and uses MSBuild from VS22. This is the approach I've come furthest with, as it looks like the project builds fine, but then fails because of this error.
(ResolvePackageAssets Target) -> C:\Program Files\dotnet\sdk\7.0.101\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(267,5):
error NETSDK1064: Package "Microsoft.EntityFrameworkCore.Analyzers",
Version 6.0.4, not found. It may have been deleted after the NuGet restore.
Otherwise, the NuGet restore may have been only partially completed due to limitations on the maximum path length.
[C:\agent\_work\2\s\XXX\YYY\DotNet6Project\MyProject.csproj]
How to proceed with it, I do not know right now. I enabled already long paths via Group Policy Editor→Administrative templates→All Settings→Enable Win32 long paths.
My yaml file:
pool:
name: 'My_Pool'
demands:
- agent.name -equals My_Agent
variables:
buildPlatform: 'x64'
buildConfiguration: 'Release'
solution: '$(System.DefaultWorkingDirectory)/XXX/YYY/MySolution.sln'
DotNet6Project: '$(System.DefaultWorkingDirectory)/XXX/YYY/DotNet6Project/MyProject.csproj'
CPPWrapper: '$(System.DefaultWorkingDirectory)/XXX/YYY/CPPWrapper/MyProject.vcxproj'
steps:
- task: NuGetToolInstaller#0
displayName: 'NuGet Tool Installer - NuGetToolInstaller#0'
name: 'NuGetToolInstaller'
inputs:
versionSpec: '>=6.1.0'
- task: NuGetCommand#2
displayName: 'NuGet Restore - NuGetCommand#2'
inputs:
command: 'restore'
restoreSolution: '$(solution)'
noCache: true
- task: BatchScript#1
displayName: 'Run BatchScript to create DLLs, Libs & Header - BatchScript#1'
inputs:
filename: '$(System.DefaultWorkingDirectory)/ICP/ZZZ/build_release.bat'
env:
PATH: 'C:\Program Files\CMake\bin'
- task: PowerShell#2
displayName: 'Run Powershell Script to unpack Packages from BatchScript for ZZZWrapper - PowerShell#2'
inputs:
filePath: '$(System.DefaultWorkingDirectory)/XXX/YYY/CPPWrapper/install_ZZZ_package.ps1'
# Workaround for MSBuild#1
- script: |
#echo off
setlocal enabledelayedexpansion
for /f "usebackq tokens=*" %%i in (`"!ProgramFiles(x86)!\Microsoft Visual Studio\Installer\vswhere.exe" -latest -products * -requires Microsoft.Component.MSBuild -find MSBuild\**\Bin\MSBuild.exe`) do (set msbuild_exe=%%i)
"!msbuild_exe!" "$(solution)" /p:Configuration="$(buildConfiguration)" /p:Platform="$(buildPlatform)" /p:PackageLocation="$(build.artifactStagingDirectory)" /t:rebuild
displayName: 'Build - Script'
# ---------- VSBuild ----------------
#- task: VSBuild#1
# inputs:
# solution: '$(solution)'
# msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactStagingDirectory)"'
# platform: '$(buildPlatform)'
# configuration: '$(buildConfiguration)'
# ---------- DotNetCoreCLI ----------
#- task: UseDotNet#2
# inputs:
# packageType: 'sdk'
# version: '6.x'
#- task: DotNetCoreCLI#2
# displayName: 'Build & Publish - DotNetCoreCLI#2'
# inputs:
# command: 'publish'
# publishWebProjects: false
# projects: '$(solution)'
# arguments: '--configuration $(buildConfiguration) --output $(Build.ArtifactStagingDirectory)'
# zipAfterPublish: false
# env:
# PATH: 'C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170'
- task: PublishBuildArtifacts#1
displayName: 'Publish Build Artifacts - PublishBuildArtifacts#1'
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'XXXArtifact'
publishLocation: 'Container'
From your yaml file ,I understand you want to build a solution and then publish build artifact. Accroding the error of your described task, I would like to provide suggestions that you can check.
1 VSBuild#1
taskError information: No agent found in pool My_Pool which satisfies the specified demandsThis indicates there are no agents on your machine that meet the demand requirements. You should check whether exists the agent which name is My_Agend_Unity_1 and exists check for Cmd,msbuild,visualstudio,Agent.Version -gtVersion 2.153.1.
See more information refer to doc:pool definition
2  UseDotNet#2
There’s a warning warning NU1503: Skipping restore for project that indicates  the packages required for the project MyProject are not restored correctly. You should edit the affected project to add targets for restore.
Please refer to doc:NuGet Warning NU1503
About the error MSB4019,you should check whether the project path "C:\Microsoft.Cpp.Default.props" exists. Here’s a ticekt  similar to your issue.You can try to this workaround and see if it works.
3 MSBuild
MSBuildAbout error NETSDK1064, this error occurs when the build tools can't find a NuGet package that's needed to build a project. This is typically due to a package restore issue related to warning NU1503 inTask   UseDotNet#2`. You can refer this doc:NETSDK1064: Package not found to take some actions provided to resolve this error.

Devops Proxy Configuration for tasks, not for agent

This my scenario:
Azure DevOps Server Version Dev17.M153.3
Self-hosted Agent Agent.Version 2.177.1
Source Control Type TFVC
The Agent is working well without proxy configuration, the problem are 2 tasks it executes.
After getting the source code, the pipeline have two NuGet tasks:
First the NuGet Tool Installer task
Second the NuGet Task
I get the following error in the first task
##[debug]Agent.Version=2.177.1
##[debug]Agent.ToolsDirectory=C:\Proyectos\Agent2\_work\_tool
##[debug]isExplicit: 5.10.0
##[debug]explicit? true
##[debug]evaluating 1 versions
##[debug]matched: 5.10.0
##[debug]Querying versions list
##[debug]Agent.ProxyUrl=undefined
ERR:connect ETIMEDOUT 152.199.23.209:443
##[debug]task result: Failed
##[debug]Processed: ##vso[task.complete result=Failed;]
Then I configure these Pipeline variables
Agent.ProxyBypassList $(ProxyBypassList)
Agent.ProxyPassword $(ProxyPassword)
Agent.ProxyUrl $(ProxyUrl)
Agent.ProxyUsername $(ProxyUsername)
The values are defined in a Variable Group.
With this configuration, the task works well
##[debug]Agent.Version=2.177.1
##[debug]Agent.ToolsDirectory=C:\Proyectos\Agent2\_work\_tool
##[debug]evaluating 0 versions
##[debug]match not found
##[debug]Querying versions list
##[debug]Agent.ProxyUrl=***
##[debug]Agent.ProxyUsername=***
##[debug]Agent.ProxyPassword=***
##[debug]Agent.ProxyBypassList=***
(node:15928) Warning: Use Cipheriv for counter mode of aes-256-ctr
##[debug]evaluating 53 versions
##[debug]matched: 5.10.0
##[debug]Found the following version from the list: 5.10.0
##[debug]isExplicit: 5.10.0
##[debug]explicit? true
##[debug]Agent.Version=2.177.1
##[debug]Agent.ToolsDirectory=C:\Proyectos\Agent2\_work\_tool
##[debug]checking cache: C:\Proyectos\Agent2\_work\_tool\NuGet\5.10.0\x64
##[debug]not found
##[debug]Downloading version: 5.10.0
...
##[debug]Processed: ##vso[task.prependpath]C:\Proyectos\Agent2\_work\_tool\NuGet\5.10.0\x64
##[debug]set NuGetExeToolPath=C:\Proyectos\Agent2\_work\_tool\NuGet\5.10.0\x64\nuget.exe
##[debug]Processed: ##vso[task.setvariable variable=NuGetExeToolPath;issecret=false;]C:\Proyectos\Agent2\_work\_tool\NuGet\5.10.0\x64\nuget.exe
Then the problem is traslated to the second tasks. This is the generated YAML of the second tasks:
steps:
- task: NuGetCommand#2
displayName: 'NuGet restore packages.config'
inputs:
restoreSolution: '**/packages.config'
feedsToUse: config
nugetConfigPath: 'xxxxxxxxxx\NuGet.Config'
externalFeedCredentials: 'xxxxxxxxx Basic Authentication'
The external Feed Credentials is a Service Connection to a private feed in another DevOps collection of the same server. I have also tried using a Service Connection with a Token and getting the same result.
This is part of the log of this task
Versión de NuGet detectada: 5.10.0.7240 / 5.10.0+dca1d060f38e1e02f6bfca41e25f081f19fd534b.dca1d060f38e1e02f6bfca41e25f081f19fd534b
##[debug]Quirks for 5.10.0.7240:
##[debug] NoTfsOnPremAuthConfig
##[debug] V2CredentialProvider
##[debug]NuGet.ForceEnableCredentialProvider=undefined
##[debug]Credential provider V1 is disabled in favor of V2 plugin.
##[debug]NuGet_ForceEnableCredentialProviderV2=undefined
##[debug]NuGetTasks.IsHostedTestEnvironment=undefined
##[debug]System.ServerType=OnPremises
##[debug]V2 credential provider is enabled.
##[debug]NuGet.ForceEnableCredentialConfig=undefined
##[debug]NuGetTasks.IsHostedTestEnvironment=undefined
##[debug]System.ServerType=OnPremises
##[debug]Credential config is disabled due to on-prem quirks.
##[debug]Setting up auth
##[debug]Discovered URL prefixes: http://xxxxxxxxx:8080/tfs/xxxxxxxx/
##[debug]NuGetTasks.ExtraUrlPrefixesForTesting=undefined
##[debug]Getting credentials for local feeds
SYSTEMVSSCONNECTION exists true
##[debug]SYSTEMVSSCONNECTION exists true
##[debug]Got auth token
##[debug]externalEndpoints=bf184c95-f3f5-4dcf-be45-9aa22eba92e9
##[debug]bf184c95-f3f5-4dcf-be45-9aa22eba92e9=http://xxxxxxx:8080/tfs/xxxxxxxx/_packaging/xxxxxxxx/nuget/v3/index.json
bf184c95-f3f5-4dcf-be45-9aa22eba92e9 exists true
##[debug]bf184c95-f3f5-4dcf-be45-9aa22eba92e9 exists true
##[debug]bf184c95-f3f5-4dcf-be45-9aa22eba92e9 auth scheme = UsernamePassword
##[debug]adding password auth entry for feed http://xxxxxxxxxxx:8080/tfs/xxxxxxxxxxx/_packaging/xxxxxxxxx/nuget/v3/index.json
##[debug]Setting up sources
##[debug]selectOrConfig=config
##[debug]nugetConfigPath=C:\Proyectos\Agent2\_work\1\s\xxxxxxxx\NuGet.Config
##[debug]check path : C:\Proyectos\Agent2\_work\1\s\xxxxxxxx\NuGet.Config
##[debug]nugetConfigPath=C:\Proyectos\Agent2\_work\1\s\xxxxxxxx\NuGet.Config
##[debug]Absolute path for pathSegments: C:\Proyectos\Agent2\_work\1\s\xxxxxxxx\NuGet.Config = C:\Proyectos\Agent2\_work\1\s\xxxxxxxx\NuGet.Config
##[debug]build.sourcesDirectory=C:\Proyectos\Agent2\_work\1\s
##[debug]Absolute path for pathSegments: C:\Proyectos\Agent2\_work\1\s = C:\Proyectos\Agent2\_work\1\s
##[debug]nugetConfigPathpath supplied :true
##[debug]Agent.BuildDirectory=C:\Proyectos\Agent2\_work\1
##[debug]build.buildId=210
##[debug]No temp nuget.config auth
##[debug]ConfigFile: C:\Proyectos\Agent2\_work\1\s\xxxxxxxx\NuGet.Config
##[debug]Absolute path for pathSegments: C:\Proyectos\Agent2\_work\_tool\NuGet\5.10.0\x64\nuget.exe = C:\Proyectos\Agent2\_work\_tool\NuGet\5.10.0\x64\nuget.exe
##[debug]which 'C:\Proyectos\Agent2\_work\_tool\NuGet\5.10.0\x64\nuget.exe'
##[debug]found: 'C:\Proyectos\Agent2\_work\_tool\NuGet\5.10.0\x64\nuget.exe'
##[debug]which 'C:\Proyectos\Agent2\_work\_tool\NuGet\5.10.0\x64\nuget.exe'
##[debug]found: 'C:\Proyectos\Agent2\_work\_tool\NuGet\5.10.0\x64\nuget.exe'
##[debug]C:\Proyectos\Agent2\_work\_tool\NuGet\5.10.0\x64\nuget.exe arg: restore
##[debug]C:\Proyectos\Agent2\_work\_tool\NuGet\5.10.0\x64\nuget.exe arg: C:\Proyectos\Agent2\_work\1\s\xxxxxxxx\xxxxxxxx\packages.config
##[debug]C:\Proyectos\Agent2\_work\_tool\NuGet\5.10.0\x64\nuget.exe arg: -Verbosity
##[debug]C:\Proyectos\Agent2\_work\_tool\NuGet\5.10.0\x64\nuget.exe arg: Detailed
##[debug]C:\Proyectos\Agent2\_work\_tool\NuGet\5.10.0\x64\nuget.exe arg: -NonInteractive
##[debug]C:\Proyectos\Agent2\_work\_tool\NuGet\5.10.0\x64\nuget.exe arg: -ConfigFile
##[debug]C:\Proyectos\Agent2\_work\_tool\NuGet\5.10.0\x64\nuget.exe arg: C:\Proyectos\Agent2\_work\1\s\xxxxxxxx\NuGet.Config
##[debug]Agent.TempDirectory=C:\Proyectos\Agent2\_work\_temp
##[debug]NUGET_PLUGINS_CACHE_PATH set to C:\Proyectos\Agent2\_work\_temp\NuGetPluginsCache
##[debug]V2 credential provider set
##[debug]credProviderPath = C:\Proyectos\Agent2\_work\_tasks\NuGetCommand_333b11bd-d341-40d9-afcf-b32d5ce6f23b\2.153.2\CredentialProviderV2\plugins\netfx\CredentialProvider.Microsoft\CredentialProvider.Microsoft.exe
##[debug]Detected external credentials for:
##[debug]http://xxxxxxxx:8080/tfs/xxxxxxxx/_packaging/xxxxxxxx/nuget/v3/index.json
##[debug]agent.proxyurl=***
##[debug]agent.proxyusername=***
##[debug]agent.proxypassword=***
##[debug]Adding environment variable for NuGet proxy: http://***:***#yyyyyyyyyyy:8080/
##[debug]Agent.ProxyBypassList=***
##[debug]Getting sources from NuGet.config in this location: C:\Proyectos\Agent2\_work\1\s\xxxxxxxx\NuGet.Config
##[debug]Adding environment variable for NuGet proxy bypass: xxxxxxxx
##[debug]exec tool: C:\Proyectos\Agent2\_work\_tool\NuGet\5.10.0\x64\nuget.exe
##[debug]arguments:
##[debug] restore
##[debug] C:\Proyectos\Agent2\_work\1\s\xxxxxxxx\xxxxxxxx\packages.config
##[debug] -Verbosity
##[debug] Detailed
##[debug] -NonInteractive
##[debug] -ConfigFile
##[debug] C:\Proyectos\Agent2\_work\1\s\xxxxxxxx\NuGet.Config
[command]C:\Proyectos\Agent2\_work\_tool\NuGet\5.10.0\x64\nuget.exe restore C:\Proyectos\Agent2\_work\1\s\xxxxxxxx\xxxxxxxx\packages.config -Verbosity Detailed -NonInteractive -ConfigFile C:\Proyectos\Agent2\_work\1\s\xxxxxxxx\NuGet.Config
##[debug]Re-evaluate condition on job cancellation for step: 'NuGet restore packages.config'.
##[error]The operation was canceled.
The task hangs and I must cancel it.
Could you help me to find what I missing or doing wrong?
I found the right process to get it working properly.
Install the agent.
Create a file named .proxybypass including the URLs to bypass the proxy in the agent directory:
I use the command echo *urltobypass* > .proxybypass
Configure the agent with proxy parameters configuration:
.\config.cmd --proxyurl *YourProxyUrl* --proxyusername *YourProxyUser* --proxypassword *YourProxyPassword*
With these steps to configure the agent the tasks execute properly.
Run a self-hosted agent behind a web proxy

Packages failed to publish due to TypeError: Cannot read property 'toLowerCase' of null

In my azure devops pipeline. A conda package is build firstly and published via UniversalPackages#0 task.
The build and upload code snippet is shown below
- stage: build_upload_package
displayName: Build and upload package
pool:
name: Private Agent Eve
jobs:
- job: build_upload_package
displayName: Build and Upload Package
condition: and(succeeded(), eq(variables['build.sourceBranch'], 'refs/heads/release'))
container:
image: <azureacr_repo.io>/conda:latest //modified to remove the information
endpoint: NameOfTheServiceConnection //modified to remove the information
steps:
- bash: |
echo "##vso[task.prependpath]$CONDA/bin"
conda build . --output-folder $(Build.ArtifactStagingDirectory)
displayName: Build Package
- bash: echo "##vso[task.setvariable variable=packageName]$(basename $(gitRepoName))"
displayName: Set Package Name
- task: UniversalPackages#0 //Error appears here
displayName: Upload to Azure Universal Packages
inputs:
command: publish
publishDirectory: '$(Build.ArtifactStagingDirectory)'
vstsFeedPublish: 'project_1/feed_1' //modified to remove the information
vstsFeedPackagePublish: '$(packageName)'
versionOption: patch
packagePublishDescription: 'upload a Conda Package'
The error for Universal UniversalPackages task is show below
2020-11-24T17:54:48.9628862Z ##[section]Starting: Upload to Azure Universal Packages
2020-11-24T17:54:48.9645737Z ==============================================================================
2020-11-24T17:54:48.9646470Z Task : Universal packages
2020-11-24T17:54:48.9647068Z Description : Download or publish Universal Packages
2020-11-24T17:54:48.9647636Z Version : 0.175.0
2020-11-24T17:54:48.9648154Z Author : Microsoft Corporation
2020-11-24T17:54:48.9648809Z Help : https://learn.microsoft.com/azure/devops/pipelines/tasks
2020-11-24T17:54:48.9649526Z ==============================================================================
2020-11-24T17:54:49.4896147Z SYSTEMVSSCONNECTION exists true
2020-11-24T17:54:50.1267511Z Downloading: https://08wvsblobprodsu6weus73.vsblob.vsassets.io/artifacttool/artifacttool-linux-x64-Release_0.2.172.zip?sv=2019-02-02&sr=b&sig=FvnCFjIg7ZBmIapFcCcWDC1%2F7pajvzvgo0fR2Y3YYeU%3D&spr=https&se=2020-11-24T18%3A54%3A51Z&sp=r&P1=1606243791&P2=11&P3=2&P4=1nPT99OOlNXc9xNzoCS6LpVATo%2bW4fIskTJ8u6olWMk%3d
2020-11-24T17:54:56.4979070Z Caching tool: ArtifactTool 0.2.172 x64
2020-11-24T17:54:56.7183832Z SYSTEMVSSCONNECTION exists true
2020-11-24T17:54:58.7313555Z ##[error]TypeError: Cannot read property 'toLowerCase' of null
2020-11-24T17:54:58.7323845Z ##[error]Packages failed to publish
2020-11-24T17:54:58.7641267Z ##[section]Finishing: Upload to Azure Universal Packages
Question:
How can I solve this issue?
I think I found the error, gitRepoName is a template parameter, it should be accessed as ${{ gitRepoName }} not the $(gitRepoName)
I did some tests on this task:UniversalPackages#0. I noticed the following reminder in the task:
Universal package names must be one or more lowercase alphanumeric segments separated by a dash, dot or underscore. The package name must be under 256 characters.
When your packageName contains capital letters or other special characters, this task will fail.
You could try the following scripts:
- task: PowerShell#2
inputs:
targetType: 'inline'
script: |
$name = $(basename $(gitRepoName)).ToLower()
Write-Host "##vso[task.setvariable variable=packageName]$name"
- task: UniversalPackages#0
inputs:
command: 'publish'
publishDirectory: '$(Build.ArtifactStagingDirectory)'
vstsFeedPublish: 'project_1/feed_1'
vstsFeedPackagePublish: '$(packageName)'
versionOption: 'patch'
The Powershell task could Lowercase the RepoName.

How to debug Azure DevOps task PublishPipelineArtifact when one or more errors occurred

I'm trying to build a pipeline that will 1. produce a file (jar) and 2. build a a Docker image with the output of the first job. Following this article's example approach, I understand can't use the first stage to build the Docker image because the Maven container I'm building inside doesn't have the docker engine. Thus, I've set up a second job, but this means the build context isn't shared. Hence, I'm trying to use the PublishPipelineArtifact task (publish step) to then retrieve with the DownloadPipelineArtifact (Download step) but get the following failure (System.Debug is true). Have verified proxy is not blocking but don't really know how to proceed with debugging because the task appears to time out.
##[debug]Evaluating condition for step: 'PublishPipelineArtifact'
##[debug]Evaluating: SucceededNode()
##[debug]Evaluating SucceededNode:
##[debug]=> True
##[debug]Result: True
Starting: PublishPipelineArtifact
==============================================================================
Task : Publish pipeline artifact
Description : Publish (upload) a file or directory as a named artifact for the current run
Version : 1.2.0
Author : Microsoft Corporation
Help : https://learn.microsoft.com/azure/devops/pipelines/tasks/utility/publish-pipeline-artifact
==============================================================================
Artifact name input: sampleTextFile
Uploading pipeline artifact from /home/mt/vsts/_work/45/s/publish-build-artifact/test.txt for build #11684
##[debug]Dedup parallelism: 192
##[error]One or more errors occurred. (A task was canceled.)
##[debug]Processed: ##vso[task.logissue type=error;]One or more errors occurred. (A task was canceled.)
##[debug]Processed: ##vso[task.complete result=Failed;]
##[debug] at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
at Microsoft.VisualStudio.Services.BlobStore.Common.Telemetry.BlobStoreApplicationInsightsTelemetrySender..ctor(IAppTraceSource tracer, Uri baseAddress)
at Agent.Plugins.PipelineArtifact.DedupManifestArtifactClientFactory.CreateDedupManifestClient(AgentTaskPluginExecutionContext context, VssConnection connection, CancellationToken cancellationToken, BlobStoreClientTelemetry& telemetry)
at Agent.Plugins.PipelineArtifact.PipelineArtifactServer.UploadAsync(AgentTaskPluginExecutionContext context, Guid projectId, Int32 pipelineId, String name, String source, CancellationToken cancellationToken)
at Agent.Plugins.PipelineArtifact.PublishPipelineArtifactTaskV1.ProcessCommandInternalAsync(AgentTaskPluginExecutionContext context, CancellationToken token)
at Agent.PluginHost.Program.Main(String[] args)
Finishing: PublishPipelineArtifact
Minimal pipeline config file I'm using (stripped out Java build and Docker build steps):
trigger:
- master
stages:
- stage: Build
jobs:
- job: FirstJob
pool:
name: my-pool
demands:
- docker
container:
image: 'maven:latest'
steps:
- publish: $(System.DefaultWorkingDirectory)/publish-build-artifact/test.txt
artifact: sampleTextFile
- job: SecondJob
dependsOn: FirstJob
condition: succeeded()
pool:
name: my-pool
demands:
- docker
steps:
- download: current
artifact: sampleTextFile
Should have been using PublishBuildArtifacts task instead of PublishPipelineArtifact
task.

Azure Devops : Build a winforms project and copy release files to Azure blob storage

I want to set up CI CD for a winforms project Dot Net Framework 4.5.2 to build the project and then copy the release files to an Azure blob.
When I create a new build pipeline and select my Azure Repo the following YAML is created
# .NET Desktop
# Build and run tests for .NET Desktop or Windows classic desktop solutions.
# Add steps that publish symbols, save build artifacts, and more:
# https://learn.microsoft.com/azure/devops/pipelines/apps/windows/dot-net
trigger:
- master
pool:
vmImage: 'VS2017-Win2016'
variables:
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
steps:
- task: NuGetToolInstaller#0
- task: NuGetCommand#2
displayName: 'NuGet restore'
inputs:
restoreSolution: '**\*.sln'
feedsToUse: config
nugetConfigPath: 'NuGet.config'
- task: VSBuild#1
inputs:
solution: '$(solution)'
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
The pipeline builds successfully
However I am having trouble setting up the Release pipeline to copy the release files to Azure blob storage.
I created a new release pipeline with an Empty Job.
Then I added an Azure File Copy Task
What do I put as the source ?
When I click the elipse I see I can select a myapp (Build) folder from within a Linked artifacts folder.
I was able to set up the storage and container names , but left the Blob Prefix blank.
When I run the Agent job I get an error on AzureBlob File Copy
(edited)
##[section]Starting: AzureBlob File Copy
==============================================================================
Task : Azure File Copy
Description : Copy files to Azure blob or VM(s)
Version : 2.1.3
Author : Microsoft Corporation
Help : [More Information](https://aka.ms/azurefilecopyreadme)
==============================================================================
##[command]Import-Module -Name C:\Program Files\WindowsPowerShell\Modules\AzureRM\2.1.0\AzureRM.psd1 -Global
##[warning]The names of some imported commands from the module 'AzureRM.Websites' include unapproved verbs that might make them less discoverable. To find the commands with unapproved verbs, run the Import-Module command again with the Verbose parameter. For a list of approved verbs, type Get-Verb.
##[command]Import-Module -Name C:\Program Files\WindowsPowerShell\Modules\AzureRM.Profile\2.1.0\AzureRM.Profile.psm1 -Global
##[command]Add-AzureRMAccount -ServicePrincipal -Tenant *** -Credential System.Management.Automation.PSCredential -EnvironmentName AzureCloud #processScope
##[command] Select-AzureRMSubscription -SubscriptionId blahblah -TenantId ***
Uploading files from source path: 'd:\a\r1\a\_Viv2' to storage account: 'viv' in container: 'viv2' with blob prefix: ''
##[command] & "AzCopy\AzCopy.exe" /Source:"d:\a\r1\a\_Viv2" /Dest:"https://vivapps.blob.core.windows.net/viv2" /#:"d:\a\_temp\n40zblahblah" /XO /Y /SetContentType /Z:"AzCopy" /V:"AzCopy\AzCopyVerbose_20blahblah.log" /S
[2019/02/13 01:26:46][ERROR] Error parsing source location "d:\a\r1\a\_Viv2": Failed to enumerate directory d:\a\r1\a\_Viv2\ with file pattern *. The system cannot find the path specified. (Exception from HRESULT: 0x80070003) For more details, please type "AzCopy /?:Source" or use verbose option /V.
##[error]Upload to container: 'vivj2' in storage account: 'vivapps' with blob prefix: '' failed with error: 'AzCopy.exe exited with non-zero exit code while uploading files to blob storage.' For more info please refer to https://aka.ms/azurefilecopyreadme
##[section]Finishing: AzureBlob File Copy
[Update]
I think the issue must be to do with the Source
looking at the build logs I see path names like "D:\a\1\s\blahblah"
I also see
creating bin\Release
but how do I figure out what I should be putting in the Source property ?
Trying
$(System.DefaultWorkingDirectory)/_Viv2/bin/Release
No joy.
Exception from HRESULT: 0x80070003 means the system cannot find the file specified.
[Update]
The default YAML created does not included a task to publish the build "Artifacts" (Not to be confused with the Project Artifacts )
I tried adding one
- task: PublishBuildArtifacts#1
displayName: 'Publish Artifact: drop'
inputs:
PathtoPublish: '$(build.artifactstagingdirectory)'
artifactName: drop
but the task log says
##[warning]Directory 'D:\a\1\a' is empty. Nothing will be added to build artifact 'drop'
Please have a try to append the copy file and publish Build Artifacts task after VS build task in the build pipeline.
In the build pipeline:
...
- task: VSBuild#1
inputs:
solution: '$(solution)'
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
- task: CopyFiles#2
displayName: 'Copy Files'
inputs:
SourceFolder: '$(build.sourcesdirectory)'
TargetFolder: '$(build.artifactstagingdirectory)'
- task: PublishBuildArtifacts#1
displayName: 'Publish Artifact: drop'
In the release pipeline:
Azure copy file source should be
$(System.DefaultWorkingDirectory)/{Source alias}/drop/xx/xxx/bin/Release
We could get source alias from this screenshot
After we build successfully then we could choose the source path.
It works correctly on my side, I check it from the release log and azure storage container