我正在尝试使用 Azure DevOps Release Pipleine 中的在 VM 规模集上运行自定义脚本 VM 扩展在 Azure Vm 规模集中进行部署。我有一个执行部署后任务的 shell 脚本。
在发布管道中,我使用存储帐户来存档工件,并且还取消选中跳过存档自定义脚本。在 VMSS 部署任务中,我收到以下错误:
2020-03-06T22:59:44.7864691Z ##[error]Failed to install VM custom script extension on VMSS.
Error: VM has reported a failure when processing extension 'AzureVmssDeploymentTask'.
Error message: "Enable failed: failed to execute command: command terminated with exit status=126
[stdout]
extracting archive cs.tar.gz
Invoking command: ./"main.sh"
[stderr]
./customScriptInvoker.sh: line 12: ./main.sh: Permission denied
我在规模集 vm 的 /var/lib/waagent/custom-script/download/1 目录下找到了 customScriptInvoker.sh
#!/bin/bash
if [ -n "$1" ]; then
mkdir a
echo "extracting archive $1"
tar -xzC ./a -f $1
cd ./a
fi
command=$2" "$3
echo $command
echo "Invoking command: "$command
eval $command
解决这个问题的方法是什么?
最佳答案
似乎缺少 shell 执行权限
我假设您正在从同一文件夹运行 bash 脚本 我会尝试
chmod +rx main.sh
您可以验证权限
ls -l main.sh
关于Linux VM 中的 Azure DevOps VM 规模集部署,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60573041/