forked from antrea-io/antrea
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The new Go test (TestUpgrade) is meant to be run through the wrapper script ./ci/kind/test-upgrade-antrea.sh. At the moment we test upgrade from versions 0.3.0, 0.4.0 and 0.4.1 as part of CI, but we can modify that set as we go through Antrea releases. We also run the test for every PR against master, which may be a bit excessive. Fixes antrea-io#511
- Loading branch information
1 parent
eb83658
commit 0a1ceb3
Showing
6 changed files
with
374 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
name: Antrea upgrade | ||
on: | ||
pull_request: | ||
branches: | ||
- master | ||
- release-* | ||
push: | ||
branches: | ||
- master | ||
- release-* | ||
jobs: | ||
build-antrea-image: | ||
name: Build Antrea image to be used for Kind upgrade test | ||
runs-on: [ubuntu-18.04] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- run: make | ||
- name: Save Antrea image to tarball | ||
run: docker save -o antrea-ubuntu.tar antrea/antrea-ubuntu:latest | ||
- name: Upload Antrea image for subsequent jobs | ||
uses: actions/upload-artifact@v1 | ||
with: | ||
name: antrea-ubuntu | ||
path: antrea-ubuntu.tar | ||
|
||
from-v0_3_0: | ||
name: Upgrade from Antrea v0.3.0 | ||
needs: build-antrea-image | ||
runs-on: [ubuntu-18.04] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-go@v1 | ||
with: | ||
go-version: 1.13 | ||
- name: Download Antrea image from previous job | ||
uses: actions/download-artifact@v1 | ||
with: | ||
name: antrea-ubuntu | ||
- name: Load Antrea image | ||
run: docker load -i antrea-ubuntu/antrea-ubuntu.tar | ||
- name: Install Kind | ||
env: | ||
KIND_VERSION: v0.7.0 | ||
run: | | ||
curl -Lo ./kind https://github.com/kubernetes-sigs/kind/releases/download/${KIND_VERSION}/kind-$(uname)-amd64 | ||
chmod +x ./kind | ||
sudo mv kind /usr/local/bin | ||
- name: Run test | ||
run: | | ||
./ci/kind/test-upgrade-antrea.sh --from-tag v0.3.0 | ||
from-v0_4_0: # TODO: define an action to avoid repetiion? | ||
name: Upgrade from Antrea v0.4.0 | ||
needs: build-antrea-image | ||
runs-on: [ubuntu-18.04] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-go@v1 | ||
with: | ||
go-version: 1.13 | ||
- name: Download Antrea image from previous job | ||
uses: actions/download-artifact@v1 | ||
with: | ||
name: antrea-ubuntu | ||
- name: Load Antrea image | ||
run: docker load -i antrea-ubuntu/antrea-ubuntu.tar | ||
- name: Install Kind | ||
env: | ||
KIND_VERSION: v0.7.0 | ||
run: | | ||
curl -Lo ./kind https://github.com/kubernetes-sigs/kind/releases/download/${KIND_VERSION}/kind-$(uname)-amd64 | ||
chmod +x ./kind | ||
sudo mv kind /usr/local/bin | ||
- name: Run test | ||
run: | | ||
./ci/kind/test-upgrade-antrea.sh --from-tag v0.4.0 | ||
from-v0_4_1: | ||
name: Upgrade from Antrea v0.4.1 | ||
needs: build-antrea-image | ||
runs-on: [ubuntu-18.04] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-go@v1 | ||
with: | ||
go-version: 1.13 | ||
- name: Download Antrea image from previous job | ||
uses: actions/download-artifact@v1 | ||
with: | ||
name: antrea-ubuntu | ||
- name: Load Antrea image | ||
run: docker load -i antrea-ubuntu/antrea-ubuntu.tar | ||
- name: Install Kind | ||
env: | ||
KIND_VERSION: v0.7.0 | ||
run: | | ||
curl -Lo ./kind https://github.com/kubernetes-sigs/kind/releases/download/${KIND_VERSION}/kind-$(uname)-amd64 | ||
chmod +x ./kind | ||
sudo mv kind /usr/local/bin | ||
- name: Run test | ||
run: | | ||
./ci/kind/test-upgrade-antrea.sh --from-tag v0.4.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Copyright 2020 Antrea Authors | ||
# | ||
# 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. | ||
|
||
set -eo pipefail | ||
|
||
function echoerr { | ||
>&2 echo "$@" | ||
} | ||
|
||
FROM_TAG= | ||
|
||
_usage="Usage: $0 --from-tag <TAG> | ||
Perform some basic tests to make sure that Antrea can be upgraded from <TAG> to the current checked-out version. | ||
--from-tag Upgrade from this version of Antrea (pulled from upstream Antrea) to the current version. | ||
--help, -h Print this message and exit | ||
" | ||
|
||
function print_usage { | ||
echoerr "$_usage" | ||
} | ||
|
||
function print_help { | ||
echoerr "Try '$0 --help' for more information." | ||
} | ||
|
||
THIS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" | ||
ROOT_DIR=$THIS_DIR/../.. | ||
|
||
while [[ $# -gt 0 ]] | ||
do | ||
key="$1" | ||
|
||
case $key in | ||
--from-tag) | ||
FROM_TAG="$2" | ||
shift 2 | ||
;; | ||
-h|--help) | ||
print_usage | ||
exit 0 | ||
;; | ||
*) # unknown option | ||
echoerr "Unknown option $1" | ||
exit 1 | ||
;; | ||
esac | ||
done | ||
|
||
rc=0 | ||
# adding retry since there seems to be some transient failures when this is run | ||
# in CI as part of a Github workflow. | ||
curl -s --retry 5 --retry-delay 1 https://api.github.com/repos/vmware-tanzu/antrea/releases/tags/$FROM_TAG | grep -q tag_name || rc=$? | ||
if [ $rc -ne 0 ]; then | ||
echoerr "$FROM_TAG is not a valid Antrea tag" | ||
exit 1 | ||
fi | ||
|
||
DOCKER_IMAGES=("busybox" "antrea/antrea-ubuntu:$FROM_TAG") | ||
|
||
for img in "${DOCKER_IMAGES[@]}"; do | ||
echo "Pulling $img" | ||
docker pull $img > /dev/null | ||
done | ||
|
||
DOCKER_IMAGES+=("antrea/antrea-ubuntu:latest") | ||
|
||
echo "Creating Kind cluster" | ||
IMAGES="${DOCKER_IMAGES[@]}" | ||
$THIS_DIR/kind-setup.sh create kind --antrea-cni false --images "$IMAGES" | ||
|
||
TMP_ANTREA_DIR=$(mktemp -d) | ||
git clone --branch $FROM_TAG --depth 1 https://github.com/vmware-tanzu/antrea.git $TMP_ANTREA_DIR | ||
pushd $TMP_ANTREA_DIR > /dev/null | ||
export IMG_NAME=antrea/antrea-ubuntu | ||
export IMG_TAG=$FROM_TAG | ||
./hack/generate-manifest.sh --mode release --kind | kubectl apply -f - | ||
./hack/generate-manifest.sh --mode release --kind | docker exec -i kind-control-plane dd of=/root/antrea.yml | ||
popd | ||
rm -rf $TMP_DIR | ||
|
||
$ROOT_DIR/hack/generate-manifest.sh --kind | docker exec -i kind-control-plane dd of=/root/antrea-new.yml | ||
|
||
rc=0 | ||
go test -v -run=TestUpgrade github.com/vmware-tanzu/antrea/test/e2e -provider=kind -upgrade.toYML=antrea-new.yml || rc=$? | ||
|
||
$THIS_DIR/kind-setup.sh destroy kind | ||
|
||
exit $rc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.