Skip to content

fix(dvcr): set Cap value for default backoff in dvcr importer #24396

fix(dvcr): set Cap value for default backoff in dvcr importer

fix(dvcr): set Cap value for default backoff in dvcr importer #24396

# Copyright 2024 Flant JSC
#
# 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: Validations
env:
GO_VERSION: "1.24.13"
on:
pull_request:
types: [opened, synchronize, labeled, unlabeled]
concurrency:
group: "${{ github.workflow }}-${{ github.event.number || github.ref }}"
cancel-in-progress: true
defaults:
run:
shell: bash
jobs:
paths_filter:
if: ${{ !contains(github.event.pull_request.labels.*.name, 'validation/skip/helm_templates') }}
runs-on: ubuntu-latest
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
id: paths_filter
with:
filters: |
helm_templates:
- 'crds/**'
- 'charts/**'
- 'tools/kubeconform/**'
- 'templates/**'
- .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')"
runs-on: ubuntu-latest
name: Validation no-cyrillic
steps:
- name: Set up Go ${{ env.GO_VERSION }}
uses: actions/setup-go@v5
with:
go-version: "${{ env.GO_VERSION }}"
- name: Install Task
uses: arduino/setup-task@v2
with:
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: Run validation "No cyrillic"
run: |
task validation:no-cyrillic
doc_changes:
if: "!contains(github.event.pull_request.labels.*.name, 'validation/skip/doc_changes')"
runs-on: ubuntu-latest
name: Validation doc-changes
steps:
- name: Set up Go ${{ env.GO_VERSION }}
uses: actions/setup-go@v5
with:
go-version: "${{ env.GO_VERSION }}"
- name: Install Task
uses: arduino/setup-task@v2
with:
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: Run validation "Doc changes"
run: |
task validation:doc-changes
# Run helm templates validation on changes in related files and without the skip labels.
helm_templates:
needs: paths_filter
if: ${{ needs.paths_filter.outputs.helm_templates == 'true' && !contains(github.event.pull_request.labels.*.name, 'validation/skip/helm_templates') }}
# 22.04 image contains Helm v3.17.2, it is not affected by MaxDecompressedFileSize limit.
# TODO change back to latest after Helm people fix this issue: https://github.com/helm/helm/issues/30738
runs-on: ubuntu-22.04
name: Validate helm templates with OpenAPI schemas
steps:
- name: Install Task
uses: arduino/setup-task@v2
with:
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: azure/setup-helm@v4.3.0
with:
version: v3.17.2
id: install
- uses: actions/checkout@v4
- 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.24.13" }
- { component: vm-route-forge, go-version: "1.24.13" }
- { component: api, go-version: "1.24.13" }
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.x
repo-token: ${{ secrets.GITHUB_TOKEN }}
- 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-$(uname -r) 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 tool
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 install tool
echo "Run generate"
task generate
# task controller:api:generate
cd ..
check_diffs ./api
;;
*)
echo "❌ Unknown component: ${{ matrix.components.component }}"
exit 1
;;
esac