Azure devops 如何在azure Devops中从Yaml管道中的repo读取脚本文件

Azure devops 如何在azure Devops中从Yaml管道中的repo读取脚本文件,azure-devops,Azure Devops,我有一个存储库,其中有一个powershell(.ps1)文件,我想在Yaml管道的某个阶段调用该文件。我正在尝试以下方法,但得到的错误是“[error]enoint:没有这样的文件或目录,stat'/home/vsts/work/1/s/_devopscripts/ReleaseNoteScripts/abc.ps1'” 想知道调用powershell脚本的正确方法是什么 这就是我现在正在做的 name: $(SourceBranchName)_$(BuildDefinitionName)_$

我有一个存储库,其中有一个powershell(.ps1)文件,我想在Yaml管道的某个阶段调用该文件。我正在尝试以下方法,但得到的错误是“[error]enoint:没有这样的文件或目录,stat'/home/vsts/work/1/s/_devopscripts/ReleaseNoteScripts/abc.ps1'”

想知道调用powershell脚本的正确方法是什么

这就是我现在正在做的

name: $(SourceBranchName)_$(BuildDefinitionName)_$(Date:yyyyMMdd)$(Rev:.r)
trigger:
  - master

resources:
  repositories:
  - repository: DevOpsScripts
    type: git
    name: XeThru/DevOpsScripts
    trigger:
      branches:
        include:
          - master


- stage: PublishSignalFlowNotebooks
    dependsOn: SignalFlow
    jobs:
      - job: SignalFlow_ReleaseNoteBook    
        steps:
          - checkout: DevOpsScripts
          - task: PowerShell@2
            displayName: 'PowerShell Script'
            inputs:
                targetType: filePath
                filePath: $(System.DefaultWorkingDirectory)/_DevOpsScripts/ReleaseNoteScripts/abc.ps1
                arguments: '-WId $(NoteBookArtifactDirectory) -ClientID $(clientId) -ClientSecret $(clientSecret) -RDname $(Release.DefinitionName) -RName $(Release.ReleaseName) -RReqFor $(Release.RequestedFor) -RRId $(Release.ReleaseId) -NbId $(NotebookId) -SPid $(SharePointSiteID) -LibId $(LibraryID) -AzDevToken $(AzureDevOpsPersonalAccessToken)' 
调试时,我得到以下结果:

Directory: D:\a\1\s


Mode                LastWriteTime         Length Name                                                                  
----                -------------         ------ ----                                                                  
d-----        3/11/2021   6:03 PM                ReleaseNoteScripts                                                    
-a----        3/11/2021   6:03 PM           1319 README.md                                                             


    Directory: D:\a\1\s\ReleaseNoteScripts


Mode                LastWriteTime         Length Name                                                                  
----                -------------         ------ ----                                                                  
-a----        3/11/2021   6:03 PM           5341 UploadInSharePoint.ps1                                                
-a----        3/11/2021   6:03 PM          13779 abc.ps1 

添加以下步骤以调试
签出任务之后
之前的实际签出位置PowerShell@2
任务:

-pwsh:|
获取ChildItem$(System.DefaultWorkingDirectory)-递归
名称:DebugCheckout
displayName:调试脚本签出

这可能会产生大量的输出,但在签出脚本后,它会让您了解脚本的实际位置。我猜可能很简单,比如路径中不需要

调试时,我得到了文件名和位置,但不确定如何访问它。检查问题中的调试结果确定我看到我在那里添加了一个额外的文件夹。谢谢