Openshift webhook 分支过滤器

Openshift webhook branch filter

我成功安装了 Openshift Origin(最新),并执行了自动构建。

即,一旦我在 master 分支上推送了一些内容,我就会使用 Openshift 触发器提供的 URL 通过 git webhook 触发构建。

现在我想仅在更新特定分支时触发构建。

我创建了一个新的 dev 分支,并添加了一个具有专用服务和路由的新构建。

但是当我推入 master 时,也会触发 dev 构建。当我推入 dev 时,master 也会发生同样的情况,尽管我用正确的分支名称更新了 Source ref:

但是,master 构建使用 master 分支,而 dev 构建使用 dev 分支完成。但是我只希望在推入 dev 分支时触发 dev 构建。

这是以下命令的 YAML 输出:oc get buildconfigs lol-master --output=yaml

apiVersion: v1
kind: BuildConfig
metadata:
  annotations:
    openshift.io/generated-by: OpenShiftWebConsole
  creationTimestamp: 2016-04-22T06:02:16Z
  labels:
    app: lol-master
  name: lol-master
  namespace: lol
  resourceVersion: "33768"
  selfLink: /oapi/v1/namespaces/lol/buildconfigs/lol-master
  uid: c3d383c3-084f-11e6-978b-525400659b2e
spec:
  output:
    to:
      kind: ImageStreamTag
      name: lol-master:latest
      namespace: lol
  postCommit: {}
  resources: {}
  source:
    git:
      ref: master
      uri: http://git-ooo-labs.apps.10.2.2.2.xip.io/ooo/lol.git
    secrets: null
    type: Git
  strategy:
    sourceStrategy:
      from:
        kind: ImageStreamTag
        name: ruby:latest
        namespace: openshift
    type: Source
  triggers:
  - github:
      secret: cd02b3ebed15bc98
    type: GitHub
  - generic:
      secret: 7be2f555e9d8a809
    type: Generic
  - type: ConfigChange
  - imageChange:
      lastTriggeredImageID: centos/ruby22-centos7@sha256:990326b8ad8c4ae2619b24d019b7871bb10ab08c41e9d5b19d0b72cb0200e28c
    type: ImageChange
status:
  lastVersion: 18

我是不是漏掉了什么?

非常感谢

您正指向 BuildConfig 中的 master 分支:

 source:
    git:
      ref: master
      uri: http://git-ooo-labs.apps.10.2.2.2.xip.io/ooo/lol.git
    secrets: null
    type: Git

但应该指向 dev,如您所说。通常,masterdev 分支需要单独的 BC,每个分支都会相应地配置 webhook。此外,分支的格式为 refs/heads/dev,因为这是 OpenShift 从 github.

获取的信息

code we're checking for matching branches and ignore the hook if it doesn't match. Please check once again, and if you're still experiencing problem I'd ask you to open a bug against https://github.com/openshift/origin中有详细的说明。

我在 Github 上创建了一个与此行为 (GitHub issue #8600) 相关的问题。有人说我需要使用 Github webhook,而不是在这种情况下使用通用 webhook。

我将 webhook 切换为 github 类型,效果非常好。