首页 > 解决方案 > 无法从 AzureDevops 管道运行 shell 脚本

问题描述

我是 AzureDevops 管道的新手。我有一个简单的任务,我想运行一个位于我的 azure git repo 中的 shell 脚本。

    steps:
- task: Bash@3
  inputs:
    targetType: 'inline' # Optional. Options: filePath, inline
    #filePath: ./TestProject
    #arguments: # Optional

- script: 
    pwd
    set +x token.sh
    sh token.sh

构建正在成功,但我没有看到它选择了 sh 文件:

Generating script.


10(node:3269) Warning: Use Cipheriv for counter mode of aes-256-ctr


11(node:3269) Warning: Use Cipheriv for counter mode of aes-256-ctr


12(node:3269) Warning: Use Cipheriv for counter mode of aes-256-ctr


13Script contents:


14pwd set +x token.sh sh token.sh


15(node:3269) Warning: Use Cipheriv for counter mode of aes-256-ctr


16========================== Starting Command Output ===========================


17(node:3269) Warning: Use Cipheriv for counter mode of aes-256-ctr


18(node:3269) Warning: Use Cipheriv for counter mode of aes-256-ctr


19(node:3269) Warning: Use Cipheriv for counter mode of aes-256-ctr


20/bin/bash --noprofile --norc /home/vsts/work/_temp/33bdee3d-19de-47b6-8eab-01124cb0a0ed.sh


21/home/vsts/work/1/s


22Finishing: CmdLine

构建成功但没有 sh 执行的日志。

标签: azureshellazure-devopsazure-pipelines

解决方案


我用一个简单的.sh文件示例在三个任务(命令行、Shell Exec、Bash)中对其进行了测试,在这些任务中一切正常,sh 文件正常执行。

在此处输入图像描述 在此处输入图像描述

那么您可以分享token.sh示例文件以进行进一步调查吗?如有任何个人隐私信息,请妥善保护。


推荐阅读