【发布时间】:2019-03-08 08:27:31
【问题描述】:
我目前正在使用以下配置在 OpenShift 中构建管道
openshift:v3.6.173.0.140
Jenkins:2.017(使用来自 https://github.com/openshift/jenkins 的 redhat 图像)
Jenkins-Kubernetes 插件 1.12.2
作为 Jenkins 代理,我正在使用由 openshift jenkins 模板提供的 nodejs 代理以及在它们之上构建的图像(例如,我还使用 typescript 编译器安装的一个图像)
现在我想做的是用多个容器运行 pod(不仅仅是 jnlp 一个,而是标准节点,go 等容器)现在根据文档,这应该不是问题(https://github.com/jenkinsci/kubernetes-plugin),我应该只需将容器添加到我的 podTemplate 就像
podTemplate(label: mylabel, cloud: 'openshift',
containers: [
containerTemplate(
name: "jnlp",
resourceRequestMemory: "512Mi",
resourceLimitMemory: "2048Mi",
workingDir: "/home/default",
tty: "false",
imagePullPolicy: "Always",
image: 'private-registry:5000/namespace/nodejs-tsc-jnlp-image:latest',
args: '${computer.jnlpmac} ${computer.name}',
),
containerTemplate(
name: 'node',
resourceRequestMemory: '512Mi',
resourceLimitMemory: '2048Mi',
workingDir: '/home/default',
tty: 'true',
imagePullPolicy: 'Always',
image: 'node:alpine',
command: 'cat'
)
]
)
现在的问题是,这不起作用。为节点容器拉取图像工作正常,如果我使用 echo test 而不是 cat 作为命令测试将显示在容器日志中,但容器将作为完成传递,它将不执行管道中描述的任何内容。同样,这完全按照文档中的说明编写
node(mylabel){
stage('TEST NODE'){
container("node"){
sh("echo test node")
}
container("jnlp"){
sh("echo test jnlp")
}
}
知道我做错了什么吗?
【问题讨论】:
标签: jenkins kubernetes jenkins-pipeline openshift