#317 Use Jenkinsfile from PR for pre-merge CI builds
Merged 4 years ago by gnaponie. Opened 4 years ago by lholecek.
lholecek/waiverdb ci-use-pr-jenkinsfile  into  master

@@ -179,7 +179,7 @@ 

      source:

        git:

          uri: "${WAIVERDB_GIT_REPO}"

-         ref: "${WAIVERDB_MAIN_BRANCH}"

+         ref: "${WAIVERDB_GIT_REF}"

      strategy:

        type: JenkinsPipeline

        jenkinsPipelineStrategy:

Pull-Request has been merged by gnaponie

4 years ago

This does not work, followup is in #318 but seems that I cannot set up OpenShift template so that the Jenkins job is configured to pull PRs before it reads the Jenkinsfile.

This doesn't work because the Git repo and branch name are preconfigured on Jenkins, and there is no way to tell Jenkins to use another branch before a Job run.

This doesn't work because the Git repo and branch name are preconfigured on Jenkins, and there is no way to tell Jenkins to use another branch before a Job run.

The repo and branch name is configured in "openshift/pipelines/templates/waiverdb-build-template.yaml" (JenkinsPipeline; can be changed from OpenShift UI). But the missing part is refspec configuration for Jenkins -- you can find it in Jenkins job configuration but I didn't find a way to set it in the OpenShift template.

Workaround to test the new Jenkinsfile is to temporarily change the repo and branch in OpenShift UI to point to your fork and devel branch, or using following command.

oc start-build --from-repo=. --commit=YOUR_BRANCH waiverdb-premerge-jenkins-slave

@lholecek The pre-merge job is started by the polling job (https://jenkins-waiverdb-test.cloud.paas.upshift.redhat.com/job/waiverdb-test/job/waiverdb-test-waiverdb-polling-for-prs/). I realized we can pass the --commit parameter you mentioned there.

I realized we can pass the --commit parameter you mentioned there.

@rayson You already mentioned it in "openshift/docs/pipeline-deployment.md" (BTW, thanks for the docs). But the --from-repo argument is required if you have your branch in a fork (not in the main repo).

Metadata