Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong builds getting triggered on commits if refspec contains both master and PRs #683

Open
jenkins-noob opened this issue Jun 27, 2018 · 0 comments

Comments

@jenkins-noob
Copy link

Hello!

Version information

Jenkins: 2.121.1
Git plugin: 3.9.1
ghprb plugin: 1.42.0

Configuration

Refspec: +refs/heads/master:refs/remotes/origin/master +refs/pull/*:refs/remotes/origin/pr/*
Branch name: ${sha1}
Build Paramater: sha1, with default value master

Polling config to build on push events.

image

Expected bahavior

  1. When PRs are sent against master, they should be built.
  2. When commits are made to master, they should be built.
  3. When commits are made to any other branch, no builds shall be triggered, unless a PR is made against master.

Observed behavior

  1. When PRs are sent against master, they are built.
  2. When commits are made to master, they should be built.

but with other branches it gets tricky here, so following is what happens.

I am working on a branch test1 and have opened a PR for master, branch. PR build starts.

Now, once PR build is finished (or during the build), if someone pushes a commit to another branch test2, that also gets built.

Git polling log looks like:

Started by GitHub push by <user>
....
 > git rev-parse refs/remotes/origin/pr/28/merge^{commit} # timeout=10
 > git rev-parse refs/remotes/origin/origin/pr/28/merge^{commit} # timeout=10
 > git log --full-history --no-abbrev --format=raw -M -m --raw c489380c270a35e2c727c6e6e9d20e5a4921f3bf..7df814e62a98119e0f1f3c9f2da4356f9ef14b3e # timeout=10
Done. Took 0.63 sec
Changes found

Just to clarify: 28 is the PR number for the PR of branch test1. And this log is when a commit was pushed to branch test2.

However, if master branch gets built after the PR either by push or manual build, then commits to other branches get ignored and hook log says No changes found after running rev-parse with origin/master instead of pr like it does above.

Maybe It is an issue with git plugin but I will just like to confirm.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant