我正在尝试使用openshift创建一个cicd管道。最初,在使用“oc new-app”命令创建应用程序时,它会自动触发构建。除了删除或取消构建之外,我如何禁用初始构建?
除了删除或取消构建之外,我如何禁用初始构建?
oc new-app
无法阻止初始构建。
它在这里讨论过:https://github.com/openshift/origin/issues/15429
不幸的是,它现在没有实现。
但是,您可以通过手动修改buildConfig
的yaml来阻止初始构建从buildConfig
中删除所有触发器。
oc new-app
导出为yaml格式。# oc new-app --name=test \
centos/ruby-25-centos7~https://github.com/sclorg/ruby-ex.git -o yaml --dry-run > test.yml
triggers: []
。strategy:
sourceStrategy:
from:
kind: ImageStreamTag
name: ruby-25-centos7:latest
type: Source
triggers: []
修改后,使用oc create -f
创建资源。
# oc create -f test.yml
imagestream.image.openshift.io/ruby-25-centos7 created
imagestream.image.openshift.io/ruby-ex created
buildconfig.build.openshift.io/ruby-ex created
deploymentconfig.apps.openshift.io/ruby-ex created
service/ruby-ex created
在运行oc start-build <bc name>
和oc rollout latest dc/<dc name>
之前,构建版本不会运行。
我希望这个用例对你有所帮助。