Skip to content

Commit

Permalink
test, jenkinsfile: Clean up natnetworks in CI after test run
Browse files Browse the repository at this point in the history
We currently have a flake in CI that is caused by some incorrect
VirtualBox natnetwork configuration. It is currently unclear why the
natnetworks are sometimes created with an incorrect configuration.

Unfortunately, because we don't delete natnetworks at the end of each CI
job, those incorrect natnetworks remains for subsequent runs and the
tests end up failing with the same flake on every single CI job
executed on that node.

This commit adds a cleanup step for natnetworks in our CI. We still
won't run natnetworks when running tests locally, for the same reason we
don't clean up VMs. This change doesn't fix the flake but it should
limit its impact to a single CI job instead of all jobs running on a
node.

Signed-off-by: Paul Chaignon <paul@cilium.io>
  • Loading branch information
pchaigno committed Dec 15, 2022
1 parent 43cb8e9 commit 1732c21
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion jenkinsfiles/ginkgo-kernel.Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ pipeline {
sh 'cd ${TESTDIR}; ./archive_test_results.sh || true'
sh 'cd ${TESTDIR}/..; mv *.zip ${WORKSPACE} || true'
sh 'cd ${TESTDIR}; mv *.xml ${WORKSPACE}/${PROJ_PATH}/test || true'
sh 'cd ${TESTDIR}; vagrant destroy -f || true'
sh 'cd ${TESTDIR}; ./vagrant_cleanup.sh || true'
archiveArtifacts artifacts: '*.zip'
junit testDataPublishers: [[$class: 'AttachmentPublisher']], testResults: 'src/github.com/cilium/cilium/test/*.xml'
}
Expand Down
2 changes: 1 addition & 1 deletion jenkinsfiles/ginkgo-runtime-kernel.Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ pipeline {
sh 'cd ${TESTDIR}; ./archive_test_results_eks.sh || true'
sh 'cd ${TESTDIR}/..; mv *.zip ${WORKSPACE} || true'
sh 'cd ${TESTDIR}; mv *.xml ${WORKSPACE}/${PROJ_PATH}/test || true'
sh 'cd ${TESTDIR}; vagrant destroy -f || true'
sh 'cd ${TESTDIR}; ./vagrant_cleanup.sh || true'
archiveArtifacts artifacts: '*.zip'
junit testDataPublishers: [[$class: 'AttachmentPublisher']], testResults: 'src/github.com/cilium/cilium/test/*.xml'
}
Expand Down
13 changes: 13 additions & 0 deletions test/vagrant_cleanup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

K8S_NODES="${K8S_NODES:-2}"

vagrant destroy -f

i=1
while [ "$i" -le "$K8S_NODES" ]; do
VBoxManage natnetwork remove --netname natnet$i
i=$((i+1))
done

VBoxManage natnetwork list

0 comments on commit 1732c21

Please sign in to comment.