programing

Azure 파이프라인에서 현재 작업 디렉토리 변경

kakaobank 2023. 4. 27. 22:37
반응형

Azure 파이프라인에서 현재 작업 디렉토리 변경

는 Azure Pipeline(https://github.com/scikit-image/scikit-image/blob/azure-pipelines/azure-pipelines.yml) 에서 Python용 CI 패키지를 개발하고 있습니다.어느 시점에서 소스 코드 디렉토리에서 벗어나야 합니다.pytest이 패키지의 설치를 검색하고 해당 테스트를 실행합니다.

제가 직면하고 있는 문제는 이 사건이cd,cd C:etc 명령은 영향을 미치지 않는 것으로 보여 현재 작업 디렉터리는 변경되지 않습니다(이 특정한 경우,D:\a\1\s).

설명된 한계를 극복할 수 있는 방법이 있습니까?

솔루션을 찾는 데 많은 시간이 걸렸지만 특정 스크립트에 대한 작업 디렉터리를 지정하는 방법이 있습니다. https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/utility/command-line?view=vsts&tabs=yaml :

- script: # script path or inline
  workingDirectory: #
  displayName: #
  failOnStderr: #
  env:  # mapping of environment variables to add

Azure devops의 디렉터리 위치를 아는 간단한 솔루션 :-

- task: CmdLine@2
  inputs:
    script: |
      echo  '$(System.DefaultWorkingDirectory)'
      dir
      dir subfoldername

여기서 시스템을 사용하여 명령줄을 호출하고 현재 경로를 가져와야 합니다.DefaultWorkingDirectory 및 dir는 모든 폴더와 파일을 나열하고 dir 하위 폴더 이름을 사용하여 하위 폴더로 이동할 수 있습니다.

언급URL : https://stackoverflow.com/questions/53857085/change-current-working-directory-in-azure-pipelines

반응형