Open hongbo-miao opened 3 years ago
Mmm.. i can definitely see why a force push would interfere with updates.
The branch tracker does a git pull
to see if new commits are available - but if you forced push to the remote - a git pull will not work.
i'll need to fix the branch tracker to: 1) fetch instead of pull 2) identify if the new commits are rewriting history 3) either rebase or git reset if force push is detected (probably should be configurable)
i.e: that would work (source):
$ git fetch origin
$ git reset --hard origin/master # Destroys your work
Acceptance criteria for the issue:
@asafc please confirm
opal-server stops pulling new updates if the policy repo master branch has a force push (replace the last one commit with a new one).
Here is the log, it just stops further pulling without any error. And current pulling will be pending.
Logs
```shell [2021-07-12 19:21:33 +0000] [1] [INFO] Starting gunicorn 20.1.0 [2021-07-12 19:21:33 +0000] [1] [INFO] Listening at: http://0.0.0.0:7002 (1) [2021-07-12 19:21:33 +0000] [1] [INFO] Using worker: uvicorn.workers.UvicornWorker [2021-07-12 19:21:33 +0000] [10] [INFO] Booting worker with pid: 10 [2021-07-12 19:21:33 +0000] [11] [INFO] Booting worker with pid: 11 [2021-07-12 19:21:33 +0000] [12] [INFO] Booting worker with pid: 12 [2021-07-12 19:21:33 +0000] [13] [INFO] Booting worker with pid: 13 2021-07-12T19:21:34.654948+0000 |opal_common.authentication.signer | INFO | OPAL was not provided with JWT encryption keys, cannot verify api requests! 2021-07-12T19:21:34.655596+0000 |opal_common.authentication.signer | INFO | OPAL was not provided with JWT encryption keys, cannot verify api requests! 2021-07-12T19:21:34.661812+0000 |opal_common.authentication.signer | INFO | OPAL was not provided with JWT encryption keys, cannot verify api requests! 2021-07-12T19:21:34.668544+0000 |opal_common.authentication.signer | INFO | OPAL was not provided with JWT encryption keys, cannot verify api requests! 2021-07-12T19:21:34.726044+0000 |opal_server.server | INFO | triggered startup event 2021-07-12T19:21:34.726328+0000 |opal_common.topics.publisher | INFO | started topic publisher 2021-07-12T19:21:34.727299+0000 |opal_server.server | INFO | leadership lock acquired, leader pid: 11 2021-07-12T19:21:34.727466+0000 |opal_server.server | INFO | listening on webhook topic: 'webhook' 2021-07-12T19:21:34.728867+0000 |fastapi_websocket_pubsub.event_notifier | INFO | New subscription {'id': '5d84fef30f3f4f0a8f712adee48a1bfd', 'subscriber_id': '8e5cdf788008461e9a0d900294df08ce', 'topic': 'webhook', 'callback': functools.partial(This is a very rare case as usually we don't force push
master
branch so definitely a low priority bug.However, just leave this here as I was curious what gonna happen if I do a force push. 😅