greenkeeper-lockfile icon indicating copy to clipboard operation
greenkeeper-lockfile copied to clipboard

CircleCI never updates

Open emmenko opened this issue 6 years ago • 5 comments

Hey guys,

we've noticed that on CircleCI greenkeeper-lockfile always skips to update.

image

This already happens when greenkeeper creates the branch (first commit).

By looking at the code it seems that the problem comes from correctBuild being false.

https://github.com/greenkeeperio/greenkeeper-lockfile/blob/e4ba1a322fab59b602c60d3f5427096a1775fe23/update.js#L33-L35

which is determined by

https://github.com/greenkeeperio/greenkeeper-lockfile/blob/e4ba1a322fab59b602c60d3f5427096a1775fe23/ci-services/circleci.js#L9

Now, if I look at the CI variables the CI_PULL_REQUEST is set

CI_PULL_REQUEST=https://github.com/xxx/xxx/pull/2204

So it seems that for CircleCI it will always skip to update.

What is the reason for using _.isEmpty(env.CI_PULL_REQUEST)? Is this supposed to work differently?

Thanks for the help!

emmenko avatar Aug 24 '17 21:08 emmenko

Short update here: in the last greenkeeper branch, it did work out at the end. By looking at the circleci env variables, it seems that at the time the build started, the PR was not created yet, thus the lockfile update worked as expected.

I'm wondering then if it's more of a race condition problem. By the time the build starts, if the PR is already created the lockfile update will be skipped, if the PR has not been created yet the lockfile update will run.

emmenko avatar Aug 26 '17 11:08 emmenko

I have a quick-fix branch here, that others can use. I'm not sure why we would want to ignore some branches from updating:

yarn global add greenkeeper-lockfile@github:jasonLaster/greenkeeper-lockfile

it seems that updating is cheap...

jasonLaster avatar Oct 02 '17 17:10 jasonLaster

Unsure about cheap, these are commits on the branch, we don’t want to be lackluster about them.

janl avatar Oct 18 '17 13:10 janl

Yarn would randomly fail to install this patch so I got this to work instead: yarn global add https://github.com/jasonLaster/greenkeeper-lockfile.git

noahsw avatar Jan 02 '18 05:01 noahsw

In CircleCI it's difficult to detect whether or not a build is running on a pull request or a branch. This is from the Danger.js docs:

For setting up Circle CI, we recommend turning on "Only Build pull requests." in "Advanced Setting." Without this enabled, it is really tricky for Danger to know whether you are in a pull request or not, as the environment metadata isn't reliable. This may be different with Circle v2.

I wonder… would unsetting CI_PULL_REQUEST in the invocation of greenkeeper-lockfile-update have the same effect as @jasonLaster's quick-fix? This issue creates a bunch of extra work in Shields and I'd be happy for a workaround, especially if a correct solution is not possible. We squash-merge PR, so extra commits on the PR branch are not an issue.

paulmelnikow avatar Mar 12 '18 00:03 paulmelnikow