如何在openshift中禁用从构建配置触发的自动构建?

问题描述 投票:0回答:1

我正在尝试使用openshift创建一个cicd管道。最初,在使用“oc new-app”命令创建应用程序时,它会自动触发构建。除了删除或取消构建之外,我如何禁用初始构建?

openshift openshift-origin openshift-3
1个回答
0
投票

除了删除或取消构建之外,我如何禁用初始构建?

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>之前,构建版本不会运行。

我希望这个用例对你有所帮助。

© www.soinside.com 2019 - 2024. All rights reserved.