From 04af4bb93cbf6c686ed2c86d1b115cb1a072f0be Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 22 Oct 2024 10:07:21 +0200 Subject: [PATCH 1/2] 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 From 37f7a81e986f5245e113ac89091dc59cce7817e3 Mon Sep 17 00:00:00 2001 From: Travis Nielsen Date: Tue, 22 Oct 2024 10:09:30 -0600 Subject: [PATCH 2/2] ci: update code for exporter changes A recent ceph exporter change missed the codegen updates Signed-off-by: Travis Nielsen --- .../ceph.rook.io/v1/zz_generated.deepcopy.go | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/pkg/apis/ceph.rook.io/v1/zz_generated.deepcopy.go b/pkg/apis/ceph.rook.io/v1/zz_generated.deepcopy.go index bd6bf6821..af7b0b888 100644 --- a/pkg/apis/ceph.rook.io/v1/zz_generated.deepcopy.go +++ b/pkg/apis/ceph.rook.io/v1/zz_generated.deepcopy.go @@ -1011,6 +1011,22 @@ func (in *CephDaemonsVersions) DeepCopy() *CephDaemonsVersions { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CephExporterSpec) DeepCopyInto(out *CephExporterSpec) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CephExporterSpec. +func (in *CephExporterSpec) DeepCopy() *CephExporterSpec { + if in == nil { + return nil + } + out := new(CephExporterSpec) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *CephFilesystem) DeepCopyInto(out *CephFilesystem) { *out = *in @@ -3249,6 +3265,11 @@ func (in *MonitoringSpec) DeepCopyInto(out *MonitoringSpec) { *out = new(metav1.Duration) **out = **in } + if in.Exporter != nil { + in, out := &in.Exporter, &out.Exporter + *out = new(CephExporterSpec) + **out = **in + } return }