azure - Azure DevOps 工件目录问题
问题描述
当我尝试使用 Azure DevOps 管道运行 Powershell 脚本时,出现错误“ENOENT: no such file or directory, stat '/azp/agent/_work/1/a/repo1/folder1/Powershell-newscript.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'
能否请你帮忙?谢谢!
解决方案
如果您想使用来自特定构建的 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'
推荐阅读
- c - 如何让编译器警告我缺少返回值?
- python - 在 Django 中为新帖子保存 category_id
- android - 第二个活动的 Anko 布局未显示
- automation - 尝试使用 autohotkey 对本地 html 文件执行某些处理时出现“rpc 服务器不可用”
- javascript - React-Native & Redux “动作必须是普通对象。为异步函数使用自定义中间件”
- javascript - 下一个图像功能在调用时不显示
- node.js - ionic 3 中的 socket.io 客户端不工作?
- python - python f'string 在 pd.Series.map 函数中不起作用
- php - 无法在后端设计配置中更改 magento2 主题
- windows - Windows 命令行:在新的控制台窗口中执行 .bat 文件