我正在创建一个 Jenkins 管道,它使用 CentOS 创建自己的容器,agent { dockerfile true }然后使用以下命令调用自定义脚本:
pipeline {
agent { dockerfile true }
stages {
stage('Build') {
steps {
sh 'whoami'
sh 'printenv'
sh './rpmBuild.sh'
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
然后问题是,当使用 sudo 调用任何命令失败时,它会给出sudo: unknown uid xxx: who are you?