CIRCLE_PULL_REQUEST not being set


#4

We have been experimenting a little bit more with more builds, and apparently, triggering the build manually with the “Rebuild” button on the top right does set the correct PR environment variables.

Thanks


#5

I can confirm. Having the same issue.


#6

Thanks for reporting this everyone. We’ve merged some changes that should fix the issue.

I just ran a test build on a branch with an open PR and the env vars were populated correctly: https://circleci.com/gh/keybits/circulate/89

Do let us know if it’s still not resolved for you.


#7

Hello @tom,

This problem still occurs.

Sometimes CIRCLE_PULL_REQUEST environment variable are set.

I do not know the reproduction condition.
Two containers are executed in parallel by CircleCI Workflow, but this happens frequently in containers using alpine images.

Thanks


#8

This issue occurred again in another repository.
Workflow and alpine image had nothing to do with the issue.


#9

We are experiencing the same issue. Sometimes rebuilding will fix this.


#10

Same thing for us. Sometimes the variable is not set and therefor our tests are not running


#11

Thanks for checking and getting back to us. Our engineers are still looking into this, and we’ve been able to reproduce it inconsistently. Our working theory right now is that this is a race condition between two Github hooks, one for a push and one for a PR commit. We’ve been able to reproduce this using a commit from the Github PR web UI, so it’s not a simple matter of “create a PR then push to it”.

For now, rebuilding is the only suggestion I have while our engineers look into this further.


#12

Any updates on this? We heavily use the environment variable for a ton of automation we do. Having to rebuild a PR so often is kind of disheartening :frowning:


#13

Seeing this too. Hopefully someone can provide a fix for this soon.


#14

We’re also seeing it. Since the “Only build pull requests” is locked to the default branch on git we rely on this env var to reimplement this feature as we have more than one release branch where we need to run builds on all commits.

We can at the same time not run builds on commits on branches that isn’t a PR yet.

If this can’t be resolved we’ll be forced to switch to another CI provider


#15

Hi,

seeing the same behavior at the moment.

The product should generally perform better with executing jobs around the moment a pull request is created, because a lot of QA work should be done at that moment.

I’ve seen issues mentioning this very often, but no one from the team mentioned how the direction for that feature will be.

Kind regards,

Michael


#16

We have rolled out a fix. Please let us know if you are still experiencing this issue. Thank you so much for your patience.


#17

Same for java circleci/openjdk:8-jdk and circleci/openjdk:9-jdk images

The following environment variables are not set:
CI_PULL_REQUEST
CI_PULL_REQUESTS
CIRCLE_PULL_REQUEST
CIRCLE_PULL_REQUESTS


#18

Sorry to hear that. Can you please DM the build link where you are experiencing this issue? Thanks!


#19

Still seeing the same issue, none of the PR variables are being set.


#20

I am having the same issue.
One example would be: https://circleci.com/gh/BudgetFreak/BudgetFreak/389#queue-placeholder/containers/0

I am printing the PR# as
println “GitHub PR is #${System.env.CIRCLE_PR_NUMBER}”

The result is
GitHub PR is #null


#21

This is still happening: https://circleci.com/gh/carium-inc/cariumlib/397#tests/containers/0 shows a PR build and the CIRCLE_PULL_REQUEST{,S} variables aren’t set.


#22

We are also still experiencing this. Rebuilding does not solve the problem. “Only build pull requests” is not an option for our organization either.


#23

Hi, I’ve experienced the same Issue in https://circleci.com/gh/cargonexx/fe-client-app/244 have a look at the env|sort step which prints all set env vars.
Interesting is, CIRCLE_PULL_REQUEST is defined, but CIRCLE_PR_NUMBER is not. this build was directly triggered from github, however there is no change when rebuilding it directly in circeci.