Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(migrate): add travis sanity test #29

Merged
merged 5 commits into from
Aug 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 28 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ go:
env:
global:
- ARCH=$(go env GOARCH)
- CHANGE_MINIKUBE_NONE_USER=true
- MINIKUBE_WANTUPDATENOTIFICATION=false
- MINIKUBE_WANTREPORTERRORPROMPT=false
- MINIKUBE_HOME=$HOME
- CHANGE_MINIKUBE_NONE_USER=true
- KUBECONFIG=$HOME/.kube/config

sudo: required

Expand All @@ -16,8 +22,23 @@ services:

jobs:
include:
- stage: "Tests"
os: linux
arch: amd64
script: make test
name: "Unit tests"
- os: linux
arch: amd64
script: ./ci/migrate/sanity.sh
name: "Migrate Sanity"
- os: linux
arch: amd64
script: ./ci/upgrade/sanity.sh
name: "Upgrade Sanity"
- stage: "Deploy Images"
os: linux
arch: amd64
script: make all.amd64 deploy-images

addons:
apt:
Expand All @@ -33,16 +54,16 @@ install:

before_script: # TODO add golangci yaml config
- curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.25.0

script:
- make test
- if [ "$TRAVIS_CPU_ARCH" == "amd64" ]; then
make all.amd64;
curl -Lo kubectl https://storage.googleapis.com/kubernetes-release/release/v1.18.1/bin/linux/amd64/kubectl && chmod +x kubectl && sudo mv kubectl /usr/local/bin/;
curl -Lo minikube https://storage.googleapis.com/minikube/releases/v1.8.1/minikube-linux-amd64 && chmod +x minikube && sudo mv minikube /usr/local/bin/;
mkdir -p $HOME/.kube $HOME/.minikube;
touch $KUBECONFIG;
sudo minikube start --vm-driver=none --kubernetes-version=v1.16.0;
sudo chown -R travis /home/travis/.minikube/;
JSONPATH='{range .items[*]}{@.metadata.name}:{range @.status.conditions[*]}{@.type}={@.status};{end}{end}'; until kubectl get nodes -o jsonpath="$JSONPATH" 2>&1 | grep -q "Ready=True"; do sleep 1; done;
fi

after_success:
- make deploy-images

notifications:
email:
recipients:
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 --fail 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.

126 changes: 126 additions & 0 deletions ci/migrate/application.tmp.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
---
#Use the following YAMLs to create a cStor Storage Pool.
apiVersion: openebs.io/v1alpha1
kind: StoragePoolClaim
metadata:
name: sparse-claim
annotations:
cas.openebs.io/config: |
- name: PoolResourceRequests
value: |-
memory: 2Gi
- name: PoolResourceLimits
value: |-
memory: 4Gi
spec:
name: sparse-claim
type: sparse
poolSpec:
poolType: striped
blockDevices:
blockDeviceList:
- SPCBD
---
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: openebs-cstor-sparse
annotations:
openebs.io/cas-type: cstor
cas.openebs.io/config: |
- name: StoragePoolClaim
value: "sparse-claim"
- name: ReplicaCount
value: "1"
- name: TargetResourceLimits
value: |-
memory: 1Gi
cpu: 200m
- name: TargetResourceRequests
value: |-
memory: 500Mi
cpu: 100m
- name: AuxResourceLimits
value: |-
memory: 1Gi
cpu: 200m
- name: AuxResourceRequests
value: |-
memory: 500Mi
cpu: 100m
- name: TargetTolerations
value: |-
t1:
key: "key1"
operator: "Equal"
value: "value1"
effect: "NoSchedule"
t2:
key: "key1"
operator: "Equal"
value: "value1"
effect: "NoExecute"
- name: TargetNodeSelector
value: |-
nodetype: storage
- name: QueueDepth
value: "32"
- name: Luworkers
value: "6"
- name: ZvolWorkers
value: "1"
provisioner: openebs.io/provisioner-iscsi
---
apiVersion: v1
kind: Service
metadata:
labels:
lkey: lvalue
name: busybox
spec:
clusterIP: None
selector:
lkey: lvalue
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: busybox
labels:
lkey: lvalue
spec:
serviceName: busybox
replicas: 1
selector:
matchLabels:
lkey: lvalue
#The Label "openebs.io/replica-anti-affinity"
#needs to be added in order to distribute volume replicas.
affinity_label: busybox
template:
metadata:
labels:
lkey: lvalue
affinity_label: busybox
spec:
containers:
- name: busybox
image: busybox
imagePullPolicy: IfNotPresent
command:
- sh
- -c
- 'date > /busybox/date.txt; sync; sleep 5; sync; tail -f /dev/null;'
volumeMounts:
- name: testclaim
mountPath: /busybox
volumeClaimTemplates:
- metadata:
name: testclaim
spec:
accessModes: [ "ReadWriteOnce" ]
storageClassName: openebs-cstor-sparse
resources:
requests:
storage: 2G

Loading