Basically, I have some slow tests and some fast tests, and three branches, dev
staging
and production
. There are tons of PRs against dev
, but only a weekly PR against staging
. I'd only like to run the slow test suite when I make a PR against staging
, to ensure nothing broken ever goes into staging
. Is there a way to tell Jenkins "Run this test job for PRs against staging
?"
Asked
Active
Viewed 539 times
0

John
- 2,575
- 1
- 17
- 29
-
Would this question help? https://stackoverflow.com/questions/32108380/jenkins-how-to-build-a-specific-branch – evolutionxbox Apr 09 '18 at 15:50
-
Not quite. I don't know what name GitHub will assign my PR branch. It'll just be something like PR-1783 or whatever number I'm up to. – John Apr 09 '18 at 15:52
-
Are you using scripted / declarative pipeline? – arjabbar Apr 09 '18 at 19:51
-
Scripted, could do either or though – John Apr 09 '18 at 19:52
1 Answers
0
I figured this out. There is a Jenkins environment variable named CHANGE_TARGET
which contains the name of the branch you're making a PR against. This can be accessed by writing ${env.CHANGE_TARGET}
.

John
- 2,575
- 1
- 17
- 29