Skip to content
This repository was archived by the owner on May 7, 2026. It is now read-only.

feat: Add support for global env registry in kvisor #3663

feat: Add support for global env registry in kvisor

feat: Add support for global env registry in kvisor #3663

Workflow file for this run

name: Build
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build:
name: Build
runs-on: ubuntu-24.04
if: ${{ github.event.head_commit.message != '[Release] Update Chart.yaml' }}
steps:
- name: Free disk space
run: |
echo "Disk usage BEFORE cleanup:"
df -h
echo "Removing hosted toolcache..."
sudo rm -rf /opt/hostedtoolcache || true
echo "Removing .NET..."
sudo rm -rf /usr/share/dotnet || true
echo "Removing Android SDK..."
sudo rm -rf /usr/local/lib/android || true
echo "Removing GHC / Haskell..."
sudo rm -rf /opt/ghc || true
sudo rm -rf /usr/local/.ghcup || true
echo "Disk usage AFTER cleanup:"
df -h
- name: Checkout
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Get head sha
id: parse-commit-sha
run: |
head=$(git rev-parse HEAD)
echo "head_commit_sha=${head}" >> $GITHUB_ENV
echo "Head commit sha ${head}"
- name: Get merge request latest commit
id: parse-commit
if: ${{ github.event_name == 'pull_request' }}
run: |
msg=$(git show -s --format=%s)
echo "head_commit_message=${msg}" >> $GITHUB_ENV
echo "Latest commit: ${msg}"
echo "Env commit ${{env.head_commit_message}}"
echo "Contains msg ${{ contains(env.head_commit_message, '#skip-lint') }}"
- name: Secret Scanning
uses: trufflesecurity/trufflehog@main
with:
extra_args: --only-verified
- name: Setup Go
uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6
with:
go-version-file: "go.mod"
- name: Build agent go binary amd64
run: UNAME_M=x86_64 VERSION=${RELEASE_TAG:-commit-$GITHUB_SHA} make kvisor-agent
- name: Build controller go binary amd64
run: UNAME_M=x86_64 VERSION=${RELEASE_TAG:-commit-$GITHUB_SHA} make kvisor-controller
- name: Build image-scanner go binary amd64
run: UNAME_M=x86_64 VERSION=${RELEASE_TAG:-commit-$GITHUB_SHA} make kvisor-image-scanner
- name: Build linter go binary amd64
run: UNAME_M=x86_64 VERSION=${RELEASE_TAG:-commit-$GITHUB_SHA} make kvisor-linter
- name: Build agent go binary arm64
run: UNAME_M=arm64 VERSION=${RELEASE_TAG:-commit-$GITHUB_SHA} make kvisor-agent
- name: Build controller go binary arm64
run: UNAME_M=arm64 VERSION=${RELEASE_TAG:-commit-$GITHUB_SHA} make kvisor-controller
- name: Build image-scanner go binary arm64
run: UNAME_M=arm64 VERSION=${RELEASE_TAG:-commit-$GITHUB_SHA} make kvisor-image-scanner
- name: Build linter go binary arm64
run: UNAME_M=arm64 VERSION=${RELEASE_TAG:-commit-$GITHUB_SHA} make kvisor-linter
- name: Set up QEMU
uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3
- name: Login to GitHub Container Registry
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker build and push pr (controller)
if: ${{ github.event_name == 'pull_request' }}
uses: docker/build-push-action@471d1dc4e07e5cdedd4c2171150001c434f0b7a4 # v6
with:
context: .
file: ./Dockerfile.controller
platforms: linux/arm64,linux/amd64
push: true
tags: ghcr.io/castai/kvisor/kvisor-controller:${{ env.head_commit_sha }}
- name: Docker build and push pr (agent)
if: ${{ github.event_name == 'pull_request' }}
uses: docker/build-push-action@471d1dc4e07e5cdedd4c2171150001c434f0b7a4 # v6
with:
context: .
file: ./Dockerfile.agent
platforms: linux/arm64,linux/amd64
push: true
tags: ghcr.io/castai/kvisor/kvisor-agent:${{ env.head_commit_sha }}
- name: Docker build and push pr (scanners)
if: ${{ github.event_name == 'pull_request' }}
uses: docker/build-push-action@471d1dc4e07e5cdedd4c2171150001c434f0b7a4 # v6
with:
context: .
file: ./Dockerfile.scanners
platforms: linux/arm64,linux/amd64
push: true
tags: ghcr.io/castai/kvisor/kvisor-scanners:${{ env.head_commit_sha }}
- name: Docker build and push main (controller)
if: ${{ github.event_name != 'pull_request' && github.event_name != 'release'}}
uses: docker/build-push-action@471d1dc4e07e5cdedd4c2171150001c434f0b7a4 # v6
with:
context: .
file: ./Dockerfile.controller
platforms: linux/arm64,linux/amd64
push: true
tags: ghcr.io/castai/kvisor/kvisor-controller:${{ env.head_commit_sha }},ghcr.io/castai/kvisor/kvisor-controller:latest
- name: Docker build and push main (agent)
if: ${{ github.event_name != 'pull_request' && github.event_name != 'release'}}
uses: docker/build-push-action@471d1dc4e07e5cdedd4c2171150001c434f0b7a4 # v6
with:
context: .
file: ./Dockerfile.agent
platforms: linux/arm64,linux/amd64
push: true
tags: ghcr.io/castai/kvisor/kvisor-agent:${{ env.head_commit_sha }},ghcr.io/castai/kvisor/kvisor-agent:latest
- name: Docker build and push main (scanners)
if: ${{ github.event_name != 'pull_request' && github.event_name != 'release'}}
uses: docker/build-push-action@471d1dc4e07e5cdedd4c2171150001c434f0b7a4 # v6
with:
context: .
file: ./Dockerfile.scanners
platforms: linux/arm64,linux/amd64
push: true
tags: ghcr.io/castai/kvisor/kvisor-scanners:${{ env.head_commit_sha }},ghcr.io/castai/kvisor/kvisor-scanners:latest
- name: Run golangci-lint
# You may pin to the exact commit or the version.
# uses: golangci/golangci-lint-action@537aa1903e5d359d0b27dbc19ddd22c5087f3fbc
if: ${{ github.event_name == 'pull_request' && !contains(env.head_commit_message, '#skip-lint') }}
uses: golangci/golangci-lint-action@1e7e51e771db61008b38414a730f564565cf7c20 # v9.2.0
with:
args: -v --timeout=5m
version: v2.8.0
only-new-issues: false
- name: Test
if: ${{ github.event_name == 'pull_request' && !contains(env.head_commit_message, '#skip-test') }}
run: go test -race -short ./...
- name: Summary
run: |
echo "**Pushed docker images:**" >> $GITHUB_STEP_SUMMARY
echo "ghcr.io/castai/kvisor/kvisor-controller:${{ env.head_commit_sha }}" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "ghcr.io/castai/kvisor/kvisor-agent:${{ env.head_commit_sha }}" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "ghcr.io/castai/kvisor/kvisor-scanners:${{ env.head_commit_sha }}" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Upgrade with helm:**" >> $GITHUB_STEP_SUMMARY
echo "helm upgrade castai-kvisor castai-helm/castai-kvisor -n castai-agent --reuse-values --set image.tag=${{ env.head_commit_sha }}" >> $GITHUB_STEP_SUMMARY
helm-test:
name: Test Helm Charts
runs-on: ubuntu-24.04
if: ${{ github.event_name == 'pull_request' }}
steps:
- name: Checkout
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 2
- name: Check for chart changes
id: changes
run: |
if git diff --name-only HEAD^ HEAD | grep -q '^charts/'; then
echo "charts_changed=true" >> $GITHUB_OUTPUT
else
echo "charts_changed=false" >> $GITHUB_OUTPUT
fi
- name: Setup Helm
if: steps.changes.outputs.charts_changed == 'true'
uses: azure/setup-helm@b9e51907a09c216f16ebe8536097933489208112 # v4
# TODO: re-add verification when https://github.com/helm-unittest/helm-unittest/issues/777 is resolved
- name: Install helm-unittest plugin
if: steps.changes.outputs.charts_changed == 'true'
run: helm plugin install https://github.com/helm-unittest/helm-unittest.git --verify=false
- name: Build chart dependencies
if: steps.changes.outputs.charts_changed == 'true'
run: helm dependency build ./charts/kvisor
- name: Run Helm unit tests
if: steps.changes.outputs.charts_changed == 'true'
run: helm unittest -f 'tests/**/test.yaml' ./charts/kvisor
# TODO: we might want to run the tests both in ubuntu-22.04, as well as ubuntu-20.04 to test
# if we everything is working with cgroups v1 and v2
e2e:
name: E2E
runs-on: ubuntu-24.04
if: ${{ github.event_name == 'pull_request' }}
needs: build
steps:
- name: Free disk space
run: |
echo "Disk usage BEFORE cleanup:"
df -h
echo "Removing hosted toolcache..."
sudo rm -rf /opt/hostedtoolcache || true
echo "Removing .NET..."
sudo rm -rf /usr/share/dotnet || true
echo "Removing Android SDK..."
sudo rm -rf /usr/local/lib/android || true
echo "Removing GHC / Haskell..."
sudo rm -rf /opt/ghc || true
sudo rm -rf /usr/local/.ghcup || true
echo "Disk usage AFTER cleanup:"
df -h
- name: Checkout
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Get head sha
id: parse-commit-sha
run: |
head=$(git rev-parse HEAD)
echo "head_commit_sha=${head}" >> $GITHUB_ENV
echo "Head commit sha ${head}"
- name: Setup Go
uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6
with:
go-version-file: "go.mod"
- name: Login to GitHub Container Registry
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Create kind cluster
uses: helm/kind-action@a1b0e391336a6ee6713a0583f8c6240d70863de3 # v1.12.0
with:
config: ./e2e/kind-config.yaml
cluster_name: kvisor-e2e
- name: Run e2e
shell: bash
run: |
KIND_CONTEXT=kvisor-e2e IMAGE_TAG=${{ env.head_commit_sha }} ./e2e/run.sh