![](/img/trans.png)
[英]How to run sidecar container in jenkins pipeline running inside kubernetes
[英]How to specify a container / agent to execute on Kubernetes cluster for Jenkins pipeline post condition only
我想在需要使用特定 docker 映像在 kubernetes pod 上执行的容器内运行我的声明性管道的 post 部分。 而且我不知道如何设置仅用于发布的代理。 我正在执行一个特定的 python 脚本,它在 post 条件下发送电子邮件并执行脚本我需要在代理上安装 python 和 pip,我的 docker 映像有这些先决条件,但我不知道如何创建代理在后期步骤中使用此泊坞窗图像。 谁能帮我?
我的管道示例
post {
failure {
echo "job failed"
}
success {
echo "job succeeded"
}
always {
node(null) {
#Python script call to send email
}
}
}
您可以使用 Jenkins Kubernetes 插件为 post 步骤设置一个 Pod,如下所示。
podTemplate(yaml: yamlfile, cloud: cloudName){
node(POD_LABEL) {
container(containerName) {
//steps to perform
}
}
有关如何在此链接中使用 podTemplate 的更多信息: https ://www.jenkins.io/doc/pipeline/steps/kubernetes/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.