operator-controller icon indicating copy to clipboard operation
operator-controller copied to clipboard

Add a CI check to make sure that pull requests are not missing `make generate`

Open m1kola opened this issue 2 years ago • 2 comments

We need a check for PRs to make sure that we generate all the generated code and yamls as part of a PR.

m1kola avatar Aug 22 '23 10:08 m1kola

Just need to add manifests to this target's dependencies?

https://github.com/operator-framework/operator-controller/blob/fd7cfb57680c3949d7317a4ad4c33dc7a42f09d5/Makefile#L82

CI already runs make verify as part of the sanity workflow.

joelanford avatar Aug 22 '23 12:08 joelanford

@joelanford you are right we already have verify which runs git diff --exit-code and we can add manifests as a dependency.

However git diff --exit-code will only produce non-zero exit code if there is a diff in tracked files and it will miss cases when working copy is dirty due to new untracked files as result of code generation.

I think we need something like [[ -z "$(git status -s)" ]] instead.

m1kola avatar Aug 22 '23 12:08 m1kola

/assign rashmi43

rashmi43 avatar Feb 12 '25 09:02 rashmi43

The make verify command runs make generate, and if the generated result differs from what was previously committed, it fails. This check ensures consistency. Given that, I will close this issue. However, if anyone sees a reason to reopen it, please feel free to do so.

camilamacedo86 avatar Mar 04 '25 02:03 camilamacedo86

@camilamacedo86 I think this issue is still valid. While verify target now has manifests as dependency it still uses git diff --exit-code which doesn't account for files not tracked by git (e.g. new files generated). See https://github.com/operator-framework/operator-controller/issues/348#issuecomment-1688129085 for a potential solution.

It is probably an edge case, but it is something I noticed while working on operator-controller and that's why I created this issue originally.

m1kola avatar Mar 04 '25 12:03 m1kola