【问题标题】:Azure DevOps artifact directory issueAzure DevOps 工件目录问题
【发布时间】:2021-10-17 07:49:05
【问题描述】:

当我尝试使用 Azure DevOps 管道运行 Powershell 脚本时,我收到错误消息“ENOENT: no such file or directory, stat '/azp/agent/_work/1/a/repo1/folder1/Powershell-新脚本.ps1

日志文件提示该文件位于:/azp/agent/_work/1/s/repo1/folder1/Powershell-newscript.ps1

如何将此文件从“s”移动到“a”? /azp/agent/_work/1/s 到 /azp/agent/_work/1/a

   - checkout: self
   - checkout: IAC

      - task: CopyFiles@2
        inputs:
          targetFolder: '$(Build.ArtifactStagingDirectory)'

      - task: PublishBuildArtifacts@1
        displayName: 'Building Artifact now'
        inputs:
          pathToPublish: '$(Build.ArtifactStagingDirectory)'
          artifactName: 'drop-self'

   steps:
      - task: DownloadBuildArtifacts@0
        inputs:
          artifactName: 'drop-self'
          downloadPath: '$(System.ArtifactsDirectory)'
     

      - task: AzurePowerShell@5
        inputs:
          azureSubscription: ${{parameters.subName}}
          ScriptType: 'FilePath'
          ScriptPath: '$(System.ArtifactsDirectory)/repo1/folder1/Powershell-newscript.ps1'
          azurePowerShellVersion: 'LatestVersion'

你能帮忙吗?谢谢!

【问题讨论】:

    标签: azure azure-devops


    【解决方案1】:

    如果您想使用来自特定构建的 Artifacts,您需要引用发布管道中的文件路径,如下所示:'$(Pipeline.Workspace)/{DefinedNameofCIPipelineInReleaseFile}/{NameOfArtifacts}/{URL}*。 ps1'

    resources:
     pipelines:
      - pipeline: CI
        source: 'build-pipeline-CI'
    
    steps:
     - task: AzurePowerShell@5
       inputs:
         azureSubscription: ${{parameters.subName}}
         ScriptType: 'FilePath'
         ScriptPath: '$(Pipeline.Workspace)/CI/drop-self/folder1/Powershellnewscript.ps1'
         azurePowerShellVersion: 'LatestVersion'
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-12-07
      • 2021-12-29
      • 2019-08-04
      • 2022-01-20
      • 1970-01-01
      • 2021-05-27
      • 1970-01-01
      • 2019-08-09
      相关资源
      最近更新 更多