无法通过管道触发来自Azure Repo的Shell脚本

发布于 2025-02-13 02:39:18 字数 826 浏览 3 评论 0原文

我在Azure存储库中已exploy.sh文件,需要从Azure Pipeline执行此Deploy.sh文件。

这是我在管道中定义的步骤。我尝试通过CMD和Bash进行两种方法,两者都没有选择Deploy.sh文件的正确位置

“在此处输入图像说明”

这是我遇到的错误:

这是CMD的错误,但是CMD即使路径不正确

“输入图像描述在这里“

这是bash

”在此处输入图像说明”

问题

如何更正路径并成功执行Deploy.sh?

I have deploy.sh file in my azure repository and i need to execute this deploy.sh file from azure pipeline.

enter image description here

Here is the steps that i defined in pipeline. I tried two ways to do it through cmd and bash, both are not picking the right location of deploy.sh file

enter image description here

Here is the error i am getting:

This is the error from CMD, but CMD shows green even though path is not correct

enter image description here

This is the error for bash

enter image description here

Question

How to correct the path and do successful execution of deploy.sh?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

少年亿悲伤 2025-02-20 02:39:18

您绝对不应硬编码管道运行的路径。相反,您应该使用预定义的变量,该变量将自动选择构建ID以及路径。对于您的情况,

$(Pipeline.Workspace)/s/Orchestration/dev/deploy.sh

如果您有多个存储库结帐,则需要使用存储库的名称,例如

$(Pipeline.Workspace)/s/dotnetpipeline/Orchestration/dev/deploy.sh

$(pipeline.workspace)/s也应由$(构建。 sourcesDirectory)

预定义的变量应遵循.yml文件上的$(var)符号

You should never hard code the path of the pipeline run. Instead you should use the predefined variables that will automatically pick the build ID and also path. For your case you will need the

$(Pipeline.Workspace)/s/Orchestration/dev/deploy.sh

If you have multiple repositories checkout you should also use the name of the repository like

$(Pipeline.Workspace)/s/dotnetpipeline/Orchestration/dev/deploy.sh

$(Pipeline.Workspace)/s should be also replaced by $(Build.SourcesDirectory)

The predefined variables should follow the $(var) notation on the .YML file

花开半夏魅人心 2025-02-20 02:39:18

这解决了我的问题

  - task: CmdLine@2
    inputs:
      script: |
        echo Write your commands here
        cd $(Build.Repository.Name)/Orchestration/dev/
        chmod +x deploy.sh
        ./deploy.sh      
        echo deploy.sh execution completed

This solved my issue

  - task: CmdLine@2
    inputs:
      script: |
        echo Write your commands here
        cd $(Build.Repository.Name)/Orchestration/dev/
        chmod +x deploy.sh
        ./deploy.sh      
        echo deploy.sh execution completed
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文