Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
110 changes: 110 additions & 0 deletions .github/workflows/dev_validation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ jobs:
name: Filter changed paths
outputs:
helm_templates: ${{ steps.paths_filter.outputs.helm_templates }}
vm_route_forge: ${{ steps.paths_filter.outputs.vm_route_forge }}
steps:
# For pull requests it's not necessary to checkout the code, this action uses Github API.
- uses: dorny/paths-filter@v3
Expand All @@ -50,6 +51,8 @@ jobs:
- .helmignore
- Chart.yaml
- Taskfile.yaml
route_forge:
- 'images/vm-route-forge/bpf/route_watcher.c'

no_cyrillic:
if: "!contains(github.event.pull_request.labels.*.name, 'validation/skip/no_cyrillic')"
Expand Down Expand Up @@ -147,3 +150,110 @@ jobs:
- name: Run validation "Helm templates"
run: |
task validation:helm-templates

check_gens_files:
name: Check auto-generated files are up-to-date
needs: paths_filter
runs-on: ubuntu-latest
strategy:
matrix:
# Define two groups of components with their respective Go versions
components:
- { component: virtualization-artifact, go-version: "1.23.9" }
- { component: vm-route-forge, go-version: "1.23.9" }
- { component: api, go-version: "1.22.7" }

steps:
- name: Set skip flag
run: |
# Only run vm-route-forge if relevant files were changed
if [[ "${{ needs.paths_filter.outputs.vm_route_forge }}" == "true" ]]; then
echo "route_forge_skip=false" >> $GITHUB_ENV
else
echo "route_forge_skip=true" >> $GITHUB_ENV
fi

- name: Setup Go ${{ matrix.components.go-version }}
if: matrix.components.component != 'vm-route-forge' || env.route_forge_skip != 'true'
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.components.go-version }}

- name: Install Task
if: matrix.components.component != 'vm-route-forge' || env.route_forge_skip != 'true'
uses: arduino/setup-task@v2
with:
version: 3.37.2

- name: Install dependencies
if: matrix.components.component != 'vm-route-forge' || env.route_forge_skip != 'true'
run: |
echo "Install packages"
export DEBIAN_FRONTEND=noninteractive
sudo apt-get update
sudo apt-get install -y -qq \
llvm linux-headers-generic clang \
libbpf-dev uuid-runtime \
gcc-multilib yq
sudo apt-get clean

- uses: actions/checkout@v4
if: matrix.components.component != 'vm-route-forge' || env.route_forge_skip != 'true'
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}

- name: Run check gen files - ${{ matrix.components.component }}
if: matrix.components.component != 'vm-route-forge' || env.route_forge_skip != 'true'
run: |
function check_diffs() {
local folder=$1
if ! git diff --exit-code; then
echo "Error: Some generated files are out of date. Run 'go generate' and commit the changes."
echo "::group::📂 Diffs for ${{ matrix.components.component }}"
echo "=== git diff ==="
git diff origin/main -- "$folder"
echo "=== end git diff ==="
echo "::endgroup::"
exit 1
else
echo "✅ No differences found in '$folder'. All files are up to date."
fi
}

case "${{ matrix.components.component }}" in
virtualization-artifact)
cd ./images/virtualization-artifact
echo "Installing go dependencies..."
go install github.com/matryer/[email protected]
go install github.com/onsi/ginkgo/v2/[email protected]
cd ..
task controller:dev:gogenerate
check_diffs ./images/virtualization-artifact
;;
vm-route-forge)
task vm-route-forge:gen
check_diffs ./images/vm-route-forge
;;
api)
cd ./api
export GOPATH=$(go env GOPATH)
echo "GOPATH=$GOPATH" >> $GITHUB_ENV
echo "Installing k8s tools..."
go get k8s.io/[email protected]
go install github.com/matryer/[email protected]

go install -mod=readonly sigs.k8s.io/controller-tools/cmd/[email protected]
go install -mod=readonly k8s.io/kube-openapi/cmd/openapi-gen

echo "Run generate"
task generate
# task controller:api:generate
cd ..
check_diffs ./api
;;
*)
echo "❌ Unknown component: ${{ matrix.components.component }}"
exit 1
;;
esac
4 changes: 4 additions & 0 deletions api/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,21 @@ require (
github.com/openshift/custom-resource-status v1.1.2 // indirect
github.com/pborman/uuid v1.2.1 // indirect
github.com/pkg/errors v0.9.1 // indirect
golang.org/x/mod v0.14.0 // indirect
golang.org/x/net v0.19.0 // indirect
golang.org/x/oauth2 v0.12.0 // indirect
golang.org/x/sys v0.16.0 // indirect
golang.org/x/term v0.15.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/time v0.3.0 // indirect
golang.org/x/tools v0.16.1 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/protobuf v1.34.2 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/code-generator v0.29.2 // indirect
k8s.io/gengo v0.0.0-20230829151522-9cce18d56c01 // indirect
k8s.io/klog/v2 v2.110.1 // indirect
k8s.io/utils v0.0.0-20230726121419-3b25d923346b // indirect
kubevirt.io/containerized-data-importer-api v1.57.0-alpha1 // indirect
Expand Down
6 changes: 6 additions & 0 deletions api/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,8 @@ golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro=
golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0=
golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
Expand Down Expand Up @@ -346,8 +348,12 @@ k8s.io/apimachinery v0.29.2/go.mod h1:6HVkd1FwxIagpYrHSwJlQqZI3G9LfYWRPAkUvLnXTK
k8s.io/client-go v0.29.2 h1:FEg85el1TeZp+/vYJM7hkDlSTFZ+c5nnK44DJ4FyoRg=
k8s.io/client-go v0.29.2/go.mod h1:knlvFZE58VpqbQpJNbCbctTVXcd35mMyAAwBdpt4jrA=
k8s.io/code-generator v0.23.3/go.mod h1:S0Q1JVA+kSzTI1oUvbKAxZY/DYbA/ZUb4Uknog12ETk=
k8s.io/code-generator v0.29.2 h1:c9/iw2KnNpw2IRV+wwuG/Wns2TjPSgjWzbbjTevyiHI=
k8s.io/code-generator v0.29.2/go.mod h1:FwFi3C9jCrmbPjekhaCYcYG1n07CYiW1+PAPCockaos=
k8s.io/gengo v0.0.0-20210813121822-485abfe95c7c/go.mod h1:FiNAH4ZV3gBg2Kwh89tzAEV2be7d5xI0vBa/VySYy3E=
k8s.io/gengo v0.0.0-20211129171323-c02415ce4185/go.mod h1:FiNAH4ZV3gBg2Kwh89tzAEV2be7d5xI0vBa/VySYy3E=
k8s.io/gengo v0.0.0-20230829151522-9cce18d56c01 h1:pWEwq4Asjm4vjW7vcsmijwBhOr1/shsbSYiWXmNGlks=
k8s.io/gengo v0.0.0-20230829151522-9cce18d56c01/go.mod h1:FiNAH4ZV3gBg2Kwh89tzAEV2be7d5xI0vBa/VySYy3E=
k8s.io/klog/v2 v2.0.0/go.mod h1:PBfzABfn139FHAV07az/IF9Wp1bkk3vpT2XSJ76fSDE=
k8s.io/klog/v2 v2.2.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y=
k8s.io/klog/v2 v2.30.0/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=
Expand Down
15 changes: 7 additions & 8 deletions images/virtualization-artifact/pkg/controller/service/mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading