Skip to content

Commit

Permalink
feat(build): enable arm64 auto build
Browse files Browse the repository at this point in the history
enable arm64 auto build

Signed-off-by: Akhil Mohan <akhil.mohan@mayadata.io>
  • Loading branch information
akhilerm committed Apr 8, 2020
1 parent a7b0b0f commit fb63bd3
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 34 deletions.
47 changes: 26 additions & 21 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ cache:
go:
- 1.12.16

jobs:
include:
- os: linux
arch: amd64
- os: linux
arch: arm64

addons:
apt:
update: true
Expand All @@ -31,29 +38,27 @@ install:
- make format
before_script:
# Download kubectl, which is a requirement for using minikube.
- curl -Lo kubectl https://storage.googleapis.com/kubernetes-release/release/v1.13.0/bin/linux/amd64/kubectl && chmod +x kubectl && sudo mv kubectl /usr/local/bin/
# Download minikube.
- curl -Lo minikube https://storage.googleapis.com/minikube/releases/v0.35.0/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.13.0
- "sudo chown -R travis: /home/travis/.minikube/"
# Wait for Kubernetes to be up and ready.
- 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
# Download and initialize helm.
#- ./ci/ubuntu-compile-nsenter.sh && sudo cp .tmp/util-linux-2.30.2/nsenter /usr/bin
#- curl https://raw.githubusercontent.com/kubernetes/helm/master/scripts/get > get_helm.sh
#- chmod 700 get_helm.sh
#- ./get_helm.sh
#- helm init
- if [ "$TRAVIS_CPU_ARCH" == "amd64" ]; then
curl -Lo kubectl https://storage.googleapis.com/kubernetes-release/release/v1.13.0/bin/linux/amd64/kubectl && chmod +x kubectl && sudo mv kubectl /usr/local/bin/;
curl -Lo minikube https://storage.googleapis.com/minikube/releases/v0.35.0/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.13.0;
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;
sudo chown -R travis /home/travis/.minikube/;
fi
script:
- kubectl cluster-info
# Verify kube-addon-manager.
# kube-addon-manager is responsible for managing other kubernetes components, such as kube-dns, dashboard, storage-provisioner..
- JSONPATH='{range .items[*]}{@.metadata.name}:{range @.status.conditions[*]}{@.type}={@.status};{end}{end}'; until kubectl -n kube-system get pods -lcomponent=kube-addon-manager -o jsonpath="$JSONPATH" 2>&1 | grep -q "Ready=True"; do sleep 1;echo "waiting for kube-addon-manager to be available"; kubectl get pods --all-namespaces; done
- kubectl get deployment
# Verify kube-addon-manager.
# kube-addon-manager is responsible for managing other kubernetes components, such as kube-dns, dashboard, storage-provisioner.
- if [ "$TRAVIS_CPU_ARCH" == "amd64" ]; then
kubectl cluster-info;
JSONPATH='{range .items[*]}{@.metadata.name}:{range @.status.conditions[*]}{@.type}={@.status};{end}{end}'; until kubectl -n kube-system get pods -lcomponent=kube-addon-manager -o jsonpath="$JSONPATH" 2>&1 | grep -q "Ready=True"; do sleep 1;echo "waiting for kube-addon-manager to be available"; kubectl get pods --all-namespaces; done;
kubectl get deployment;
fi
- ./buildscripts/travis-build.sh
- ./ci/travis-ci.sh
- if [ "$TRAVIS_CPU_ARCH" == "amd64" ]; then
./ci/travis-ci.sh;
fi
after_success:
- make deploy-images
- bash <(curl -s https://codecov.io/bash)
Expand Down
13 changes: 1 addition & 12 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ HUB_USER?=openebs
# format of docker image name is <hub-user>/<repo-name>[:<tag>].
# so final name will be ${HUB_USER}/${*_REPO_NAME}:${IMAGE_TAG}
ADMISSION_SERVER_REPO_NAME?=admission-server
M_UPGRADE_REPO_NAME?=m-upgrade
CSPC_OPERATOR_REPO_NAME?=cspc-operator

ifeq (${IMAGE_TAG}, )
Expand Down Expand Up @@ -123,7 +122,6 @@ include ./buildscripts/mayactl/Makefile.mk
include ./buildscripts/apiserver/Makefile.mk
include ./buildscripts/provisioner-localpv/Makefile.mk
include ./buildscripts/upgrade/Makefile.mk
include ./buildscripts/upgrade-082090/Makefile.mk
include ./buildscripts/exporter/Makefile.mk
include ./buildscripts/cstor-pool-mgmt/Makefile.mk
include ./buildscripts/cstor-volume-mgmt/Makefile.mk
Expand Down Expand Up @@ -344,13 +342,4 @@ cspc-operator-debug-image:
# Push images
.PHONY: deploy-images
deploy-images:
@DIMAGE="openebs/m-apiserver" ./buildscripts/push
@DIMAGE="openebs/m-exporter" ./buildscripts/push
@DIMAGE="openebs/cstor-pool-mgmt" ./buildscripts/push
@DIMAGE="openebs/cspi-mgmt" ./buildscripts/push
@DIMAGE="openebs/cstor-volume-mgmt" ./buildscripts/push
@DIMAGE="openebs/admission-server" ./buildscripts/push
@DIMAGE="openebs/cspc-operator" ./buildscripts/push
@DIMAGE="${HUB_USER}/${M_UPGRADE_REPO_NAME}" ./buildscripts/push
@DIMAGE="openebs/provisioner-localpv" ./buildscripts/push
@DIMAGE="openebs/cvc-operator" ./buildscripts/push
@./buildscripts/deploy.sh
55 changes: 55 additions & 0 deletions buildscripts/deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#!/bin/bash
# Copyright 2020 The OpenEBS 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 -e

# Determine the arch/os we're building for
ARCH=$(uname -m)

if [ "${ARCH}" = "x86_64" ]; then
APISERVER_IMG="openebs/m-apiserver"
M_EXPORTER_IMG="openebs/m-exporter"
CSTOR_POOL_MGMT_IMG="openebs/cstor-pool-mgmt"
CSPI_MGMT_IMG="openebs/cspi-mgmt"
CSTOR_VOLUME_MGMT_IMG="openebs/cstor-volume-mgmt"
ADMISSION_SERVER_IMG="openebs/admission-server"
CSPC_OPERATOR_IMG="openebs/cspc-operator"
UPGRADE_IMG="openebs/m-upgrade"
PROVISIONER_LOCALPV="openebs/provisioner-localpv"
CVC_OPERATOR_IMG="openebs/cvc-operator"
elif [ "${ARCH}" = "aarch64" ]; then
APISERVER_IMG="openebs/m-apiserver-arm64"
M_EXPORTER_IMG="openebs/m-exporter-arm64"
CSTOR_POOL_MGMT_IMG="openebs/cstor-pool-mgmt-arm64"
CSPI_MGMT_IMG="openebs/cspi-mgmt-arm64"
CSTOR_VOLUME_MGMT_IMG="openebs/cstor-volume-mgmt-arm64"
ADMISSION_SERVER_IMG="openebs/admission-server-arm64"
CSPC_OPERATOR_IMG="openebs/cspc-operator-arm64"
UPGRADE_IMG="openebs/m-upgrade-arm64"
PROVISIONER_LOCALPV="openebs/provisioner-localpv-arm64"
CVC_OPERATOR_IMG="openebs/cvc-operator-arm64"
fi

# tag and push all the images
DIMAGE="${APISERVER_IMG}" ./buildscripts/push
DIMAGE="${M_EXPORTER_IMG}" ./buildscripts/push
DIMAGE="${CSTOR_POOL_MGMT_IMG}" ./buildscripts/push
DIMAGE="${CSPI_MGMT_IMG}" ./buildscripts/push
DIMAGE="${CSTOR_VOLUME_MGMT_IMG}" ./buildscripts/push
DIMAGE="${ADMISSION_SERVER_IMG}" ./buildscripts/push
DIMAGE="${CSPC_OPERATOR_IMG}" ./buildscripts/push
DIMAGE="${UPGRADE_IMG}" ./buildscripts/push
DIMAGE="${PROVISIONER_LOCALPV}" ./buildscripts/push
DIMAGE="${CVC_OPERATOR_IMG}" ./buildscripts/push
6 changes: 5 additions & 1 deletion buildscripts/travis-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,11 @@ printf "\n"
./buildscripts/test-cov.sh
rc=$?; if [[ $rc != 0 ]]; then exit $rc; fi

make all
if [ "$TRAVIS_CPU_ARCH" == "arm64" ]; then
make all.arm64
else
make all
fi
rc=$?; if [[ $rc != 0 ]]; then exit $rc; fi

if [ $SRC_REPO != $DST_REPO ];
Expand Down

0 comments on commit fb63bd3

Please sign in to comment.