Home > Enterprise >  How to call repo path in azure devops pipline for py script
How to call repo path in azure devops pipline for py script

Time:11-11

I have python script stored on my repo and i'm trying to create pipeline to run it. I have no idea how to ptovide correct path to the repo where it is stored. I receive no such file or directory, stat '/home/vsts/work/1/s/vg/main.py'

repo: vg

yaml:

steps:
- task: PythonScript@0
  inputs:
    scriptSource: 'filePath' # Options: filePath, inline
    scriptPath: $(Build.SourcesDirectory)/vg/main.py # Required when scriptSource == filePath
    #script: # Required when scriptSource == inline
    arguments: $(file_path) $(pat) $(organization) $(project) $(vg_name)
    #pythonInterpreter: # Optional
    #workingDirectory: # Optional
    #failOnStderr: false # Optional
- bash: python $(Build.SourcesDirectory)/vg/main.py
- script: python $(Build.SourcesDirectory)/poc/main.py

CodePudding user response:

If this is your only repo it is downloaded directly to source folder so your script should be here $(Build.SourcesDirectory)/main.py

Please check this checkout path section to understand how and where source code is downloaded.

  • Related