ci: fix the codegen workflow

The codegen workflow recently sometimes failed to detect files modified
by codegen. This has been analysed in a test PR:
https://github.com/rook/rook/pull/14723

The result of the analysis is the insight that the codegen tooling did not work
as expcted because the git checkout was not located in the src/github.com
directory under the GOPATH.

This change fixes the codegen workflow by post-processing the git checkout
action by copying the git checkout directory to the expected location.

Co-authored-by: Travis Nielsen <tnielsen@redhat.com>
Signed-off-by: Michael Adam <obnox@samba.org>
(cherry picked from commit f32d3df995)
This commit is contained in:
Michael Adam authored and Mergify committed 2024-10-22 15:51:56 +00:00
1 parent 58ad7dceb9
commit 04af4bb93c
1 file changed
+14 -2
+14 -2
View File
@@ -38,8 +38,20 @@ jobs:
with:
go-version: "1.22"
- name: post-process checkout - copy to github.com
run: |
# copy to the github.com path so codegen will work as expected
mkdir -p $(go env GOPATH)/src/github.com/rook/rook/
cp -R . $(go env GOPATH)/src/github.com/rook/rook/
- name: run codegen
run: GOPATH=$(go env GOPATH) make codegen
run: |
cd $(go env GOPATH)/src/github.com/rook/rook
GOPATH=$(go env GOPATH) make codegen
- name: validate codegen
run: tests/scripts/validate_modified_files.sh codegen
run: |
# run validation again, explicitly.
# it is also part of 'make codegen'
cd $(go env GOPATH)/src/github.com/rook/rook
tests/scripts/validate_modified_files.sh codegen