首页 > 解决方案 > 有人知道如何通过 jenkins 管道检索在 openshift 上运行的应用程序的路由主机名吗?

问题描述

正如标题所说,有人知道如何通过 jenkins 管道检索在 openshift 上运行的应用程序的路由主机名吗?

我正在尝试检索路由主机名以将其放入变量中。

这是我为实现这一目标所做的,但没有奏效:

openshift.selector("route", "${params.APPLICATION_NAME}") {
                    def dc = it.object()
                    shortname = dc.spec.host
                    echo "This is the route : $shortname"}

标签: jenkinsjenkins-pipelineopenshiftjenkins-job-dslopenshift-enterprise

解决方案


我找到了一种使用以下命令的方法:

def route1 = openshift.selector("route", "${params.APPLICATION_NAME}").narrow('route').object()

echo "This the route of the application ${route1.spec.host}"

推荐阅读