Ubuntu Slave/Node 用戶權限更換後不生效的問題
一句話總結:Ubuntu Slave/Node ,在宿主機上更改了用戶權限,必須停止 Stop/Shutdown + 啓動 Start(重啓 Restart 不生效!) Jenkins Master 用戶權限更換才能生效
相關鏈接:https://stackoverflow.com/questions/52217962/jenkins-permission-denied-on-shell-execute
通過 Jenkins pipeline 中 agent 使用docker node時默認無root權限問題
一句話總結:通過參數指定使用特定賬戶登錄 docker 容器
原因:Docker Jenkins Plugin 啓動容器時會通過 -u 參數隨機指定一個賬戶(默認無root權限)
解決方案:通過 args 指定 root 用戶,即可獲取 root 權限
agent {
docker {
image 'ubuntu'
args '-u root:root'
}
}
相關鏈接:https://stackoverflow.com/questions/44791060/run-jenkins-pipeline-agent-with-sudo