From d73f3a8a26b9941c469f237de257bdcf95414f82 Mon Sep 17 00:00:00 2001 From: Archana Shinde Date: Thu, 2 Feb 2023 14:23:02 -0800 Subject: [PATCH] github-action: Add step to verify kernel config version id updated The version mentioned in the `kata_config_version` needs to be updated for any kernel config change or changed to the patches applied. Without this, CI would not test with the latest kernel changes. We use to enforce this earlier as part of CI when `packaging` was a standalone repo. Add back this check as part of a github action so that the check is performed early on instead of a CI job. Fixes: #6210 Signed-off-by: Archana Shinde --- .github/workflows/static-checks.yaml | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/.github/workflows/static-checks.yaml b/.github/workflows/static-checks.yaml index 69dfbae594..0cb9d72d34 100644 --- a/.github/workflows/static-checks.yaml +++ b/.github/workflows/static-checks.yaml @@ -27,7 +27,6 @@ jobs: target_branch: ${{ github.base_ref }} steps: - name: Checkout code - if: ${{ !contains(github.event.pull_request.labels.*.name, 'force-skip-ci') }} uses: actions/checkout@v3 with: fetch-depth: 0 @@ -38,6 +37,22 @@ jobs: go-version: 1.19.3 env: GOPATH: ${{ runner.workspace }}/kata-containers + - name: Check kernel config version + run: | + cd "${{ github.workspace }}/src/github.com/${{ github.repository }}" + kernel_dir="tools/packaging/kernel/" + kernel_version_file="${kernel_dir}kata_config_version" + modified_files=$(git diff --name-only origin/main..HEAD) + result=$(git whatchanged origin/main..HEAD "${kernel_dir}" >>"/dev/null") + if git whatchanged origin/main..HEAD "${kernel_dir}" >>"/dev/null"; then + echo "Kernel directory has changed, checking if $kernel_version_file has been updated" + if echo "$modified_files" | grep -v "README.md" | grep "${kernel_dir}" >>"/dev/null"; then + echo "$modified_files" | grep "$kernel_version_file" >>/dev/null || ( echo "Please bump version in $kernel_version_file" && exit 1) + else + echo "Readme file changed, no need for kernel config version update." + fi + echo "Check passed" + fi - name: Setup GOPATH if: ${{ !contains(github.event.pull_request.labels.*.name, 'force-skip-ci') }} run: |