I successfully installed Openshift Origin (latest), and performed automated builds.
I.e., once I pushed something on master
branch, I get a build triggered through a git webhook, using the URL provided by Openshift triggers.
Now I would like to trigger a build only when a specific branch is updated.
I created a new dev
branch, and added a new build with its dedicated service and route.
But when I push in master
, the dev
build is also triggered. The same occurs for master
when I push in dev
, though I updated Source ref:
with the correct branch name.
However, master
build uses the master
branch, and dev
build is done with dev
branch. But I want only the dev
build to be triggered when I push in dev
branch only.
Here is the YAML output of the following command : 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
Am I missing something ?
Many thanks
You're pointing to master branch in your BuildConfig:
but should rather point to
dev
, as you're saying. Generally you need separate BC for themaster
anddev
branches and each will have the webhook configured accordingly. Additionally the format for the branch isrefs/heads/dev
, since that's the information OpenShift gets from github.In the 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 with detailed description.
I created an issue on Github related to this behavior (GitHub issue #8600). I've been said I need to use a Github webhook, and not a generic webhook in this case.
I switched the webhooks to github type, and it works like a charm.