2016-04-22 95 views
0

我成功安装了Openshift Origin(最新版),并执行了自动化构建。Openshift webhook分支过滤器

也就是说,一旦我在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/[email protected]:990326b8ad8c4ae2619b24d019b7871bb10ab08c41e9d5b19d0b72cb0200e28c 
    type: ImageChange 
status: 
    lastVersion: 18 

我缺少的东西?

非常感谢

回答

0

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

我将webhooks切换到github类型,它的功能就像一个魅力。

1

你指着主分支在BuildConfig:

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

,而应指向dev,因为你说。一般来说,您需要将单独的BC分配给masterdev分支,并且每个分支都将相应地配置webhook。此外,该分支的格式为refs/heads/dev,因为这是OpenShift从github获取的信息。

code我们正在检查匹配的分支,并忽略挂钩,如果它不匹配。请再检查一次,如果您仍然遇到问题,我会要求您打开一个针对https://github.com/openshift/origin的错误并提供详细说明。

+1

感谢您的评论。我尝试使用'ref/heads/dev'格式,但在日志中出现以下错误:错误:构建错误:错误:pathspec'refs/heads/dev'与git.'已知的任何文件都不匹配。顺便说一下,build也运行在prod和master env上。我会尝试在GitHub上打开一个bugrequest。 – Cicatrice