greenkeeperio / greenkeeper-lockfile

:lock: Your lockfile, up to date, all the time
https://greenkeeper.io
183 stars 73 forks source link

"Only running on first push of a new branch" error on new greenkeeper branch #50

Closed patkub closed 6 years ago

patkub commented 7 years ago

I am getting this error for new branches created by greenkeeper. I run greenkeeper-lockfile in CircleCI. Branch: https://github.com/patkub/rmc1891-site/tree/greenkeeper/bs4-polymer-0.1.12 CircleCI: https://circleci.com/gh/patkub/rmc1891-site/736

Looks like issue #26 still occurs.

ethanrubio commented 7 years ago

It looks like this won't work CircleCI's new feature of workflows since the current check is to detect if CIRCLE_PREVIOUS_BUILD_NUM exists. Until a better solution is found, I'd recommend placing the greenkeeper updater in the first workflow since subsequent workflows will add CIRCLE_PREVIOUS_BUILD_NUM.

patkub commented 7 years ago

Still getting the same error after moving the greenkeeper updater to the first job in the workflow. https://github.com/patkub/rmc1891-site/blob/master/.circleci/config.yml#L232

janl commented 6 years ago

@patkub is this still the case and can you point to a current build that shows the behaviour? Thanks!

patkub commented 6 years ago

@janl yes this is still the case. I just updated my bs4-polymer package to version 0.2.2 which triggered:

The lockfile job says "Only running on first push of a new branch" for both the greenkeeper-lockfile-update and greenkeeper-lockfile-upload commands.

CircleCI config: https://github.com/patkub/rmc1891-site/blob/master/.circleci/config.yml

ethanrubio commented 6 years ago

@patkub It looks like when you have a workflow that runs the builds in parallel, you run into a race condition issue where whatever build starts first gets CIRCLE_PREVIOUS_BUILD_NUM="" (as you can see with this branch the first build #1290) while the other builds are given a number. Unfortunately, with the way that the current CirleCI check works, it does not handle this parallel case.

patkub commented 6 years ago

@ethanrubio Thank you for explaining the race condition issue. I got this to work by making lockfile the first job run and having every other job require lockfile to complete before running. This forces the lockfile job to run first in the workflow and get CIRCLE_PREVIOUS_BUILD_NUM="". Now the workflow looks like this: https://circleci.com/workflow-run/bf6ef80e-1a64-4371-9c99-69f997f7e303

Edit: fixed link

janl commented 6 years ago

Thanks @ethanrubio & @patkub, we merged the README addition already.