owncloud-ci / drone-skip-pipeline

Drone plugin to skip pipelines based on changed files
https://hub.docker.com/r/owncloudci/drone-skip-pipeline
Apache License 2.0
1 stars 1 forks source link

DRONE_COMMIT_BEFORE not found: object not found #18

Open a-zen opened 2 years ago

a-zen commented 2 years ago

Hi,

when I create a new branch from the mainline and trigger the pipeline, the first time the plugin fails with the following error message:

Status: Image is up to date for owncloudci/drone-skip-pipeline:latest
DRONE_COMMIT_BEFORE:  0000000000000000000000000000000000000000
time="2022-03-10T20:21:31Z" level=error msg="execution failed: commit from DRONE_COMMIT_BEFORE not found: object not found"

I think in this case the pipeline shouldn't be skipped as it seems the changed files can't be determined.

wkloucek commented 2 years ago

I also already had that error. On my side it happened after I changed the git tree (commit amend / rebase, basically something which needs a force push). When did it occur to you? Does it happen on a regular basis?

I'm not sure if we should handle this error gracefully, since something is off with this particular CI run.

You also can deal with it by adding failure: ignore to the pipeline step where you run owncloudci/drone-skip-pipeline. I would prefer this over never raising an error.

a-zen commented 2 years ago

@wkloucek thank you for your reply. I can reproduce the issue by simply creating a new branch and push it. Afterwards the drone plugin will fail with the following error, or the before sha is empty. Maybe this is caused by my git server. I'm using gitea for this.

I implemented a solution for this but to be honest I don't like it very much:

https://github.com/a-zen/drone-skip-pipeline/commit/add81794048c710b063efbe57abd297153a87e53

I will consider adding the failure: ignorelike you suggested. That seems to be more straight forward.

wkloucek commented 2 years ago

@a-zen are you working with forks when this happens? (we had some problem in our CI where we just clone the fork, which didn't include the DRONE_COMMIT_BEFORE commit)

a-zen commented 2 years ago

@wkloucek no I'm branching in the same repository. But I used your solution with the failure ignore to get my pipeline working. I'm ok with closing this issue. :-)