From f31c79d2107579ec00085c260b293d62fd74aabe Mon Sep 17 00:00:00 2001 From: Jeremi Piotrowski Date: Fri, 3 Mar 2023 09:37:25 +0100 Subject: [PATCH 1/4] workflows: static-checks: Remove TRAVIS_XXX variables These variables are unused since we don't use travis CI. This also allows to remove two steps: - 'Setup GOPATH' only printed variables - 'Setup travis reference' modified some shell local variables that don't have any influence on the rest of the steps The TRAVIS var is still used by tools/osbuilder/tests to determine if virtualization is available. Fixes: #3544 Signed-off-by: Jeremi Piotrowski --- .github/workflows/static-checks.yaml | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/.github/workflows/static-checks.yaml b/.github/workflows/static-checks.yaml index 8d9858500b..1a995dca53 100644 --- a/.github/workflows/static-checks.yaml +++ b/.github/workflows/static-checks.yaml @@ -20,9 +20,6 @@ jobs: - "sudo -E PATH=\"$PATH\" make test" env: TRAVIS: "true" - TRAVIS_BRANCH: ${{ github.base_ref }} - TRAVIS_PULL_REQUEST_BRANCH: ${{ github.head_ref }} - TRAVIS_PULL_REQUEST_SHA : ${{ github.event.pull_request.head.sha }} RUST_BACKTRACE: "1" target_branch: ${{ github.base_ref }} steps: @@ -52,23 +49,11 @@ jobs: fi echo "Check passed" fi - - name: Setup GOPATH - if: ${{ !contains(github.event.pull_request.labels.*.name, 'force-skip-ci') }} - run: | - echo "TRAVIS_BRANCH: ${TRAVIS_BRANCH}" - echo "TRAVIS_PULL_REQUEST_BRANCH: ${TRAVIS_PULL_REQUEST_BRANCH}" - echo "TRAVIS_PULL_REQUEST_SHA: ${TRAVIS_PULL_REQUEST_SHA}" - echo "TRAVIS: ${TRAVIS}" - name: Set env if: ${{ !contains(github.event.pull_request.labels.*.name, 'force-skip-ci') }} run: | echo "GOPATH=${{ github.workspace }}" >> $GITHUB_ENV echo "${{ github.workspace }}/bin" >> $GITHUB_PATH - - name: Setup travis references - if: ${{ !contains(github.event.pull_request.labels.*.name, 'force-skip-ci') }} - run: | - echo "TRAVIS_BRANCH=${TRAVIS_BRANCH:-$(echo $GITHUB_REF | awk 'BEGIN { FS = \"/\" } ; { print $3 }')}" - target_branch=${TRAVIS_BRANCH} - name: Setup if: ${{ !contains(github.event.pull_request.labels.*.name, 'force-skip-ci') }} run: | From 439ff9d4c49e6078a3394872fbc524dcdfe224e9 Mon Sep 17 00:00:00 2001 From: Jeremi Piotrowski Date: Fri, 3 Mar 2023 11:19:38 +0100 Subject: [PATCH 2/4] tools/osbuilder/tests: Remove TRAVIS variable The last remaining user of the TRAVIS variable in this repo is tools/osbuilder/tests and it is only used to skip spinning up VMs. Travis didn't support virtualization and the same is true for github actions hosted runners. Replace the variable with KVM_MISSING and determine availability of /dev/kvm at runtime. TRAVIS is also used by '.ci/setup.sh' in kata-containers/tests to reduce the set of dependencies that gets installed, but this is also in the process of being removed. Fixes: #3544 Signed-off-by: Jeremi Piotrowski --- .github/workflows/static-checks.yaml | 1 - tools/osbuilder/tests/test_images.sh | 15 ++++++--------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/.github/workflows/static-checks.yaml b/.github/workflows/static-checks.yaml index 1a995dca53..0117dd4e7e 100644 --- a/.github/workflows/static-checks.yaml +++ b/.github/workflows/static-checks.yaml @@ -19,7 +19,6 @@ jobs: - "make test" - "sudo -E PATH=\"$PATH\" make test" env: - TRAVIS: "true" RUST_BACKTRACE: "1" target_branch: ${{ github.base_ref }} steps: diff --git a/tools/osbuilder/tests/test_images.sh b/tools/osbuilder/tests/test_images.sh index 338e5d3ada..945ae8783c 100755 --- a/tools/osbuilder/tests/test_images.sh +++ b/tools/osbuilder/tests/test_images.sh @@ -32,6 +32,7 @@ readonly KATA_HYPERVISOR="${KATA_HYPERVISOR:-}" readonly KATA_DEV_MODE="${KATA_DEV_MODE:-}" readonly ci_results_dir="/var/osbuilder/tests" readonly dracut_dir=${project_dir}/dracut +readonly KVM_MISSING="$([ -e /dev/kvm ] || echo true)" build_images=1 build_initrds=1 @@ -166,7 +167,7 @@ exit_handler() rm -rf "${tmp_dir}" # Restore the default image in config file - [ -n "${TRAVIS:-}" ] || run_mgr configure-image + [ -n "${KVM_MISSING:-}" ] || run_mgr configure-image return fi @@ -258,8 +259,7 @@ set_runtime() [ -n "${KATA_DEV_MODE}" ] && return - # Travis doesn't support VT-x - [ -n "${TRAVIS:-}" ] && return + [ -n "${KVM_MISSING:-}" ] && return if [ "$KATA_HYPERVISOR" != "firecracker" ]; then if [ -f "$sysconfig_docker_config_file" ]; then @@ -285,8 +285,7 @@ setup() sudo -E mkdir -p ${ci_results_dir} fi - # Travis doesn't support VT-x - [ -n "${TRAVIS:-}" ] && return + [ -n "${KVM_MISSING:-}" ] && return [ ! -d "${tests_repo_dir}" ] && git clone "https://${tests_repo}" "${tests_repo_dir}" @@ -383,8 +382,7 @@ install_image_create_container() [ -z "$file" ] && die "need file" [ ! -e "$file" ] && die "file does not exist: $file" - # Travis doesn't support VT-x - [ -n "${TRAVIS:-}" ] && return + [ -n "${KVM_MISSING:-}" ] && return showKataRunFailure=1 run_mgr reset-config @@ -401,8 +399,7 @@ install_initrd_create_container() [ -z "$file" ] && die "need file" [ ! -e "$file" ] && die "file does not exist: $file" - # Travis doesn't support VT-x - [ -n "${TRAVIS:-}" ] && return + [ -n "${KVM_MISSING:-}" ] && return showKataRunFailure=1 run_mgr reset-config From e68186d9af0d7e41c6eb73e04000d2ebfc3ebe27 Mon Sep 17 00:00:00 2001 From: Jeremi Piotrowski Date: Fri, 3 Mar 2023 11:23:42 +0100 Subject: [PATCH 3/4] workflows: static-checks: Set GOPATH only once {{ runner.workspace }}/kata-containers and {{ github.workspace }} resolve to the same value, but they're being used multiple times in the workflow. Remove multiple definitions and define the GOPATH var at job level once. Signed-off-by: Jeremi Piotrowski --- .github/workflows/static-checks.yaml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/.github/workflows/static-checks.yaml b/.github/workflows/static-checks.yaml index 0117dd4e7e..9b2103f995 100644 --- a/.github/workflows/static-checks.yaml +++ b/.github/workflows/static-checks.yaml @@ -21,6 +21,7 @@ jobs: env: RUST_BACKTRACE: "1" target_branch: ${{ github.base_ref }} + GOPATH: ${{ github.workspace }} steps: - name: Checkout code uses: actions/checkout@v3 @@ -31,8 +32,6 @@ jobs: uses: actions/setup-go@v3 with: go-version: 1.19.3 - env: - GOPATH: ${{ runner.workspace }}/kata-containers - name: Check kernel config version run: | cd "${{ github.workspace }}/src/github.com/${{ github.repository }}" @@ -48,17 +47,14 @@ jobs: fi echo "Check passed" fi - - name: Set env + - name: Set PATH if: ${{ !contains(github.event.pull_request.labels.*.name, 'force-skip-ci') }} run: | - echo "GOPATH=${{ github.workspace }}" >> $GITHUB_ENV echo "${{ github.workspace }}/bin" >> $GITHUB_PATH - name: Setup if: ${{ !contains(github.event.pull_request.labels.*.name, 'force-skip-ci') }} run: | cd ${GOPATH}/src/github.com/${{ github.repository }} && ./ci/setup.sh - env: - GOPATH: ${{ runner.workspace }}/kata-containers - name: Installing rust if: ${{ !contains(github.event.pull_request.labels.*.name, 'force-skip-ci') }} run: | From 462d4a1af257642a8c669e3914fb6c1fe0bfa580 Mon Sep 17 00:00:00 2001 From: Jeremi Piotrowski Date: Fri, 3 Mar 2023 11:35:24 +0100 Subject: [PATCH 4/4] workflows: static-checks: Free disk space before running checks We've been seeing the 'sudo make test' job occasionally run out of space in /tmp, which is part of the root filesystem. Removing dotnet and `AGENT_TOOLSDIRECTORY` frees around 10GB of space and in my tests the job still has 13GB of space left after running. Fixes: #6401 Signed-off-by: Jeremi Piotrowski --- .github/workflows/static-checks.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/static-checks.yaml b/.github/workflows/static-checks.yaml index 9b2103f995..9060814535 100644 --- a/.github/workflows/static-checks.yaml +++ b/.github/workflows/static-checks.yaml @@ -23,6 +23,10 @@ jobs: target_branch: ${{ github.base_ref }} GOPATH: ${{ github.workspace }} steps: + - name: Free disk space + run: | + sudo rm -rf /usr/share/dotnet + sudo rm -rf "$AGENT_TOOLSDIRECTORY" - name: Checkout code uses: actions/checkout@v3 with: