feat(ci): add required boilerplate (license header) check #3213
Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.
🎉 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:
Join the community:
Feel free to ask questions in the comments if you need any help or clarification!
Thanks again for contributing to Kubeflow! 🙏
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.
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.
/ok-to-test
/retest
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.
Can you configure the generator to emit a header in this case and remove these exclusions?
Thanks for the contribution @reckless-sherixx! Please rebase the PR and address the comments.
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.
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
I have one small comment otherwise lgtm. Thanks for the contribution!
@tariq-hasan Done
Thanks!
/lgtm
/approve
[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:
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":[]} -->
tariq-hasan
reckless-sherixx
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-boilerplateand the Kubeflow header format.Proposed changes:
.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 manifestsprepends 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-crdcarries it into the chart CRDs.-
hack/python-api/gen-api.shprepends it to the openapi-generator Python models, as kubeflow/trainer does.-
hack/boilerplate.go.txtmoves tohack/boilerplate/boilerplate.go.txtnext to the newboilerplate.sh.txt, and now holds the Kubeflow template, so controller-gen, code-generator and openapi-gen emit the same header.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.config/, GitHub workflows and issue templates, a few Go/Python/shell files, tool configs).Google LLC,The Kubernetes Authors,spark-operator contributors), which per CNCF guidance should not be rewritten.Apart from the workflow, the Makefile,
gen-api.shand the two template files, every change touches only the header comment at the top of the file.Change Category
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
Additional Notes
Verified locally with the action's
boilerplate.pyand the sameexcludelist: the check passes on this branch and fails onmaster. Also verified thatcontroller-gen(CRDs, RBAC, webhook, deepcopy),openapi-genandcode-generator(register, clientset, listers) regenerate byte-identical files, that the chart CRDs stay in sync withconfig/crd/bases, that the Helm chart renders identically before and after the template header change, and thatgo build,gofmt,shfmtandshellcheckare clean.