Skip to content

Commit

Permalink
This commit
Browse files Browse the repository at this point in the history
- adds sanity test for upgrade
- update build script to use travis tag or branch as version
- use universal push script

Signed-off-by: shubham <[email protected]>
  • Loading branch information
shubham14bajpai committed Jul 29, 2020
1 parent 67f21dd commit 548bae2
Show file tree
Hide file tree
Showing 17 changed files with 1,027 additions and 133 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
name: "Migrate Sanity"
- os: linux
arch: amd64
script: echo "TODO Upgrade Sanity tests"
script: ./ci/upgrade/sanity.sh
name: "Upgrade Sanity"
- stage: "Deploy Images"
os: linux
Expand Down
29 changes: 28 additions & 1 deletion build/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,34 @@ if [[ -n "$TRAVIS_TAG" ]] && [[ $TRAVIS_TAG != *"RC"* ]]; then
fi

# Get the version details
VERSION="$(cat $GOPATH/src/github.com/openebs/upgrade/VERSION)"
# Determine the current branch
CURRENT_BRANCH=""
if [ -z "${TRAVIS_BRANCH}" ];
then
CURRENT_BRANCH=$(git branch | grep "\*" | cut -d ' ' -f2)
else
CURRENT_BRANCH="${TRAVIS_BRANCH}"
fi

## Populate the version based on release tag
## If travis tag is set then assign it as VERSION and
## if travis tag is empty then mark version as ci
if [ -n "$TRAVIS_TAG" ]; then
# Trim the `v` from the TRAVIS_TAG if it exists
# Example: v1.10.0 maps to 1.10.0
# Example: 1.10.0 maps to 1.10.0
# Example: v1.10.0-custom maps to 1.10.0-custom
VERSION="${TRAVIS_TAG#v}"
else
## Marking VERSION as current_branch-dev
## Example: master branch maps to master-dev
## Example: v1.11.x-ee branch to 1.11.x-ee-dev
## Example: v1.10.x branch to 1.10.x-dev
VERSION="${CURRENT_BRANCH#v}-dev"
fi

echo "Building for ${VERSION} VERSION"

#VERSION=$(git describe --tags --always --dirty)

# Determine the arch/os combos we're building for
Expand Down
3 changes: 3 additions & 0 deletions build/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ elif [ "${ARCH}" = "aarch64" ]; then
MIGRATE_IMG="${IMAGE_ORG}/migrate-arm64"
fi

curl https://raw.githubusercontent.com/openebs/charts/gh-pages/scripts/release/buildscripts/push > ./build/push
chmod +x ./build/push

# tag and push all the images
DIMAGE="${UPGRADE_IMG}" ./build/push
DIMAGE="${MIGRATE_IMG}" ./build/push
126 changes: 0 additions & 126 deletions build/push

This file was deleted.

4 changes: 2 additions & 2 deletions ci/migrate/sanity.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
make migrate-image.amd64

# setup openebs & cstor v1 for migration
./ci/migrate/setup.sh
./ci/migrate/setup.sh || exit 1
# run migration tests
./ci/migrate/test.sh
./ci/migrate/test.sh || exit 1

rm ./ci/migrate/volume.yaml ./ci/migrate/application.yaml
4 changes: 2 additions & 2 deletions ci/migrate/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ echo "Migrating pool to cspc"
kubectl apply -f ./ci/migrate/pool.yaml
sleep 5
kubectl wait --for=condition=complete job/migrate-pool -n openebs --timeout=800s
kubectl logs -l job-name=migrate-pool -n openebs
kubectl logs --tail=50 -l job-name=migrate-pool -n openebs

echo "Migrating extetnal volume to csi volume"

Expand All @@ -23,7 +23,7 @@ sed "s/PVNAME/$pvname/" ./ci/migrate/volume.tmp.yaml > ./ci/migrate/volume.yaml
kubectl apply -f ./ci/migrate/volume.yaml
sleep 5
kubectl wait --for=condition=complete job/migrate-volume -n openebs --timeout=800s
kubectl logs -l job-name=migrate-volume -n openebs
kubectl logs --tail=50 -l job-name=migrate-volume -n openebs

echo "Scaling up application after migration"

Expand Down
100 changes: 100 additions & 0 deletions ci/upgrade/application.tmp.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
apiVersion: cstor.openebs.io/v1
kind: CStorPoolCluster
metadata:
name: cspc-stripe
namespace: openebs
spec:
pools:
- nodeSelector:
kubernetes.io/hostname: "127.0.0.1"
dataRaidGroups:
- blockDevices:
- blockDeviceName: "CSPCBD"
poolConfig:
dataRaidGroupType: "stripe"
---
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
name: openebs-cstor-csi
provisioner: cstor.csi.openebs.io
allowVolumeExpansion: true
parameters:
cas-type: cstor
cstorPoolCluster: cspc-stripe
replicaCount: "1"
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: demo-csi-vol-claim
spec:
storageClassName: openebs-cstor-csi
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 5Gi
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: percona
labels:
lkey: lvalue
openebs.io/target-affinity: percona
spec:
replicas: 1
selector:
matchLabels:
lkey: lvalue
template:
metadata:
labels:
lkey: lvalue
openebs.io/target-affinity: percona
spec:
containers:
- resources:
limits:
cpu: 0.5
name: percona
image: openebs/tests-custom-percona:latest
imagePullPolicy: IfNotPresent
args:
- "--ignore-db-dir"
- "lost+found"
env:
- name: MYSQL_ROOT_PASSWORD
value: k8sDem0
ports:
- containerPort: 3306
name: percona
volumeMounts:
- mountPath: /var/lib/mysql
name: data-vol
#<!-- BEGIN ANSIBLE MANAGED BLOCK -->
livenessProbe:
exec:
command: ["bash", "sql-test.sh"]
initialDelaySeconds: 60
periodSeconds: 1
timeoutSeconds: 10
#<!-- END ANSIBLE MANAGED BLOCK -->
volumes:
- name: data-vol
persistentVolumeClaim:
claimName: demo-csi-vol-claim
---
apiVersion: v1
kind: Service
metadata:
name: percona-csi-mysql
labels:
lkey: lvalue
spec:
ports:
- port: 3306
targetPort: 3306
selector:
lkey: lvalue
Loading

0 comments on commit 548bae2

Please sign in to comment.