【发布时间】:2021-05-10 15:35:30
【问题描述】:
我有这个 Jenkinsfile
pipeline {
agent any
tools {
maven 'maven381'
jdk 'JDK904'
oc 'oc'
}
parameters {
string(name:'CLUSTER_NAME',defaultValue:'openshift-cluster',description:'Cluster name space')
string(name:'PROJECT_NAME',defaultValue:'etias-sword-dev',description:'Cluster project name')
}
stages {
stage('Build') {
steps {
script {
openshift.withCluster(CLUSTER_NAME) {
openshift.withProject(PROJECT_NAME) {
openshift.newApp('--image-stream="openshift/java:11"~https://github.com/filip123go/Simplest-Spring-Boot-Hello-World.git --env=MAVEN_OPTS=-Dhttps.protocols=TLSv1.2')
}
}
}
}
}
}
}
我想传入环境变量
MAVEN_OPTS=-Dhttps.protocols=TLSv1.2
所以每次我在 Jenkins 中运行作业时,环境变量都会自动传递。 我知道openshift中的cli命令是
oc set env bc simple-spring-boot-hello-world MAVEN_OPTS=-Dhttps.protocols=TLSv1.2
我已经试过了,没有成功
openshift.newApp('--image-stream="openshift/java:11"~https://github.com/filip123go/Simplest-Spring-Boot-Hello-World.git --env=MAVEN_OPTS=-Dhttps.protocols=TLSv1.2')
和
openshift.newApp('--image-stream="openshift/java:11"~https://github.com/filip123go/Simplest-Spring-Boot-Hello-World.git --param=MAVEN_OPTS=-Dhttps.protocols=TLSv1.2')
和
openshift.newApp('--image-stream="openshift/java:11"~https://github.com/filip123go/Simplest-Spring-Boot-Hello-World.git MAVEN_OPTS=-Dhttps.protocols=TLSv1.2')
和
openshift.newApp('--image-stream="openshift/java:11"~https://github.com/filip123go/Simplest-Spring-Boot-Hello-World.git -e=MAVEN_OPTS=-Dhttps.protocols=TLSv1.2')
没有成功。 你能帮忙吗?
【问题讨论】:
标签: jenkins jenkins-pipeline openshift