From 40343bdc9e8933c2824504ce5714d05d623fcd13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jiri=20Dan=C4=9Bk?= Date: Tue, 14 Jan 2025 08:54:33 +0100 Subject: [PATCH] RHOAIENG-16751: chore(gha): add test for checking the values match between Version file and metadata yaml file --- .github/workflows/code-quality.yaml | 20 ++++++++++++++++++++ ci/generate_code.sh | 12 ++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 ci/generate_code.sh diff --git a/.github/workflows/code-quality.yaml b/.github/workflows/code-quality.yaml index 70e4569b4b0..8f9f6f8bce5 100644 --- a/.github/workflows/code-quality.yaml +++ b/.github/workflows/code-quality.yaml @@ -92,3 +92,23 @@ jobs: go mod tidy $(go env GOPATH)/bin/govulncheck -show=verbose ./... working-directory: ${{ matrix.component }} + + check-generated-code: + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@v4 + + - name: Rerun all code generators we have + run: bash ci/generate_code.sh + + - name: Check there aren't any modified files present + run: | + clean=$(git status --porcelain) + if [[ -z "$clean" ]]; then + echo "Empty git status --porcelain: $clean" + else + echo "::error::Please run 'bash ci/generate_code.sh' (the command from the previous step), commit the changed files locally, and push again." + echo "Uncommitted file changes detected: $clean" + git diff + exit 1 + fi diff --git a/ci/generate_code.sh b/ci/generate_code.sh new file mode 100644 index 00000000000..3f466452775 --- /dev/null +++ b/ci/generate_code.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +set -Eeuxo pipefail + +# Run all code generators we use in this repository. +# It is used to check for mismatches in GitHub Actions workflow. + +# go projects +(cd components/notebook-controller; make manifests generate fmt) +(cd components/odh-notebook-controller; make manifests generate fmt) + +# component metadata yaml file +(cd components/notebook-controller; bash generate-metadata-yaml.sh -o config/component_metadata.yaml)