Skip to content

Pr/olsajiri/override user #323

Pr/olsajiri/override user

Pr/olsajiri/override user #323

Workflow file for this run

name: Lint Kubernetes CRDs
on:
push:
branches:
- main
- v*
paths:
- pkg/k8s/**
- .github/workflows/lint-k8s.yaml
pull_request:
paths:
- pkg/k8s/**
- .github/workflows/lint-k8s.yaml
jobs:
check-k8s-generated:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
fetch-depth: 0
- name: Install Go
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
with:
# renovate: datasource=golang-version depName=go
go-version: "1.25.1"
- name: Go version
run: go version
- name: Validate that generated files are up to date.
run: |
set -ex
# Don't run 'make crds' here, as it duplicates vendoring checks.
make -C pkg/k8s vendor generate
test -z "$(git status --porcelain)"
if [ $? != 0 ]; then
git status
git diff
echo "Kubernetes CRDs generated files are outdated."
echo "Please run 'make crds' and submit your changes."; exit 1
fi
check-crd-version:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
fetch-depth: 0
- name: Check for CRD changes and version update
run: |
crd_changed=0
version_changed=0
# Check for CRD changes
crd_changes=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} -- pkg/k8s/apis/cilium.io/client/crds/v1alpha1/*.yaml)
if [ -n "$crd_changes" ]; then
crd_changed=1
fi
# Check for version variable changes
old_version=$(git show ${{ github.event.pull_request.base.sha }}:pkg/k8s/apis/cilium.io/v1alpha1/version.go | sed -n 's/^const CustomResourceDefinitionSchemaVersion = "\(.*\)".*/\1/p')
new_version=$(sed -n 's/^const CustomResourceDefinitionSchemaVersion = "\(.*\)".*/\1/p' pkg/k8s/apis/cilium.io/v1alpha1/version.go)
echo "old_version=$old_version"
echo "new_version=$new_version"
if [ "$old_version" != "$new_version" ]; then
version_changed=1
fi
if [ "$crd_changed" -eq 1 ] && [ "$version_changed" -eq 0 ]; then
echo "Changes to the files pkg/k8s/apis/cilium.io/client/crds/v1alpha1/*.yaml requires CustomResourceDefinitionSchemaVersion to be updated in pkg/k8s/apis/cilium.io/v1alpha1/version.go"
exit 1
fi