← Back to Pull requests

feat(ci): add required boilerplate (license header) check #3213

Merged
reckless-sherixx merged 682 files (7365 lines) on Oct 23, 2026 18:03 UTC
View on GitHub
reckless-sherixx reckless-sherixx commented on Sep 30, 2026 17:57 UTC
Author

Purpose of this PR

Fixes #2139 by adding a required boilerplate (license header) check to CI, using the shared Kubeflow action kubeflow/testing/.github/actions/verify-boilerplate and the Kubeflow header format.

Proposed changes:

  • Add .github/workflows/code-quality-check.yaml, modeled on the workflows in kubeflow/sdk and kubeflow/trainer, that runs the shared action. It checks that every Go, Python, shell, YAML, Dockerfile and Helm template file carries the Kubeflow Apache 2.0 header and that files added in a PR use the year-less form (Copyright The Kubeflow Authors.), per kubernetes/steering#299.

  • Make the generators emit the header, so no generated file needs to be excluded:

  • - make manifests prepends the year-less header to the controller-gen output (config/crd/bases/.yaml, config/rbac/role.yaml, config/webhook/manifests.yaml), as kubeflow/trainer does; make update-crd carries it into the chart CRDs.
    - hack/python-api/gen-api.sh prepends it to the openapi-generator Python models, as kubeflow/trainer does.
    - hack/boilerplate.go.txt moves to hack/boilerplate/boilerplate.go.txt next to the new boilerplate.sh.txt, and now holds the Kubeflow template, so controller-gen, code-generator and openapi-gen emit the same header.
  • Normalize the existing headers to the Kubeflow templates: The Kubeflow authors → The Kubeflow Authors, https://www.apache.org/... → http://www.apache.org/..., consistent indentation, and {{- / ... */ -}} delimiters in Helm templates. Existing copyright years are kept; only new files must be year-less.

  • Add the year-less header to the checked files that had none (kustomize manifests under config/, GitHub workflows and issue templates, a few Go/Python/shell files, tool configs).

  • The only exclusions left are the 36 files that keep their original copyright notice (Google LLC, The Kubernetes Authors, spark-operator contributors), which per CNCF guidance should not be rewritten.
  • Apart from the workflow, the Makefile, gen-api.sh and the two template files, every change touches only the header comment at the top of the file.

    Change Category

  • Bugfix (non-breaking change which fixes an issue)

  • Feature (non-breaking change which adds functionality)

  • Breaking change (fix or feature that could affect existing functionality)

  • Documentation update
  • Rationale

    This is the same checker and layout other Kubeflow repositories use (kubeflow/trainer#4144), so the header format and the rules for new files stay consistent across the organization without vendoring a script here. The action is pinned by commit.

    Checklist

  • I have conducted a self-review of my own code.

  • I have updated documentation accordingly.

  • I have added tests that prove my changes are effective or that my feature works.

  • Existing unit tests pass locally with my changes.
  • Additional Notes

    Verified locally with the action's boilerplate.py and the same exclude list: the check passes on this branch and fails on master. Also verified that controller-gen (CRDs, RBAC, webhook, deepcopy), openapi-gen and code-generator (register, clientset, listers) regenerate byte-identical files, that the chart CRDs stay in sync with config/crd/bases, that the Helm chart renders identically before and after the template header change, and that go build, gofmt, shfmt and shellcheck are clean.

    Diff: 7365 lines (+6817 / -548) across 682 files Reviewer: tariq-hasan Review duration: 33125m
    All Vouch review confidence checks passed
    Residual risk 0.26 = Change Risk (0.72) × (1 − Review Confidence (0.63)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.72 · 7365 lines diff across 682 files
    0.72
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.21 · 5 substantive comment(s)
    0.21
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 50%
    63%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.400
    Shallow Review Depth shallow_review_depth
    0.276
    Mass File Touch mass_file_touch
    0.080
    Real PR Conversation Timeline
    16 items
    copilot-pull-request-reviewer[bot] copilot-pull-request-reviewer[bot] commented on Sep 30, 2026 17:57 UTC
    Reviewer

    Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

    github-actions[bot] github-actions[bot] commented on Sep 30, 2026 17:57 UTC
    Bot

    🎉 Welcome to the Kubeflow Spark Operator! 🎉

    Thanks for opening your first PR! We're happy to have you as part of our community 🚀

    Here's what happens next:

  • If you haven't already, please check out our Contributing Guide for repo-specific guidelines and the Kubeflow Contributor Guide for general community standards.

  • Our team will review your PR soon!
  • Join the community:

  • Slack: Join our #kubeflow-spark-on-kubernetes Slack channel.
  • Feel free to ask questions in the comments if you need any help or clarification!
    Thanks again for contributing to Kubeflow! 🙏

    nabuskey nabuskey commented on Oct 06, 2026 20:09 UTC
    Contributor

    License format does not match what we need have under Kubeflow.

    We also should use https://github.com/kubeflow/testing/blob/master/.github/actions/verify-boilerplate/action.yml.

    reckless-sherixx reckless-sherixx commented on Oct 07, 2026 02:41 UTC
    Author

    License format does not match what we need have under Kubeflow.

    > We also should use https://github.com/kubeflow/testing/blob/master/.github/actions/verify-boilerplate/action.yml.

    Thanks for the review. Reworked to use kubeflow/testing/.github/actions/verify-boilerplate (pinned to the commit that added exclude) and the Kubeflow header format. Since the shared checker is strict, this also normalizes the existing headers (Authors, http://, Helm delimiters) and adds the year-less header where it was missing; files with Google LLC / Kubernetes Authors notices are excluded rather than rewritten. Details in the description.

    tariq-hasan tariq-hasan commented on Oct 21, 2026 04:22 UTC
    Contributor

    /ok-to-test
    /retest

    tariq-hasan tariq-hasan commented on code on Oct 21, 2026 04:32 UTC
    Code Review
    .github/workflows/code-quality-check.yaml:1

    Let's have a workflow called code-quality-check.yaml similar to https://github.com/kubeflow/sdk/blob/ee22b33fbb261a2601f5dae9b11c2d82ea7dc7db/.github/workflows/code-quality-check.yaml and https://github.com/kubeflow/trainer/blob/master/.github/workflows/code-quality-check.yaml instead of .github/workflows/verify-boilerplate.yaml.

    Please follow the examples I cited in Kubeflow SDK and Kubeflow Trainer to rework the workflow file in this PR.

    tariq-hasan tariq-hasan commented on code on Oct 21, 2026 04:38 UTC
    Code Review
    .github/workflows/verify-boilerplate.yaml:1
    @@ -0,0 +1,94 @@
    +# Copyright The Kubeflow Authors.
    +#
    +# Licensed under the Apache License, Version 2.0 (the "License");
    +# you may not use this file except in compliance with the License.
    +# You may obtain a copy of the License at
    +#
    +#     http://www.apache.org/licenses/LICENSE-2.0
    +#
    +# Unless required by applicable law or agreed to in writing, software
    +# distributed under the License is distributed on an "AS IS" BASIS,
    +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    +# See the License for the specific language governing permissions and
    +# limitations under the License.
    +
    +# Verify that source files carry the Kubeflow Apache 2.0 boilerplate header.
    +# New files must use the year-less header ("Copyright The Kubeflow Authors.").
    +name: Verify Boilerplate
    +
    +on:
    +  pull_request:
    +    branches:
    +      - master
    +      - release-*
    +
    +  push:
    +    branches:
    +      - master
    +      - release-*
    +
    +permissions:
    +  contents: read
    +
    +concurrency:
    +  group: ${{ github.workflow }}-${{ github.ref }}-${{ github.actor }}
    +  cancel-in-progress: true
    +
    +jobs:
    +  verify-boilerplate:
    +    runs-on: ubuntu-latest
    +    steps:
    +      - name: Checkout source code
    +        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
    +        with:
    +          fetch-depth: 0
    +
    +      - name: Verify boilerplate headers
    +        uses: kubeflow/testing/.github/actions/verify-boilerplate@4c88c676bb7104f432f98baa47340cd8b8f3bdf7 # master
    +        with:
    +          exclude: |
    +            # Generated files whose generators do not emit a header.
    +            ^api/python_api/kubeflow_spark_api/models/
    +            ^charts/spark-operator-chart/crds/
    +            ^config/crd/bases/
    +            ^config/rbac/role\.yaml$
    +            ^config/webhook/manifests\.yaml$

    Can you configure the generator to emit a header in this case and remove these exclusions?

    tariq-hasan tariq-hasan requested changes on Oct 21, 2026 05:03 UTC
    Changes Requested Reviewer

    Thanks for the contribution @reckless-sherixx! Please rebase the PR and address the comments.

    reckless-sherixx reckless-sherixx commented on Oct 21, 2026 16:34 UTC
    Author

    Thanks @tariq-hasan. Rebased on master and reworked per your comments: the workflow is now code-quality-check.yaml following the kubeflow/sdk and kubeflow/trainer examples, and the generators now emit the header themselves (make manifests prepends it to the controller-gen output and gen-api.sh to the Python models, same as trainer), so the only remaining exclusions are files that keep their original Google LLC / Kubernetes Authors notices. Split into three commits: header normalization, generator changes + regenerated files, and the workflow.

    tariq-hasan tariq-hasan commented on code on Oct 22, 2026 05:34 UTC
    Code Review
    .github/workflows/code-quality-check.yaml:1
    @@ -0,0 +1,79 @@
    +# Copyright The Kubeflow Authors.
    +#
    +# Licensed under the Apache License, Version 2.0 (the "License");
    +# you may not use this file except in compliance with the License.
    +# You may obtain a copy of the License at
    +#
    +#     http://www.apache.org/licenses/LICENSE-2.0
    +#
    +# Unless required by applicable law or agreed to in writing, software
    +# distributed under the License is distributed on an "AS IS" BASIS,
    +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    +# See the License for the specific language governing permissions and
    +# limitations under the License.
    +
    +name: Code Quality Checks
    +
    +on:
    +  push:
    +  pull_request:
    +
    +permissions:
    +  contents: read
    +
    +concurrency:
    +  group: ${{ github.workflow }}-${{ github.ref }}-${{ github.actor }}
    +  cancel-in-progress: true
    +
    +jobs:
    +  code-quality:
    +    runs-on: ubuntu-latest
    +
    +    steps:
    +      - name: Checkout source code
    +        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
    +        with:
    +          fetch-depth: 0

    Just a minor nit to align with the convention in the repo for checkout step.

        steps:
          - name: Checkout source code
            uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
            with:
              fetch-depth: 0
              persist-credentials: false
    

    tariq-hasan tariq-hasan requested changes on Oct 22, 2026 05:35 UTC
    Changes Requested Reviewer

    I have one small comment otherwise lgtm. Thanks for the contribution!

    reckless-sherixx reckless-sherixx commented on Oct 22, 2026 14:26 UTC
    Author

    @tariq-hasan Done

    tariq-hasan tariq-hasan approved these changes on Oct 23, 2026 10:31 UTC
    Approved Reviewer

    Thanks!
    /lgtm

    nabuskey nabuskey commented on Oct 23, 2026 18:01 UTC
    Contributor

    /approve

    google-oss-prow[bot] google-oss-prow[bot] commented on Oct 23, 2026 18:01 UTC
    Bot

    [APPROVALNOTIFIER] This PR is APPROVED

    This pull-request has been approved by: <a href="https://github.com/kubeflow/spark-operator/pull/3213#issuecomment-6371421765" title="Approved">nabuskey</a>

    The full list of commands accepted by this bot can be found here.

    The pull request process is described here

    <details >
    Needs approval from an approver in each of these files:

  • ~~OWNERS~~ [nabuskey]
  • Approvers can indicate their approval by writing /approve in a comment
    Approvers can cancel approval by writing /approve cancel in a comment
    </details>
    <!-- META={"approvers":[]} -->

    Reviewers
    Assignees
    reckless-sherixx reckless-sherixx
    Labels
    risk: low confidence: 63.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 71.5% (HIGH) · Higher = larger blast radius
    71.5%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 63.5% · Lower = rushed or shallow review
    63.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 26.1% · Safe to merge
    26.1%