ci(boilerplate): enhance copyright boilerplate enforcement (#3665)

* ci(boilerplate): enforce copyright headers on YAML files

Signed-off-by: tariq-hasan <[email protected]>

* ci(boilerplate): enforce year-less header for new files

Signed-off-by: tariq-hasan <[email protected]>

---------

Signed-off-by: tariq-hasan <[email protected]>
This commit is contained in:
Tariq Hasan
2026-07-03 13:39:54 +00:00
committed by GitHub
parent 663ae38567
commit 1f57df4484
139 changed files with 1444 additions and 112 deletions
+14
View File
@@ -1,3 +1,17 @@
# 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: Bug Report
description: Tell us about a problem you are experiencing with Kubeflow Trainer
labels: ["kind/bug", "needs-triage"]
+14
View File
@@ -1,3 +1,17 @@
# 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.
blank_issues_enabled: true
contact_links:
@@ -1,3 +1,17 @@
# 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: Feature Request
description: Suggest an idea for Kubeflow Trainer
labels: ["kind/feature", "needs-triage"]
+14
View File
@@ -1,3 +1,17 @@
# 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.
version: 2
updates:
# Go modules
@@ -1,3 +1,17 @@
# 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: Build and Publish Images
on:
+14
View File
@@ -1,3 +1,17 @@
# 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: Check PR Title
on:
+14
View File
@@ -1,3 +1,17 @@
# 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:
@@ -1,3 +1,17 @@
# 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: Approve Workflow Runs
permissions:
+14
View File
@@ -1,3 +1,17 @@
# 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.
# This workflow warns and then closes issues and PRs that have had no activity for a specified amount of time.
#
# You can adjust the behavior by modifying this file.
+14
View File
@@ -1,3 +1,17 @@
# 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.
# This workflow runs govulncheck on PRs to detect known reachable CVEs across the entire Go module.
# It triggers when any Go source file or Go dependencies (go.mod, go.sum) change.
# Results are posted as an informational PR comment for new regressions only.
+14
View File
@@ -1,3 +1,17 @@
# 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: OSV-Scanner Vulnerability Scan
on:
@@ -1,3 +1,17 @@
# 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: Publish Helm Charts
on:
+14
View File
@@ -1,3 +1,17 @@
# 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: Release
on:
@@ -1,3 +1,17 @@
# 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.
# Composite action to publish Kubeflow Trainer images.
name: Build And Publish Container Images
description: Build Multiplatform Supporting Container Images
@@ -1,3 +1,17 @@
# 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: Setup E2E Cluster
description: Checks out code, sets up Go and Python, installs dependencies, and creates a Kind cluster
+14
View File
@@ -1,3 +1,17 @@
# 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: E2E Tests
on:
+14
View File
@@ -1,3 +1,17 @@
# 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: Unit and Integration Test - Go
on:
+14
View File
@@ -1,3 +1,17 @@
# 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: Unit and E2E Test - Helm
on:
+14
View File
@@ -1,3 +1,17 @@
# 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: Unit and Integration Test - Python
on:
+14
View File
@@ -1,3 +1,17 @@
# 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: Unit and Integration Test - Rust
on:
+14
View File
@@ -1,3 +1,17 @@
# 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: Validate Python Lockfiles
on:
@@ -1,3 +1,17 @@
# 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: Welcome New Contributors
on:
+14
View File
@@ -1,3 +1,17 @@
# 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.
version: "2"
run:
allow-parallel-runners: true
+14
View File
@@ -1,3 +1,17 @@
# 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.
# golangci-lint configuration file
# see: https://golangci-lint.run/usage/configuration/
+14
View File
@@ -1,3 +1,17 @@
# 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.
# KubeLinter configuration file
# For more information, see https://docs.kubelinter.io/#/configuring-kubelinter
+14
View File
@@ -1,3 +1,17 @@
# 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.
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.3.0
+14
View File
@@ -1,3 +1,17 @@
# 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.
# ReadTheDocs build configuration
# Kubeflow Trainer Documentation System
+12 -1
View File
@@ -25,6 +25,9 @@ endif
PROJECT_DIR := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST))))
REPO := github.com/kubeflow/trainer
TRAINER_CHART_DIR := $(PROJECT_DIR)/charts/kubeflow-trainer
# Year-less copyright header prepended to generated manifests (controller-gen
# emits none). Single source of truth shared with the boilerplate verifier.
BOILERPLATE_HEADER := $(PROJECT_DIR)/hack/boilerplate/boilerplate.sh.txt
# Location to install tool binaries
LOCALBIN ?= $(PROJECT_DIR)/bin
@@ -169,6 +172,14 @@ manifests: controller-gen ## Generate manifests.
output:crd:artifacts:config=manifests/base/crds \
output:rbac:artifacts:config=manifests/base/rbac \
output:webhook:artifacts:config=manifests/base/webhook
@# controller-gen emits no license header. Prepend the year-less
@# boilerplate to each generated manifest. controller-gen rewrites these
@# files in full on every run, so prepending here once is idempotent.
@for f in manifests/base/crds/trainer.kubeflow.org_*.yaml \
manifests/base/rbac/role.yaml \
manifests/base/webhook/manifests.yaml; do \
{ cat $(BOILERPLATE_HEADER); echo; cat "$$f"; } > "$$f.tmp" && mv "$$f.tmp" "$$f"; \
done
cp -f manifests/base/crds/trainer.kubeflow.org_*.yaml $(TRAINER_CHART_DIR)/crds/
.PHONY: generate
@@ -198,7 +209,7 @@ golangci-lint: golangci-lint-install golangci-lint-kal ## Run golangci-lint to v
.PHONY: verify-boilerplate
verify-boilerplate: ## Verify copyright boilerplate headers in source files.
python3 hack/boilerplate/boilerplate.py
python3 hack/boilerplate/boilerplate.py --base-ref "$(TARGET_BRANCH)"
# Instructions to run tests.
.PHONY: test
+1 -3
View File
@@ -1,5 +1,4 @@
#
# Copyright 2025 The Kubeflow authors.
# Copyright 2025 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.
@@ -12,7 +11,6 @@
# 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.
#
apiVersion: v2
+1 -1
View File
@@ -1,5 +1,5 @@
{{- /*
Copyright 2026 The Kubeflow authors.
Copyright 2026 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.
@@ -1,3 +1,17 @@
# 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.
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
@@ -1,3 +1,17 @@
# 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.
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
@@ -1,3 +1,17 @@
# 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.
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
@@ -1,5 +1,5 @@
{{/*
Copyright 2025 The Kubeflow authors.
{{- /*
Copyright 2025 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.
@@ -12,7 +12,7 @@ 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.
*/}}
*/ -}}
{{/*
Expand the name of the chart.
@@ -1,5 +1,5 @@
{{- /*
Copyright 2025 The Kubeflow authors.
Copyright 2025 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.
@@ -1,5 +1,5 @@
{{- /*
Copyright 2025 The Kubeflow authors.
Copyright 2025 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.
@@ -1,5 +1,5 @@
{{- /*
Copyright 2025 The Kubeflow authors.
Copyright 2025 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.
@@ -1,5 +1,5 @@
{{- /*
Copyright 2025 The Kubeflow authors.
Copyright 2025 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.
@@ -1,5 +1,5 @@
{{- /*
Copyright 2025 The Kubeflow authors.
Copyright 2025 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.
@@ -1,5 +1,5 @@
{{- /*
Copyright 2025 The Kubeflow authors.
Copyright 2025 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.
@@ -1,5 +1,5 @@
{{- /*
Copyright 2025 The Kubeflow authors.
Copyright 2025 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.
@@ -1,5 +1,5 @@
{{- /*
Copyright 2025 The Kubeflow authors.
Copyright 2025 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.
@@ -1,5 +1,5 @@
{{- /*
Copyright 2025 The Kubeflow authors.
Copyright 2025 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.
@@ -1,5 +1,5 @@
{{- /*
Copyright 2025 The Kubeflow authors.
Copyright 2025 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.
@@ -1,5 +1,5 @@
{{- /*
Copyright 2025 The Kubeflow authors.
Copyright 2025 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.
@@ -1,5 +1,5 @@
{{- /*
Copyright 2025 The Kubeflow authors.
Copyright 2025 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.
@@ -1,5 +1,5 @@
{{- /*
Copyright 2026 The Kubeflow authors.
Copyright 2026 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.
@@ -1,5 +1,5 @@
{{- /*
Copyright 2025 The Kubeflow authors.
Copyright 2025 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.
@@ -1,5 +1,5 @@
{{- /*
Copyright 2026 The Kubeflow authors.
Copyright 2026 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.
@@ -1,5 +1,5 @@
{{- /*
Copyright 2026 The Kubeflow authors.
Copyright 2026 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.
@@ -1,5 +1,5 @@
{{- /*
Copyright 2025 The Kubeflow authors.
Copyright 2025 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.
@@ -1,5 +1,5 @@
{{- /*
Copyright 2026 The Kubeflow authors.
Copyright 2026 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.
@@ -1,5 +1,5 @@
{{- /*
Copyright 2026 The Kubeflow authors.
Copyright 2026 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.
@@ -1,5 +1,5 @@
{{- /*
Copyright 2026 The Kubeflow authors.
Copyright 2026 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.
@@ -1,5 +1,5 @@
{{- /*
Copyright 2026 The Kubeflow authors.
Copyright 2026 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.
@@ -1,5 +1,5 @@
{{- /*
Copyright 2025 The Kubeflow authors.
Copyright 2025 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.
@@ -1,5 +1,5 @@
{{- /*
Copyright 2025 The Kubeflow authors.
Copyright 2025 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.
@@ -1,5 +1,5 @@
{{- /*
Copyright 2025 The Kubeflow authors.
Copyright 2025 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.
@@ -1,5 +1,5 @@
{{- /*
Copyright 2025 The Kubeflow authors.
Copyright 2025 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.
@@ -1,5 +1,4 @@
#
# Copyright 2025 The Kubeflow authors.
# Copyright 2025 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.
@@ -12,7 +11,6 @@
# 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.
#
suite: Test data-cache ClusterRole
templates:
@@ -1,3 +1,17 @@
# 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.
suite: test manager configmap
templates:
- manager/configmap.yaml
@@ -1,5 +1,4 @@
#
# Copyright 2025 The Kubeflow authors.
# Copyright 2025 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.
@@ -12,7 +11,6 @@
# 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.
#
suite: Test manager Deployment
@@ -1,5 +1,4 @@
#
# Copyright 2025 The Kubeflow authors.
# Copyright 2025 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.
@@ -12,7 +11,6 @@
# 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.
#
suite: Test manager Service
@@ -1,5 +1,4 @@
#
# Copyright 2025 The Kubeflow authors.
# Copyright 2025 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.
@@ -12,7 +11,6 @@
# 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.
#
suite: Test manager ClusterRoleBinding
@@ -1,5 +1,4 @@
#
# Copyright 2025 The Kubeflow authors.
# Copyright 2025 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.
@@ -12,7 +11,6 @@
# 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.
#
suite: Test manager ClusterRole
@@ -1,5 +1,4 @@
#
# Copyright 2025 The Kubeflow authors.
# Copyright 2025 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.
@@ -12,7 +11,6 @@
# 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.
#
suite: Test manager ServiceAccount
@@ -1,5 +1,4 @@
#
# Copyright 2025 The Kubeflow authors.
# Copyright 2025 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.
@@ -12,7 +11,6 @@
# 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.
#
suite: Test deepspeed-distributed ClusterTrainingRuntime
templates:
@@ -1,5 +1,4 @@
#
# Copyright 2025 The Kubeflow authors.
# Copyright 2025 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.
@@ -12,7 +11,6 @@
# 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.
#
suite: Test mlx-distributed ClusterTrainingRuntime
templates:
@@ -1,5 +1,4 @@
#
# Copyright 2025 The Kubeflow authors.
# Copyright 2025 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.
@@ -12,7 +11,6 @@
# 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.
#
suite: Test torch-distributed ClusterTrainingRuntime
templates:
@@ -1,5 +1,4 @@
#
# Copyright 2025 The Kubeflow authors.
# Copyright 2025 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.
@@ -12,7 +11,6 @@
# 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.
#
suite: Test torch-distributed-with-cache ClusterTrainingRuntime
templates:
@@ -1,4 +1,3 @@
#
# Copyright The Kubeflow Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -12,7 +11,6 @@
# 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.
#
suite: Test torchtune-llama3.2-1b ClusterTrainingRuntime
templates:
@@ -1,4 +1,3 @@
#
# Copyright The Kubeflow Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -12,7 +11,6 @@
# 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.
#
suite: Test torchtune-llama3.2-3b ClusterTrainingRuntime
templates:
@@ -1,4 +1,3 @@
#
# Copyright The Kubeflow Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -12,7 +11,6 @@
# 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.
#
suite: Test torchtune-qwen2.5-1.5b ClusterTrainingRuntime
templates:
@@ -1,5 +1,4 @@
#
# Copyright 2026 The Kubeflow authors.
# Copyright 2026 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.
@@ -12,7 +11,6 @@
# 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.
#
suite: Test xgboost-distributed ClusterTrainingRuntime
templates:
@@ -1,5 +1,4 @@
#
# Copyright 2025 The Kubeflow authors.
# Copyright 2025 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.
@@ -12,7 +11,6 @@
# 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.
#
suite: Test MutatingWebhookConfiguration
@@ -1,5 +1,4 @@
#
# Copyright 2025 The Kubeflow authors.
# Copyright 2025 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.
@@ -12,7 +11,6 @@
# 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.
#
suite: Test webhook Secret
@@ -1,5 +1,4 @@
#
# Copyright 2025 The Kubeflow authors.
# Copyright 2025 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.
@@ -12,7 +11,6 @@
# 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.
#
suite: Test ValidatingWebhookConfiguration
+1 -3
View File
@@ -1,5 +1,4 @@
#
# Copyright 2026 The Kubeflow authors.
# Copyright 2026 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.
@@ -12,7 +11,6 @@
# 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.
#
# Default values for trainer.
# This is a YAML-formatted file.
+14
View File
@@ -1,3 +1,17 @@
# 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.
# This example deploys the LAMMPS Molecular Dynamic Simulator
# with MPI orchestrated by the Flux workload manager on 4 nodes.
# This is "interactive" mode, so you can shell in to execute lmp.
+14
View File
@@ -1,3 +1,17 @@
# 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.
apiVersion: trainer.kubeflow.org/v1alpha1
kind: ClusterTrainingRuntime
metadata:
+14
View File
@@ -1,3 +1,17 @@
# 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.
# This was developed on AWS g4dn.xlarge, Tesla T4 GPUs
# eksctl create cluster --config-file ./eks-config-gpu.yaml
# eksctl delete cluster --config-file ./eks-config-gpu.yaml --wait
+14
View File
@@ -1,3 +1,17 @@
# 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.
# This example deploys the LAMMPS Molecular Dynamic Simulator
# with MPI orchestrated by the Flux workload manager on 4 nodes.
# The problem size is defined by the coordinates x,y,z, and the
+14
View File
@@ -1,3 +1,17 @@
# 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.
# Example 1: Multi-Node Distributed Training
#
# Multi-node distributed PyTorch training on the default torch-distributed
+14
View File
@@ -1,3 +1,17 @@
# 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.
# Example 2: Runtime Patches
#
# Pod customization with the runtimePatches API. Each patch is keyed by a
+14
View File
@@ -1,3 +1,17 @@
# 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.
# Advanced Example 2: Kueue Integration
#
# Queue-based scheduling and quota management with Kueue. The TrainJob is
+14
View File
@@ -1,3 +1,17 @@
# 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.
# Advanced Example 3: Volcano Gang Scheduling
#
# Gang scheduling guarantees that all training pods start together (or none
+14
View File
@@ -1,3 +1,17 @@
# 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.
# Advanced Example 4: Multi-Step Training with Dataset Initialization
#
# Runs a dataset-initializer Job that downloads a HuggingFace dataset, then
+14
View File
@@ -1,3 +1,17 @@
# 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.
version: v2.12.1
name: golangci-lint-kube-api-linter
destination: ./bin
+15
View File
@@ -0,0 +1,15 @@
{{- /*
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.
*/ -}}
+112 -28
View File
@@ -16,9 +16,18 @@
"""Verify boilerplate copyright headers in source files.
Policy:
- Files that already contain a copyright year are accepted.
- Files without a year must match the year-less boilerplate template.
Two checks are applied:
1. All files: the header must match the boilerplate template once any
copyright year is normalized out, so a year-bearing header and a
year-less header both validate against the single year-less template.
2. New files (added relative to the base branch): the header must
additionally be year-less; a hardcoded copyright year is rejected.
New-file detection compares against the base branch (--base-ref, default
$TARGET_BRANCH or master), resolved as origin/<ref> then <ref>. If the base
cannot be resolved, or files cannot be listed, the run fails rather than
passing vacuously.
Reference: https://github.com/kubernetes/steering/issues/299
"""
@@ -29,18 +38,24 @@ import os
import re
import subprocess
import sys
from typing import Dict, List, Optional, Tuple
from typing import Dict, List, Optional, Set, Tuple
# Maps file extension (or special basename) to the boilerplate template
# stem on disk (boilerplate.<stem>.txt). One template is reused across
# all hash-comment languages.
# stem on disk (boilerplate.<stem>.txt). The "sh" stem is reused for every
# hash-comment language (bash, py, Dockerfile, yaml, yml). "helm" (also used
# for gotmpl) maps to boilerplate.helm.txt for Go-template comments, and
# go / rs have their own templates.
EXTENSION_TEMPLATES = {
"go": "go",
"helm": "helm",
"gotmpl": "helm",
"rs": "rs",
"sh": "sh",
"bash": "sh",
"py": "sh",
"Dockerfile": "sh",
"yaml": "sh",
"yml": "sh",
}
# Template used for code-generated Go files (DO NOT EDIT). Loaded from
@@ -48,10 +63,12 @@ EXTENSION_TEMPLATES = {
GENERATED_GO_TEMPLATE = "generatego"
# Regex patterns
_RE_ANY_YEAR = re.compile(r"Copyright \d{4} ")
_RE_ANY_YEAR = re.compile(r"Copyright \d{4}")
_RE_YEAR_STRIP = re.compile(r"(Copyright )\d{4}(?:-\d{4})? ")
_RE_GO_BUILD_CONSTRAINTS = re.compile(r"^(//(go:build| \+build).*\n)+\n", re.MULTILINE)
_RE_SHEBANG = re.compile(r"^(#!.*\n)\n*")
_RE_GENERATED = re.compile(r"DO NOT EDIT", re.MULTILINE)
_RE_HELM_TEMPLATE = re.compile(r"(?:^|/)charts/[^/]+/templates/.*\.(?:ya?ml|tpl)$")
def find_root_dir() -> str:
@@ -68,6 +85,32 @@ def find_root_dir() -> str:
return os.getcwd()
def base_tree_files(base_ref: str, rootdir: str) -> Optional[Set[str]]:
"""Repo-relative paths at the merge-base of the base branch and HEAD.
Tries origin/<base_ref> then <base_ref>. Returns None if neither
resolves, so the caller can fail rather than skip the new-file check.
"""
for ref in (f"origin/{base_ref}", base_ref):
try:
base = subprocess.run(
["git", "-C", rootdir, "merge-base", ref, "HEAD"],
capture_output=True,
text=True,
check=True,
).stdout.strip()
tree = subprocess.run(
["git", "-C", rootdir, "ls-tree", "-r", "--name-only", base],
capture_output=True,
text=True,
check=True,
)
except (subprocess.CalledProcessError, FileNotFoundError):
continue
return {line for line in tree.stdout.splitlines() if line}
return None
def load_templates(boilerplate_dir: str) -> Dict[str, List[str]]:
"""Load boilerplate templates as {stem: [line, ...]}."""
templates: Dict[str, List[str]] = {}
@@ -80,6 +123,9 @@ def load_templates(boilerplate_dir: str) -> Dict[str, List[str]]:
def template_stem_for(filename: str) -> Optional[str]:
"""Return the template stem for filename, or None to skip."""
normalized = filename.replace(os.sep, "/")
if _RE_HELM_TEMPLATE.search(normalized):
return "helm"
basename = os.path.basename(filename)
if basename == "Dockerfile" or basename.startswith("Dockerfile."):
return EXTENSION_TEMPLATES.get("Dockerfile")
@@ -87,11 +133,13 @@ def template_stem_for(filename: str) -> Optional[str]:
return EXTENSION_TEMPLATES.get(ext)
def list_git_files(rootdir: str) -> List[str]:
def list_git_files(rootdir: str) -> Optional[List[str]]:
"""List files git considers part of the working tree.
Includes tracked files plus untracked-not-ignored files, so newly
added files are checked but build artifacts and __pycache__ are not.
Returns None if git fails, so the caller can fail rather than treat a
broken listing as "no files".
"""
try:
result = subprocess.run(
@@ -108,13 +156,14 @@ def list_git_files(rootdir: str) -> List[str]:
text=True,
check=True,
)
except (subprocess.CalledProcessError, FileNotFoundError):
return []
except (subprocess.CalledProcessError, FileNotFoundError) as e:
print(f"ERROR: 'git ls-files' failed: {e}", file=sys.stderr)
return None
return [os.path.join(rootdir, line) for line in result.stdout.splitlines() if line]
def collect_files(rootdir: str, filenames: Optional[List[str]]) -> List[str]:
"""Return the files to check."""
def collect_files(rootdir: str, filenames: Optional[List[str]]) -> Optional[List[str]]:
"""Return the files to check, or None if the git listing failed."""
if filenames:
candidates: List[str] = []
for f in filenames:
@@ -124,17 +173,25 @@ def collect_files(rootdir: str, filenames: Optional[List[str]]) -> List[str]:
for root, _, names in os.walk(f):
for name in names:
candidates.append(os.path.join(root, name))
else:
candidates = list_git_files(rootdir)
return sorted(candidates)
return sorted(candidates)
files = list_git_files(rootdir)
if files is None:
return None
return sorted(files)
def file_passes(
filename: str,
templates: Dict[str, List[str]],
new_file: bool = False,
) -> Tuple[bool, Optional[str]]:
"""Check that filename starts with the expected boilerplate header."""
"""Verify filename's boilerplate header.
Check 1 (all files): the header must equal the template after any
copyright year is normalized out.
Check 2 (new files): the header must be year-less.
"""
stem = template_stem_for(filename)
if stem is None or stem not in templates:
return True, None
@@ -162,21 +219,23 @@ def file_passes(
lines = data.splitlines()
header_lines = lines[: len(ref)]
# Policy: any file whose header already contains "Copyright YYYY"
# is accepted as-is. Those headers were reviewed when the file
# landed; re-validating them on every CI run adds little. Trade-off:
# a copy-paste with a different holder (e.g. "Copyright 2025 ACME")
# would slip through. New files must use the year-less template.
for line in header_lines:
if _RE_ANY_YEAR.search(line):
return True, None
if len(lines) < len(ref):
return False, "File is shorter than the expected boilerplate header"
if header_lines != ref:
# Check 1: the header must match the template once the copyright year is
# normalized out, so year-bearing and year-less headers both validate.
normalized = [_RE_YEAR_STRIP.sub(r"\1", line) for line in header_lines]
if normalized != ref:
return False, "Header does not match the boilerplate template"
# Check 2: files added on this branch must not hardcode a copyright year.
if new_file and any(_RE_ANY_YEAR.search(line) for line in header_lines):
return (
False,
"New file must use the year-less header "
"(remove the hardcoded copyright year)",
)
return True, None
@@ -219,6 +278,14 @@ def parse_args() -> argparse.Namespace:
default=None,
help="Root directory to scan (default: auto-detect via git)",
)
parser.add_argument(
"--base-ref",
default=os.environ.get("TARGET_BRANCH", "master"),
help=(
"Base branch for new-file detection (default: $TARGET_BRANCH or "
"master). Resolved as origin/<ref> then <ref>."
),
)
return parser.parse_args()
@@ -235,10 +302,27 @@ def main() -> int:
)
return 1
files = collect_files(rootdir, args.filenames or None)
if files is None:
print("ERROR: could not list repository files via git.", file=sys.stderr)
return 1
base = base_tree_files(args.base_ref, rootdir)
if base is None:
print(
"ERROR: could not resolve a base ref for new-file detection "
f"(tried origin/{args.base_ref}, {args.base_ref}). Ensure the base "
"branch is fetched (actions/checkout fetch-depth: 0) or pass "
"--base-ref.",
file=sys.stderr,
)
return 1
failed: List[Tuple[str, Optional[str]]] = []
for filepath in collect_files(rootdir, args.filenames or None):
for filepath in files:
relpath = os.path.relpath(filepath, rootdir).replace(os.sep, "/")
passes, error = file_passes(filepath, templates)
new_file = relpath not in base
passes, error = file_passes(filepath, templates, new_file=new_file)
if not passes:
failed.append((relpath, error))
print(relpath) # stdout stays parseable
+14
View File
@@ -1,3 +1,17 @@
# 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.
# With GPU A10-2, the runner were queued for long time due to host capacity limit of CNCF Runner
# Check for dicussion: https://cloud-native.slack.com/archives/C08P4HUFQ6M/p1773430783406709
+14
View File
@@ -1,3 +1,17 @@
# 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.
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
@@ -1,3 +1,17 @@
# 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.
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
@@ -1,3 +1,17 @@
# 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.
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
@@ -1,3 +1,17 @@
# 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.
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
@@ -1,3 +1,17 @@
# 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.
apiVersion: config.trainer.kubeflow.org/v1alpha1
kind: Configuration
# Health configuration
+14
View File
@@ -1,3 +1,17 @@
# 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.
resources:
- manager.yaml
+14
View File
@@ -1,3 +1,17 @@
# 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.
---
apiVersion: apps/v1
kind: Deployment
@@ -1,3 +1,17 @@
# 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.
apiVersion: apps/v1
kind: Deployment
metadata:
+14
View File
@@ -1,3 +1,17 @@
# 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.
resources:
- role.yaml
- role_binding.yaml

Some files were not shown because too many files have changed in this diff Show More