Skip to content

Commit

Permalink
Build clickhouse server image in kind test
Browse files Browse the repository at this point in the history
Signed-off-by: Yanjun Zhou <zhouya@vmware.com>
  • Loading branch information
yanjunz97 committed Aug 24, 2022
1 parent fc047e5 commit eecf16a
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 11 deletions.
49 changes: 45 additions & 4 deletions .github/workflows/kind.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,26 @@ jobs:
path: policy-recommendation.tar
retention-days: 1 # minimum value, in case artifact deletion by 'artifact-cleanup' job fails

build-clickhouse-server-image:
name: Build ClickHouse server image to be used for Kind e2e tests
needs: check-changes
if: ${{ needs.check-changes.outputs.has_changes == 'yes' }}
runs-on: [ ubuntu-latest ]
steps:
- uses: actions/checkout@v3
- run: make clickhouse-server
- name: Save ClickHouse server image to tarball
run: docker save -o clickhouse-server.tar antrea/theia-clickhouse-server
- name: Upload ClickHouse server image for subsequent jobs
uses: actions/upload-artifact@v3
with:
name: clickhouse-server
path: clickhouse-server.tar
retention-days: 1 # minimum value, in case artifact deletion by 'artifact-cleanup' job fails

test-e2e-encap:
name: E2e tests on a Kind cluster on Linux
needs: build-policy-recommendation-image
needs: [build-clickhouse-server-image, build-policy-recommendation-image]
runs-on: [ubuntu-latest]
steps:
- name: Free disk space
Expand All @@ -60,14 +77,20 @@ jobs:
- uses: actions/setup-go@v3
with:
go-version: 1.17
- name: Download Theia images from previous jobs
- name: Download Policy Recommendation images from previous jobs
uses: actions/download-artifact@v3
with:
name: policy-recommendation
- name: Download ClickHouse server images from previous jobs
uses: actions/download-artifact@v3
with:
name: clickhouse-server
- name: Load Theia image
run: |
docker load -i policy-recommendation.tar
docker tag antrea/theia-policy-recommendation:latest projects.registry.vmware.com/antrea/theia-policy-recommendation:latest
docker load -i clickhouse-server.tar
docker tag antrea/theia-clickhouse-server:latest projects.registry.vmware.com/antrea/theia-clickhouse-server:latest
- name: Install Kind
run: |
curl -Lo ./kind https://github.com/kubernetes-sigs/kind/releases/download/${KIND_VERSION}/kind-$(uname)-amd64
Expand All @@ -90,6 +113,7 @@ jobs:

test-upgrade-from-N-1:
name: Upgrade from Theia version N-1
needs: build-clickhouse-server-image
runs-on: [ubuntu-latest]
steps:
- name: Free disk space
Expand All @@ -101,6 +125,14 @@ jobs:
- uses: actions/setup-go@v3
with:
go-version: 1.17
- name: Download ClickHouse server images from previous jobs
uses: actions/download-artifact@v3
with:
name: clickhouse-server
- name: Load Theia image
run: |
docker load -i clickhouse-server.tar
docker tag antrea/theia-clickhouse-server:latest projects.registry.vmware.com/antrea/theia-clickhouse-server:latest
- name: Install Kind
run: |
curl -Lo ./kind https://github.com/kubernetes-sigs/kind/releases/download/${KIND_VERSION}/kind-$(uname)-amd64
Expand All @@ -127,12 +159,21 @@ jobs:
# yet.
artifact-cleanup:
name: Delete uploaded images
needs: [build-policy-recommendation-image, test-e2e-encap]
if: ${{ always() && needs.build-policy-recommendation-image.result == 'success' }}
needs:
- build-policy-recommendation-image
- build-clickhouse-server-image
- test-e2e-encap
- test-upgrade-from-N-1
if: ${{ always() && (needs.build-policy-recommendation-image.result == 'success' || needs.build-clickhouse-server-image.result == 'success') }}
runs-on: [ubuntu-latest]
steps:
- name: Delete policy-recommendation
if: ${{ needs.build-policy-recommendation-image.result == 'success' }}
uses: geekyeggo/delete-artifact@v1
with:
name: policy-recommendation
- name: Delete clickhouse-server
if: ${{ needs.build-clickhouse-server-image.result == 'success' }}
uses: geekyeggo/delete-artifact@v1
with:
name: clickhouse-server
4 changes: 3 additions & 1 deletion ci/jenkins/test-vmc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -365,8 +365,9 @@ function deliver_antrea {
docker save -o theia-spark-operator.tar projects.registry.vmware.com/antrea/theia-spark-operator:v1beta2-1.3.3-3.1.1
docker save -o theia-zookeeper.tar projects.registry.vmware.com/antrea/theia-zookeeper:3.8.0

(cd $GIT_CHECKOUT_DIR && make policy-recommendation)
(cd $GIT_CHECKOUT_DIR && make policy-recommendation && make clickhouse-server)
docker save -o theia-policy-recommendation.tar projects.registry.vmware.com/antrea/theia-policy-recommendation:latest
docker save -o theia-clickhouse-server.tar projects.registry.vmware.com/antrea/theia-clickhouse-server:latest

# not sure the exact image tag, so read from yaml
# and we assume the image tag is the same for all images in this yaml
Expand All @@ -390,6 +391,7 @@ function deliver_antrea {
copy_image theia-zookeeper.tar projects.registry.vmware.com/antrea/theia-zookeeper ${IPs[$i]} 3.8.0 true
copy_image theia-spark-operator.tar projects.registry.vmware.com/antrea/theia-spark-operator ${IPs[$i]} v1beta2-1.3.3-3.1.1 true
copy_image theia-policy-recommendation.tar projects.registry.vmware.com/antrea/theia-policy-recommendation ${IPs[$i]} latest true
copy_image theia-clickhouse-server.tar projects.registry.vmware.com/antrea/theia-clickhouse-server ${IPs[$i]} latest true
done
}

Expand Down
4 changes: 2 additions & 2 deletions ci/kind/test-e2e-kind.sh
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ COMMON_IMAGES_LIST=("k8s.gcr.io/e2e-test-images/agnhost:2.29" \
"antrea/flow-aggregator:latest" \
"projects.registry.vmware.com/antrea/theia-clickhouse-operator:0.18.2" \
"projects.registry.vmware.com/antrea/theia-metrics-exporter:0.18.2" \
"projects.registry.vmware.com/antrea/theia-clickhouse-server:latest" \
"projects.registry.vmware.com/antrea/theia-clickhouse-monitor:latest" \
"projects.registry.vmware.com/antrea/theia-zookeeper:3.8.0" \
"projects.registry.vmware.com/antrea/theia-grafana:8.3.3" \
Expand All @@ -124,7 +123,8 @@ for image in "${COMMON_IMAGES_LIST[@]}"; do
done
done

COMMON_IMAGES_LIST+=("projects.registry.vmware.com/antrea/theia-policy-recommendation:latest")
COMMON_IMAGES_LIST+=("projects.registry.vmware.com/antrea/theia-policy-recommendation:latest"\
"projects.registry.vmware.com/antrea/theia-clickhouse-server:latest")
printf -v COMMON_IMAGES "%s " "${COMMON_IMAGES_LIST[@]}"

function setup_cluster {
Expand Down
7 changes: 4 additions & 3 deletions ci/kind/test-upgrade-theia.sh
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ echo "Running upgrade test for tag $THEIA_FROM_TAG"
ANTREA_FROM_TAG=$(grep "$THEIA_FROM_TAG" < $ROOT_DIR/VERSION_MAP | awk '{print $2}')

# From v0.3.0, ClickHouse Image is labeled with Theia version
if version_lt $THEIA_FROM_TAG "v0.3.0"; then
if [[ $THEIA_FROM_TAG == "v0.2.0" || $THEIA_FROM_TAG == "v0.1.0" ]]; then
CLICKHOUSE_FROM_TAG="21.11"
else
CLICKHOUSE_FROM_TAG=$THEIA_FROM_TAG
Expand All @@ -162,8 +162,7 @@ DOCKER_IMAGES=("k8s.gcr.io/e2e-test-images/agnhost:2.29" \
"projects.registry.vmware.com/antrea/theia-clickhouse-monitor:$THEIA_FROM_TAG" \
"projects.registry.vmware.com/antrea/theia-clickhouse-server:$CLICKHOUSE_FROM_TAG" \
"antrea/antrea-ubuntu:latest" \
"projects.registry.vmware.com/antrea/theia-clickhouse-monitor:latest"\
"projects.registry.vmware.com/antrea/theia-clickhouse-server:latest")
"projects.registry.vmware.com/antrea/theia-clickhouse-monitor:latest")

for img in "${DOCKER_IMAGES[@]}"; do
echo "Pulling $img"
Expand All @@ -173,6 +172,8 @@ for img in "${DOCKER_IMAGES[@]}"; do
done
done

DOCKER_IMAGES+=("projects.registry.vmware.com/antrea/theia-clickhouse-server:latest")

echo "Creating Kind cluster"
IMAGES="${DOCKER_IMAGES[@]}"
$THIS_DIR/kind-setup.sh create kind --images "$IMAGES"
Expand Down
5 changes: 4 additions & 1 deletion hack/generate-manifest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,10 @@ if [ "$MODE" == "dev" ] && [ -n "$IMG_NAME" ]; then
HELM_VALUES+=("clickhouse.monitor.image.repository=$IMG_NAME")
fi
if [ "$MODE" == "release" ]; then
HELM_VALUES+=("clickhouse.monitor.image.repository=$IMG_NAME" "clickhouse.monitor.image.tag=$IMG_TAG" "clickhouse.image.tag=$IMG_TAG")
HELM_VALUES+=("clickhouse.monitor.image.repository=$IMG_NAME" "clickhouse.monitor.image.tag=$IMG_TAG")
if [ $IMG_TAG != "v0.1.0" && $IMG_TAG != "v0.2.0" ]; then
HELM_VALUES+=("clickhouse.image.tag=$IMG_TAG")
fi
fi
if [ "$MODE" == "antrea-e2e" ]; then
HELM_VALUES+=("grafana.enable=false" "clickhouse.monitor.enable=false")
Expand Down

0 comments on commit eecf16a

Please sign in to comment.