我正在為 ec2 影像構建器組件撰寫 terraform 代碼。并得到這樣的錯誤:
CmdExecution: Stderr: which: no sw_vers in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin)
sudo: unknown user: mkdir
sudo: unable to initialize policy plugin
代碼如下所示:
"phases":
- "name": "build"
"steps":
- "action": "ExecuteBash"
"inputs":
"commands":
- "export RUNNER_ALLOW_RUNASROOT='1'"
- "yum install -y jq"
- "export RUNNER_CFG_PAT=ghp_fsdfsdfsdfsdfsdfsdfsdfd"
- "curl -s https://raw.githubusercontent.com/actions/runner/main/scripts/create-latest-svc.sh
| bash -s -- -s githubuser/githubrepo -n githubrunner -l prod"
"name": "example"
"onFailure": "Continue"
"schemaVersion": 1
以前我認為這是因為 root 用戶執行所以我添加了這一行:
"export RUNNER_ALLOW_RUNASROOT='1'"
但是事件雖然不起作用你有一些想法如何解決這個問題嗎
PS。地形代碼:
resource "aws_imagebuilder_component" "example" {
data = yamlencode({
phases = [{
name = "build"
steps = [{
action = "ExecuteBash"
inputs = {
commands = ["export RUNNER_ALLOW_RUNASROOT='1'", "yum install -y jq", "export RUNNER_CFG_PAT=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", "curl -s https://raw.githubusercontent.com/actions/runner/main/scripts/create-latest-svc.sh | bash -s -- -s githubuser/githubrepo -n githubrunner -l prod"]
}
name = "example"
onFailure = "Continue"
}]
}]
schemaVersion = 1.0
})
name = "example33"
platform = "Linux"
version = "1.0.0"
}
uj5u.com熱心網友回復:
我對 terraform 了解不多,但是查看您的代碼,您似乎錯過svc_user了腳本用來執行各種操作的初始化,例如創建一個曾經失敗的目錄,并且該目錄sv_user為“null”。它將sudo -u ${svc_user} mkdir runner作為sudo -u mkdir runneruser 的意義運行mkdir。看來您現在正在通過root,svc_user這已經解決了您的問題。
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/449820.html
標籤:亚马逊网络服务 github 亚马逊-ec2 github-动作
