Share via


PythonScript@0 - Python 스크립트 v0 작업

이 작업을 사용하여 Python 파일 또는 인라인 스크립트를 실행합니다.

Syntax

# Python script v0
# Run a Python file or inline script.
- task: PythonScript@0
  inputs:
    scriptSource: 'filePath' # 'filePath' | 'inline'. Required. Script source. Default: filePath.
    scriptPath: # string. Required when scriptSource = filePath. Script path. 
    #script: # string. Required when scriptSource = inline. Script. 
    #arguments: # string. Arguments. 
  # Advanced
    #pythonInterpreter: # string. Python interpreter. 
    #workingDirectory: # string. Working directory. 
    #failOnStderr: false # boolean. Fail on standard error. Default: false.
# Python Script v0
# Run a Python script.
- task: PythonScript@0
  inputs:
    scriptSource: 'filePath' # 'filePath' | 'inline'. Required. Script source. Default: filePath.
    scriptPath: # string. Required when scriptSource = filePath. Script path. 
    #script: # string. Required when scriptSource = inline. Script. 
    #arguments: # string. Arguments. 
  # Advanced
    #pythonInterpreter: # string. Python interpreter. 
    #workingDirectory: # string. Working directory. 
    #failOnStderr: false # boolean. Fail on standard error. Default: false.

입력

scriptSource - 스크립트 원본
string. 필수 요소. 허용되는 값: filePath (파일 경로), inline. 기본값은 filePath입니다.

스크립트가 원본 트리의 파일인지 아니면 이 작업에서 인라인으로 작성되었는지 여부를 지정합니다.


scriptPath - 스크립트 경로
string. 필요한 경우 scriptSource = filePath입니다.

실행할 스크립트의 경로를 지정합니다. 정규화된 경로이거나 에 상대적이어야 합니다 $(System.DefaultWorkingDirectory).


script - 스크립트
string. 필요한 경우 scriptSource = inline입니다.

실행할 Python 스크립트를 지정합니다.


arguments - 인수
string.

를 통해 sys.argv사용할 수 있는 스크립트 실행에 전달된 인수를 명령줄에 전달한 것처럼 지정합니다.


pythonInterpreter - Python 인터프리터
string.

사용할 Python 인터프리터의 절대 경로를 지정합니다. 지정하지 않으면 작업은 PATH에서 인터프리터를 사용합니다.
Python 버전 사용 태스크를 실행하여 PATH에 Python 버전을 추가합니다.


workingDirectory - 작업 디렉터리
string.

스크립트가 실행될 작업 디렉터리를 지정합니다. 지정하지 않으면 값 System.DefaultWorkingDirectory 이 사용됩니다. 빌드의 경우 이 변수는 기본적으로 리포지토리의 루트로 설정됩니다. 릴리스의 경우 기본적으로 아티팩트 디렉터리의 루트로 설정됩니다.


failOnStderr - 표준 오류 발생 시 실패
boolean. 기본값은 false입니다.

로 설정하면 스트림에 true텍스트가 기록 stderr 되면 이 작업이 실패합니다.


작업 제어 옵션

모든 작업에는 작업 입력 외에 제어 옵션이 있습니다. 자세한 내용은 컨트롤 옵션 및 일반적인 작업 속성을 참조하세요.

출력 변수

없음

설명

기본적으로 이 작업은 시스템 경로에서 호출 python 됩니다. Python 버전 사용을 실행하여 원하는 버전을 시스템 경로에 넣습니다.

요구 사항

요구 사항 Description
파이프라인 유형 YAML, 클래식 빌드, 클래식 릴리스
실행 중 에이전트, DeploymentGroup
요청 없음
Capabilities 이 작업은 작업의 후속 작업에 대한 요구 사항을 충족하지 않습니다.
명령 제한 사항 모두
설정 가능한 변수 모두
에이전트 버전 지원되는 모든 에이전트 버전.
작업 범주 유틸리티