This is an automated email from the ASF dual-hosted git repository. gyfora pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/flink-kubernetes-operator.git
commit 53876841c48937bfe5c4dce9b03d274f5411ff8a Author: Santwana Verma <[email protected]> AuthorDate: Thu Jun 18 17:56:32 2026 +0530 [hotfix] Auto-generate CRDs during the Maven build The copy-resources execution that copies the generated CRDs into the helm chart and crd-generator:generate are both bound to the process-classes phase. Maven orders same-phase executions by plugin declaration order, and maven-resources-plugin was declared before crd-generator-maven-plugin, so on a clean build the copy ran first against an empty target dir and the helm CRDs were never updated -- they were only refreshed if the build was run twice. This let the committed CRDs drift silently, since CI runs clean builds. Declare crd-generator-maven-plugin before maven-resources-plugin so generate runs first. A single 'mvn clean install -Pgenerate-docs' now regenerates the CRDs into the helm chart (before the test phase, which reads them, and the package-phase compatibility checks), and the existing 'git diff HEAD' check in CI fails if the committed CRDs are out of date. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> --- .github/workflows/ci.yml | 4 +++- flink-kubernetes-operator-api/pom.xml | 37 +++++++++++++++++++++++------------ 2 files changed, 28 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1dd5a1434..513d6510c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -119,7 +119,9 @@ jobs: run: | mvn -B clean install javadoc:javadoc -Pgenerate-docs if [[ $(git diff HEAD | wc -l) -gt 0 ]]; then - echo "Please generate the java doc via 'mvn clean install -DskipTests -Pgenerate-docs' again" + echo "Generated files (CRDs under helm/flink-kubernetes-operator/crds and docs) are out of date." + echo "Please regenerate them via 'mvn clean install -DskipTests -Pgenerate-docs' and commit the result." + git diff HEAD exit 1 fi - name: Tests in flink-kubernetes-operator diff --git a/flink-kubernetes-operator-api/pom.xml b/flink-kubernetes-operator-api/pom.xml index c3cff65b7..23ee30960 100644 --- a/flink-kubernetes-operator-api/pom.xml +++ b/flink-kubernetes-operator-api/pom.xml @@ -220,12 +220,37 @@ under the License. </profiles> <build> <plugins> + <!-- + Declared before maven-resources-plugin so that crd-generator:generate runs before the + copy-resources execution: both are bound to process-classes and Maven orders same-phase + executions by plugin declaration order. This ensures the generated CRDs exist in the + target dir before they are copied into the helm chart. + --> + <plugin> + <groupId>io.fabric8</groupId> + <artifactId>crd-generator-maven-plugin</artifactId> + <version>${fabric8.version}</version> + <executions> + <execution> + <phase>process-classes</phase> + <goals> + <goal>generate</goal> + </goals> + </execution> + </executions> + </plugin> <plugin> <artifactId>maven-resources-plugin</artifactId> <version>${maven-resources-plugin.version}</version> <executions> <execution> <id>copy-resources</id> + <!-- + Runs in process-classes, after crd-generator:generate (same phase, but the + crd-generator-maven-plugin is declared earlier so it executes first). This + copies the freshly generated CRDs into the helm chart before the test phase + (some tests read the chart CRDs) and the package-phase compatibility checks. + --> <phase>process-classes</phase> <goals> <goal>copy-resources</goal> @@ -346,18 +371,6 @@ under the License. </execution> </executions> </plugin> - <plugin> - <groupId>io.fabric8</groupId> - <artifactId>crd-generator-maven-plugin</artifactId> - <version>${fabric8.version}</version> - <executions> - <execution> - <goals> - <goal>generate</goal> - </goals> - </execution> - </executions> - </plugin> </plugins> </build> </project>
