首页 > 解决方案 > Linux VM 中的 Azure DevOps VM 规模集部署

问题描述

我正在尝试使用在 Azure DevOps Release Pipleine 中的 VM 规模集上运行自定义脚本 VM 扩展在Azure Vm 规模集中进行部署。我有一个执行部署后任务的 shell 脚本。

在发布管道中,我使用存储帐户来存档工件,并且还取消选中了Skip Archiving custom scripts。在 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

这个问题应该怎么解决?

标签: azureshelldeploymentdevopsazure-vm-scale-set

解决方案


似乎缺少 shell 执行权限

我假设您正在从我会尝试的同一个文件夹中运行 bash 脚本

chmod +rx main.sh

你可以验证权限

ls -l main.sh

推荐阅读