Created a self-hosted agent on a on-prem server which is up and running on Azure. Added pool info to azure_pipelines.yml
pool:
name: TestPool
demands:
- agent.name -equals Test_Agent_01
running the pipeline throws the error for below tasks in yml file
- task: UsePythonVersion@0
inputs:
versionSpec: '3.x'
addToPath: true
architecture: 'x64'
displayName: 'Use Python 3.x'
and
- task: DownloadPackage@1
inputs:
packageType: 'pypi'
feed: 'feedid'
view: 'viewid'
definition: 'defid'
version: '0.0.2'
downloadPath: '$(Build.SourcesDirectory)'
Error While running the pipeline
Starting: Use Python 3.x
==============================================================================
Task : Use Python version
Description : Use the specified version of Python from the tool cache, optionally adding it to the PATH
Version : 0.220.0
Author : Microsoft Corporation
Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/tool/use-python-version
==============================================================================
node:internal/fs/utils:347
throw err;
^
Error: EPERM: operation not permitted, lstat 'path'
at Object.realpathSync (node:fs:2538:7)
at toRealPath (node:internal/modules/cjs/loader:405:13)
at Function.Module._findPath (node:internal/modules/cjs/loader:548:24)
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:942:27)
at Function.Module._load (node:internal/modules/cjs/loader:804:27)
at Module.require (node:internal/modules/cjs/loader:1028:19)
at Module._preloadModules (node:internal/modules/cjs/loader:1303:12)
at loadPreloadModules (node:internal/bootstrap/pre_execution:583:5)
at prepareMainThreadExecution (node:internal/bootstrap/pre_execution:95:3)
at node:internal/main/run_main_module:7:1 {
errno: -4048,
syscall: 'lstat',
code: 'EPERM',
path: 'path'
}
##[error]Exit code 1 returned from process: file name "filename' arguments 'arguments'
Can I know what is the possible configuration or permissions missing here?
I tried downloading python feed packages in my yaml pipeline with self hosted agent and it was successful, Refer below:-
I created one python package and pushed it in my feed by referring this Document
Click on get tools and install python and this package in your local machine where your package exist or in your self hosted machine:-
Create .pypirc file by running this command in your terminal:-
My .pypirc
And refer the steps below to publish the package in the Azure Devops artifact:-
Now, Run the yaml script below, Make sure you select the correct parameters like below:-
There's a limitation on using Use Python version task in Azure Devops pipeline for self hosted agents, Refer here and the prerequisite which states:-
On self-hosted agents, downloading Python versions is not supported. If no Python versions are identified in Agent, this task will fail if no specified python version is found in Agents.ToolsDirectory. Self hosted agent needs to be configured with Agents.ToolsDirectory.
An alternative is to add the python executable with your script as given in this SO thread answer by Levi Lu-MSFT