#232 Using polling to trigger the OpenShift pipeline?
Closed 5 years ago Opened 5 years ago by rayson.

Although this is not ideal comparing with using Webhooks or intermediately UMB, do you think it's a good idea to set up a polling trigger at this stage for the dev OpenShift pipeline?


:thumbsup: Let's do this.

@ralph @acorvin Thanks.

I am correctly investigating how to set up a polling trigger for an OpenShift pipeline job. However, as of OpenShift v3.10, there is no native polling SCM support (https://docs.openshift.com/container-platform/3.10/dev_guide/builds/triggering_builds.html#config-change-triggers).

I am trying Jenkins the SCM polling trigger. Not sure if it works.

A bad approach is to set up a general trigger for the OpenShift pipeline job, then create a separated Jenkins job doing polling and triggering the pipeline job.

@csomh What do you think?

Update:
1. Issue: Jenkins's polling mechanism seems to require a persistent Jenkins slave (not pod). The SCM polling plugin complains: ERROR: no such computer jenkins-slave-e818542f-0c85-49a0-9f50-f20878a07eed-2bz06-mrzlp. A similar bug report: https://issues.jenkins-ci.org/browse/JENKINS-46468
AI: will take a look at https://github.com/CentOS-PaaS-SIG/ci-pipeline/tree/master/vars and C3I-19.
2. Issue: Triggering a pipeline job from Jenkins can reproduce the duplicate build parameter issue I mentioned before: https://github.com/openshift/jenkins-sync-plugin/pull/254

@csomh What do you think of the way creating a polling job on rcm-tools-jenkins that trigger a pipeline build on UpShift?

@rayson: not a good solution, but if it's a quick enough hack to get us to see these pieces integrated, than let's go ahead.

@csomh
Following are my findings on Jenkins Polling SCM:

  1. It requires a persistent workspace for polling on wildcards (like refs/pull/*/head for Pagure PRs). This means we have to run the polling-SCM job outside of pods. Running on rcm-tools-jenkins or UpShift Jenkins master is feasible solution.

  2. The existing waiverdb Jenkins job on rcm-tools-jenkins polls on both pull/*/head and master. This approach doesn't work well for the new pipeline job: When merging a PR as fast-forward, Jenkins polling mechanism will not trigger a new build for the merged master branch. Because we have different workflows for pre-merge and post-merge, we have to do polling in different jenkins jobs: one for polling on master, the other for PRs.

  3. There are 2 approaches to trigger a pipeline build on Jenkins. One is to use OpenShift's Generic Webhooks: https://docs.openshift.com/container-platform/3.9/dev_guide/builds/triggering_builds.html#generic-webhooks. The other is to OpenShift Pipeline DSL syntax (openshift.selector(bc).startBuild()), which requires the Jenkins master has OpenShift Client plugin installed and configured. Which one do you prefer?

I'm fine with having a job set up for PR's and another one for post-merge stuff.

Regarding triggering the build: who would use the webhook? Pagure? Reaching internal infra from the internet will not work in this case.

Using startBuild() seems to be the way to go. (Unless, I misunderstood something.)

Thanks for the discussion. Because we have decided to go this way, this issue can be closed.

Metadata Update from @rayson:
- Issue assigned to rayson

5 years ago

Metadata Update from @rayson:
- Issue status updated to: Closed (was: Open)
- Issue tagged with: enhancement

5 years ago

Login to comment on this ticket.

Metadata