Linux VM 中的 Azure DevOps VM 规模集部署

标签 azure shell deployment devops azure-vm-scale-set

我正在尝试使用 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/

相关文章:

python - Azure Python SDK : 'ServicePrincipalCredentials' object has no attribute 'get_token'

参数中的 Azure DevOps 条件

c# - 在 Visual Studio 2012 中发布时为 "target location"设置默认文件夹

azure - 在 Cosmos DB 中,异地复制如何影响写入的 RU 消耗?

Git 预提交钩子(Hook)在文件中查找文本

regex - 在没有 Bashisms 的情况下检查 Shell 中的子字符串

android - 尝试在 Xperia E C1504 上打开/dev/radio0 返回 EBUSY

grails - 在tomcat 6.0.28上部署应用程序时出现问题

.net - 嵌入Python脚本

sql - 如何隔离不同客户的SQL数据?