Skip to content

Commit

Permalink
fix(travis): make upgrade sanity test configurable for different (ope…
Browse files Browse the repository at this point in the history
…nebs-archive#45)

addresses the error caused when images are built with different
IMAGE_ORG and the test fails due to missing tags or 
incompatibility between openebs & other org images

Signed-off-by: shubham <[email protected]>
  • Loading branch information
shubham14bajpai authored Aug 24, 2020
1 parent 449fcee commit 0ff97b1
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 18 deletions.
18 changes: 9 additions & 9 deletions ci/upgrade/cstor-operator.tmp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ spec:
containers:
- name: cspc-operator
imagePullPolicy: IfNotPresent
image: openebs/cspc-operator-amd64:testimage
image: imageorg/cspc-operator-amd64:testimage
env:
- name: OPENEBS_NAMESPACE
valueFrom:
Expand All @@ -53,11 +53,11 @@ spec:
#- name: OPENEBS_IO_CSTOR_POOL_SPARSE_DIR
# value: "/var/openebs/sparse"
- name: OPENEBS_IO_CSPI_MGMT_IMAGE
value: "openebs/cstor-pool-manager-amd64:testimage"
value: "imageorg/cstor-pool-manager-amd64:testimage"
- name: OPENEBS_IO_CSTOR_POOL_IMAGE
value: "openebs/cstor-pool:testimage"
value: "imageorg/cstor-pool:testimage"
- name: OPENEBS_IO_CSTOR_POOL_EXPORTER_IMAGE
value: "openebs/m-exporter:testimage"
value: "imageorg/m-exporter:testimage"
- name: RESYNC_INTERVAL
value: "30"
---
Expand Down Expand Up @@ -89,7 +89,7 @@ spec:
containers:
- name: cvc-operator
imagePullPolicy: IfNotPresent
image: openebs/cvc-operator-amd64:testimage
image: imageorg/cvc-operator-amd64:testimage
env:
# OPENEBS_IO_BASE_DIR is used to configure base directory for openebs on host path.
# Where OpenEBS can store required files. Default base path will be /var/openebs
Expand All @@ -109,11 +109,11 @@ spec:
fieldRef:
fieldPath: spec.serviceAccountName
- name: OPENEBS_IO_CSTOR_TARGET_IMAGE
value: "openebs/cstor-istgt:testimage"
value: "imageorg/cstor-istgt:testimage"
- name: OPENEBS_IO_CSTOR_VOLUME_MGMT_IMAGE
value: "openebs/cstor-volume-manager-amd64:testimage"
value: "imageorg/cstor-volume-manager-amd64:testimage"
- name: OPENEBS_IO_VOLUME_MONITOR_IMAGE
value: "openebs/m-exporter:testimage"
value: "imageorg/m-exporter:testimage"
---
apiVersion: v1
kind: Service
Expand Down Expand Up @@ -159,7 +159,7 @@ spec:
serviceAccountName: openebs-maya-operator
containers:
- name: admission-webhook
image: openebs/cstor-webhook-amd64:testimage
image: imageorg/cstor-webhook-amd64:testimage
imagePullPolicy: IfNotPresent
args:
- -alsologtostderr
Expand Down
4 changes: 2 additions & 2 deletions ci/upgrade/pool.tmp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ spec:
# if required the image prefix of the pool deployments can be
# changed using the flag below, defaults to whatever was present on old
# deployments.
#- "--to-version-image-prefix=openebs/"
- "--to-version-image-prefix=imageorg/"
# if required the image tags for pool deployments can be changed
# to a custom image tag using the flag below,
# defaults to the --to-version mentioned above.
Expand All @@ -58,7 +58,7 @@ spec:

# the image version should be same as the --to-version mentioned above
# in the args of the job
image: openebs/upgrade-amd64:ci
image: imageorg/upgrade-amd64:ci
imagePullPolicy: IfNotPresent
restartPolicy: OnFailure
---
Expand Down
11 changes: 11 additions & 0 deletions ci/upgrade/sanity.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,18 @@

#!/usr/bin/env bash

set -ex

# To enable dev upgardes in travis
make upgrade-image.amd64

# To test the sanity in different customized
# image prefixes
if [[ ${IMAGE_ORG} == "" ]]; then
IMAGE_ORG="openebs";
export IMAGE_ORG;
fi

# To test the sanity in different versioned branches
# and travis tags, get the travis version and corresponding
# image tags
Expand Down Expand Up @@ -35,6 +44,8 @@ fi
export TEST_IMAGE_TAG=${TEST_IMAGE_TAG#v}
export TEST_VERSION=${TEST_VERSION#v}

echo "Testing upgrade for org: $IMAGE_ORG version: $TEST_VERSION imagetag: $TEST_IMAGE_TAG"

# setup openebs & cstor v1 for migration
./ci/upgrade/setup.sh || exit 1
# run migration tests
Expand Down
2 changes: 1 addition & 1 deletion ci/upgrade/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ kubectl wait --for=condition=available --timeout=300s deployment/percona

echo "Upgrade control plane to latest version"

sed "s|testimage|$TEST_IMAGE_TAG|g" ./ci/upgrade/cstor-operator.tmp.yaml | sed "s|testversion|$TEST_VERSION|g" > ./ci/upgrade/cstor-operator.yaml
sed "s|testimage|$TEST_IMAGE_TAG|g" ./ci/upgrade/cstor-operator.tmp.yaml | sed "s|testversion|$TEST_VERSION|g" | sed "s|imageorg|$IMAGE_ORG|g" > ./ci/upgrade/cstor-operator.yaml

kubectl apply -f https://raw.githubusercontent.com/openebs/cstor-operators/master/deploy/csi-operator.yaml \
-f ./ci/upgrade/cstor-operator.yaml
Expand Down
6 changes: 2 additions & 4 deletions ci/upgrade/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@

#!/usr/bin/env bash

set -ex

echo "Upgrading CSPC pool"

sed "s|testimage|$TEST_IMAGE_TAG|g" ./ci/upgrade/pool.tmp.yaml | sed "s|testversion|$TEST_VERSION|g" > ./ci/upgrade/pool.yaml
sed "s|testimage|$TEST_IMAGE_TAG|g" ./ci/upgrade/pool.tmp.yaml | sed "s|testversion|$TEST_VERSION|g" | sed "s|imageorg|$IMAGE_ORG|g" > ./ci/upgrade/pool.yaml
kubectl apply -f ./ci/upgrade/pool.yaml
sleep 5
kubectl wait --for=condition=complete job/upgrade-pool -n openebs --timeout=550s
Expand All @@ -15,7 +13,7 @@ kubectl logs --tail=50 -l job-name=upgrade-pool -n openebs
echo "Upgrading CSI volume"

pvname=$(kubectl get pvc demo-csi-vol-claim -o jsonpath="{.spec.volumeName}")
sed "s|PVNAME|$pvname|g" ./ci/upgrade/volume.tmp.yaml | sed "s|testimage|$TEST_IMAGE_TAG|g" | sed "s|testversion|$TEST_VERSION|g" > ./ci/upgrade/volume.yaml
sed "s|PVNAME|$pvname|g" ./ci/upgrade/volume.tmp.yaml | sed "s|testimage|$TEST_IMAGE_TAG|g" | sed "s|testversion|$TEST_VERSION|g" | sed "s|imageorg|$IMAGE_ORG|g" > ./ci/upgrade/volume.yaml
kubectl apply -f ./ci/upgrade/volume.yaml
sleep 5
kubectl wait --for=condition=complete job/upgrade-volume -n openebs --timeout=550s
Expand Down
4 changes: 2 additions & 2 deletions ci/upgrade/volume.tmp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ spec:
# if required the image prefix of the volume deployments can be
# changed using the flag below, defaults to whatever was present on old
# deployments.
#- "--to-version-image-prefix=openebs/"
- "--to-version-image-prefix=imageorg/"
# if required the image tags for volume deployments can be changed
# to a custom image tag using the flag below,
# defaults to the --to-version mentioned above.
Expand All @@ -58,7 +58,7 @@ spec:

# the image version should be same as the --to-version mentioned above
# in the args of the job
image: openebs/upgrade-amd64:ci
image: imageorg/upgrade-amd64:ci
imagePullPolicy: IfNotPresent
restartPolicy: OnFailure
---
Expand Down

0 comments on commit 0ff97b1

Please sign in to comment.