From 04af4bb93cbf6c686ed2c86d1b115cb1a072f0be Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 22 Oct 2024 10:07:21 +0200 Subject: [PATCH] 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 Signed-off-by: Michael Adam (cherry picked from commit f32d3df99530e6721d693a9f43a59cc6a0848449) --- .github/workflows/codegen.yml | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/.github/workflows/codegen.yml b/.github/workflows/codegen.yml index ade666c32..7021cff76 100644 --- a/.github/workflows/codegen.yml +++ b/.github/workflows/codegen.yml @@ -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