• DevOps
  • 流水线执行命令时报错

创建部署问题时,请参考下面模板,你提供的信息越多,越容易及时获得解答。如果未按模板创建问题,管理员有权关闭问题。
确保帖子格式清晰易读,用 markdown code block 语法格式化代码块。
你只花一分钟创建的问题,不能指望别人花上半个小时给你解答。

操作系统信息
例如:虚拟机,Ubuntu12.04,4C/8G

Kubernetes版本信息
kubectl version 命令执行结果贴在下方

root@k8s-1:~# kubectl version

WARNING: This version information is deprecated and will be replaced with the output from kubectl version –short. Use –output=yaml|json to get the full version.

Client Version: version.Info{Major:“1”, Minor:“26”, GitVersion:“v1.26.5”, GitCommit:“890a139214b4de1f01543d15003b5bda71aae9c7”, GitTreeState:“clean”, BuildDate:“2023-05-17T14:14:46Z”, GoVersion:“go1.19.9”, Compiler:“gc”, Platform:“linux/amd64”}

Kustomize Version: v4.5.7

Server Version: version.Info{Major:“1”, Minor:“26”, GitVersion:“v1.26.5”, GitCommit:“890a139214b4de1f01543d15003b5bda71aae9c7”, GitTreeState:“clean”, BuildDate:“2023-05-17T14:08:49Z”, GoVersion:“go1.19.9”, Compiler:“gc”, Platform:“linux/amd64”}

root@k8s-1:~#

容器运行时
docker version / crictl version / nerdctl version 结果贴在下方

root@k8s-1:~# crictl cversion

No help topic for ‘cversion’

root@k8s-1:~# crictl version

Version: 0.1.0

RuntimeName: containerd

RuntimeVersion: 1.7.25

RuntimeApiVersion: v1

KubeSphere版本信息
v3.4.1。在线安装。使用kk安装。

问题是什么
报错日志是什么,最好有截图。

    xxxsardocker 更改标题为「流水线执行命令时报错

    xxxsardocker jenkinsfile 贴出来。看上面的jenkins log 是sh命令运行失败了。 debug的话,可以在你的sh命令之前添加一个 sh ‘sleep 600’ 之类的命令,然后kubectl -n kubesphere-devops-worker exec -it <the-maven-pod> – bash 进入容器,然后手动运行一下你的sh命令试试。