From b31e1d3a63f15a956e719d83310fabbaed96791c Mon Sep 17 00:00:00 2001 From: prateek Date: Sun, 15 Oct 2017 17:19:20 +0530 Subject: [PATCH 1/3] Fix travis build **Why this PR does ?** This PR will fix the build issue in travis. Now travis will buils mayactl as well as maya-apiserver binaries and if build is tagged by github it will release and deploy them in Github relaeas pages. --- .travis.yml | 11 ++++++----- GNUmakefile | 6 +++--- buildscripts/apiserver/build.sh | 1 - buildscripts/build.sh | 19 +++++++++---------- 4 files changed, 18 insertions(+), 19 deletions(-) diff --git a/.travis.yml b/.travis.yml index a52daa8417..6c31b2234c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,8 +9,7 @@ go: install: - make bootstrap script: - - make test bin - - ls -la bin/ + - make all - ./buildscripts/test-cov.sh after_success: - bash <(curl -s https://codecov.io/bash) @@ -24,12 +23,14 @@ deploy: api_key: secure: na/NPsgDHGGRaWxRSCo5gH3TPrEutNvhEK3q2k99bbW2INe0FZ+FIPeuL9rqV8eCQi8SWJGHNFjFyMRR798RRSn8bdiK0pxJXzYvphUEH2Azzoqr65TaJHpHNTkv1WTK9OtgahT71MbmIx777U6Vd6ylyJyWja+LPhY/z66XOYQmuXR2ds7FRBlAcWg8C0KIFTLYlms5C9RKwLS2jP5C8tlJBQXMDEk7ejR1mKn3R6KQyyHICGKPGhNE+d7iMs0qhhuGIhcDwXl1olChAAITOGyWEmjc2GeUbFALo8OXdQx9qBO7saw75IzyYV/itBjE0RpuM90jKuFzKGiotSyw7Fs0KgrjHC7keuaNMqBWgKl6qoAj2a5VVEBtx8k941hRLs/VpjQ+K8wJJpjlSR8vh906b8e+HL8BKJEifF09fKBTLd0AWy9I3x6TolmRqiamvIHEkup1fZqblhhe2ZLvwuuyfl3t1FTkkon5BASgSqFdBAhR3eAD/LOtrghjaRX7wCZCzKDEaS9QLeu9UbC+bmnaOo60Gaeyp/DN5FLc4cV/vZozroesu+UEtQIrC6VDlFNYfY0V1ETKpfEQ4I8yByDHx/KjMWDyUGd8e5tm0qsD1lW1yVekh5CjQRHpzShkmKvFieeVfqVy/aGB4GrTeWSxcKiN8W0ekcgCRYut6y0= file_glob: true - file: bin/maya-linux_*.zip + file: + - bin/maya/maya-linux_*.zip + - bin/apiserver/maya-apiserver-linux_*.zip skip_cleanup: true - overwrite: true + overwrite: true on: repo: openebs/maya tags: true branches: except: - - /^*-v[0-9]/ + - /^*-v[0-9]/ diff --git a/GNUmakefile b/GNUmakefile index 6caaff7db2..8f7882b3a1 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -23,7 +23,7 @@ APISERVER=maya-apiserver # Specify the date o build BUILD_DATE = $(shell date +'%Y%m%d%H%M%S') -all: test +all: test bin apiserver dev: format @MAYACTL=${MAYACTL} MAYA_DEV=1 sh -c "'$(PWD)/buildscripts/build.sh'" @@ -87,7 +87,7 @@ bootstrap: done image: - @cp bin/${MAYACTL} buildscripts/docker/ + @cp bin/maya/${MAYACTL} buildscripts/docker/ @cd buildscripts/docker && sudo docker build -t openebs/maya:ci --build-arg BUILD_DATE=${BUILD_DATE} . @rm buildscripts/docker/${MAYACTL} @sh buildscripts/push @@ -114,7 +114,7 @@ apiserver-image: bin apiserver @echo "--> apiserver image " @echo "----------------------------" @cp bin/apiserver/${APISERVER} buildscripts/apiserver/ - @cp bin/${MAYACTL} buildscripts/apiserver/ + @cp bin/maya/${MAYACTL} buildscripts/apiserver/ @cd buildscripts/apiserver && sudo docker build -t openebs/m-apiserver:ci --build-arg BUILD_DATE=${BUILD_DATE} . @rm buildscripts/apiserver/${APISERVER} @rm buildscripts/apiserver/${MAYACTL} diff --git a/buildscripts/apiserver/build.sh b/buildscripts/apiserver/build.sh index 9da07b7814..4b38503591 100755 --- a/buildscripts/apiserver/build.sh +++ b/buildscripts/apiserver/build.sh @@ -59,7 +59,6 @@ do if [ $GOOS = "windows" ]; then output_name+='.exe' fi - echo $GOARCH env GOOS=$GOOS GOARCH=$GOARCH go build -ldflags \ "-X main.GitCommit='${GIT_COMMIT}${GIT_DIRTY}' \ -X main.CtlName='${CTLNAME}' \ diff --git a/buildscripts/build.sh b/buildscripts/build.sh index 6bf661e64f..6156c8bdbe 100755 --- a/buildscripts/build.sh +++ b/buildscripts/build.sh @@ -28,15 +28,15 @@ XC_OSS=(${XC_OS// / }) # Delete the old dir echo "==> Removing old directory..." -rm -rf bin/* -mkdir -p bin/ +rm -rf bin/maya/* +mkdir -p bin/maya/ -if [ -z "${GIT_TAG}" ]; +if [ -z "${GIT_TAG}" ]; then GIT_TAG="0.0.1" fi -if [ -z "${MAYACTL}" ]; +if [ -z "${MAYACTL}" ]; then MAYACTL="mayactl" fi @@ -54,12 +54,11 @@ for GOOS in "${XC_OSS[@]}" do for GOARCH in "${XC_ARCHS[@]}" do - output_name="bin/"$GOOS"_"$GOARCH"/"$MAYACTL + output_name="bin/maya/"$GOOS"_"$GOARCH"/"$MAYACTL if [ $GOOS = "windows" ]; then output_name+='.exe' fi - echo $GOARCH env GOOS=$GOOS GOARCH=$GOARCH go build -ldflags \ "-X main.GitCommit='${GIT_COMMIT}${GIT_DIRTY}' \ -X main.CtlName='${CTLNAME}' \ @@ -84,16 +83,16 @@ IFS=: MAIN_GOPATH=($GOPATH) IFS=$OLDIFS # Copy our OS/Arch to the bin/ directory -DEV_PLATFORM="./bin/$(go env GOOS)_$(go env GOARCH)" +DEV_PLATFORM="./bin/maya/$(go env GOOS)_$(go env GOARCH)" for F in $(find ${DEV_PLATFORM} -mindepth 1 -maxdepth 1 -type f); do - cp ${F} bin/ + cp ${F} bin/maya cp ${F} ${MAIN_GOPATH}/bin/ done if [[ "x${MAYA_DEV}" == "x" ]]; then # Zip and copy to the dist dir echo "==> Packaging..." - for PLATFORM in $(find ./bin -mindepth 1 -maxdepth 1 -type d); do + for PLATFORM in $(find ./bin/maya -mindepth 1 -maxdepth 1 -type d); do OSARCH=$(basename ${PLATFORM}) echo "--> ${OSARCH}" @@ -106,4 +105,4 @@ fi # Done! echo echo "==> Results:" -ls -hl bin/ +ls -hl bin/maya From f619f68ceedda196b618a92776fdb015c54303da Mon Sep 17 00:00:00 2001 From: Prateek Date: Tue, 17 Oct 2017 11:58:07 +0530 Subject: [PATCH 2/3] Moving mayactl related build files to buildscripts/ctl --- GNUmakefile | 16 ++++++++-------- buildscripts/{docker => ctl}/Dockerfile | 0 buildscripts/{ => ctl}/build.sh | 2 +- buildscripts/{ => ctl}/push | 0 4 files changed, 9 insertions(+), 9 deletions(-) rename buildscripts/{docker => ctl}/Dockerfile (100%) rename buildscripts/{ => ctl}/build.sh (97%) rename buildscripts/{ => ctl}/push (100%) diff --git a/GNUmakefile b/GNUmakefile index 8f7882b3a1..110521ad11 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -23,16 +23,16 @@ APISERVER=maya-apiserver # Specify the date o build BUILD_DATE = $(shell date +'%Y%m%d%H%M%S') -all: test bin apiserver +all: test mayactl apiserver dev: format - @MAYACTL=${MAYACTL} MAYA_DEV=1 sh -c "'$(PWD)/buildscripts/build.sh'" + @MAYACTL=${MAYACTL} MAYA_DEV=1 sh -c "'$(PWD)/buildscripts/ctl/build.sh'" -bin: +mayactl: @echo "----------------------------" @echo "--> maya " @echo "----------------------------" - @MAYACTL=${MAYACTL} sh -c "'$(PWD)/buildscripts/build.sh'" + @MAYACTL=${MAYACTL} sh -c "'$(PWD)/buildscripts/ctl/build.sh'" initialize: bootstrap @@ -87,10 +87,10 @@ bootstrap: done image: - @cp bin/maya/${MAYACTL} buildscripts/docker/ - @cd buildscripts/docker && sudo docker build -t openebs/maya:ci --build-arg BUILD_DATE=${BUILD_DATE} . - @rm buildscripts/docker/${MAYACTL} - @sh buildscripts/push + @cp bin/maya/${MAYACTL} buildscripts/ctl/ + @cd buildscripts/ctl && sudo docker build -t openebs/maya:ci --build-arg BUILD_DATE=${BUILD_DATE} . + @rm buildscripts/ctl/${MAYACTL} + @sh buildscripts/ctl/push # You might need to use sudo install: bin/${MAYACTL} diff --git a/buildscripts/docker/Dockerfile b/buildscripts/ctl/Dockerfile similarity index 100% rename from buildscripts/docker/Dockerfile rename to buildscripts/ctl/Dockerfile diff --git a/buildscripts/build.sh b/buildscripts/ctl/build.sh similarity index 97% rename from buildscripts/build.sh rename to buildscripts/ctl/build.sh index 6156c8bdbe..c772a49823 100755 --- a/buildscripts/build.sh +++ b/buildscripts/ctl/build.sh @@ -6,7 +6,7 @@ set -e # Get the parent directory of where this script is. SOURCE="${BASH_SOURCE[0]}" while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done -DIR="$( cd -P "$( dirname "$SOURCE" )/.." && pwd )" +DIR="$( cd -P "$( dirname "$SOURCE" )/../.." && pwd )" # Change into that directory cd "$DIR" diff --git a/buildscripts/push b/buildscripts/ctl/push similarity index 100% rename from buildscripts/push rename to buildscripts/ctl/push From 3fdf2d53c2afb9f0aa077142a1bda40c360e4cb9 Mon Sep 17 00:00:00 2001 From: Prateek Date: Tue, 17 Oct 2017 12:35:50 +0530 Subject: [PATCH 3/3] Chaging to buildscript/mayactl Changing to buildscript/mayactl dir as a naming convention follows is a repo. --- .travis.yml | 1 - GNUmakefile | 22 +++++++++++----------- buildscripts/{ctl => mayactl}/Dockerfile | 0 buildscripts/{ctl => mayactl}/build.sh | 0 buildscripts/{ctl => mayactl}/push | 0 5 files changed, 11 insertions(+), 12 deletions(-) rename buildscripts/{ctl => mayactl}/Dockerfile (100%) rename buildscripts/{ctl => mayactl}/build.sh (100%) rename buildscripts/{ctl => mayactl}/push (100%) diff --git a/.travis.yml b/.travis.yml index 6c31b2234c..b1d4f7fd25 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,7 +13,6 @@ script: - ./buildscripts/test-cov.sh after_success: - bash <(curl -s https://codecov.io/bash) - - make image notifications: email: recipients: diff --git a/GNUmakefile b/GNUmakefile index 110521ad11..17346aaf64 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -26,13 +26,13 @@ BUILD_DATE = $(shell date +'%Y%m%d%H%M%S') all: test mayactl apiserver dev: format - @MAYACTL=${MAYACTL} MAYA_DEV=1 sh -c "'$(PWD)/buildscripts/ctl/build.sh'" + @MAYACTL=${MAYACTL} MAYA_DEV=1 sh -c "'$(PWD)/buildscripts/mayactl/build.sh'" mayactl: @echo "----------------------------" @echo "--> maya " @echo "----------------------------" - @MAYACTL=${MAYACTL} sh -c "'$(PWD)/buildscripts/ctl/build.sh'" + @MAYACTL=${MAYACTL} sh -c "'$(PWD)/buildscripts/mayactl/build.sh'" initialize: bootstrap @@ -86,15 +86,15 @@ bootstrap: go get $$tool; \ done -image: - @cp bin/maya/${MAYACTL} buildscripts/ctl/ - @cd buildscripts/ctl && sudo docker build -t openebs/maya:ci --build-arg BUILD_DATE=${BUILD_DATE} . - @rm buildscripts/ctl/${MAYACTL} - @sh buildscripts/ctl/push +maya-image: + @cp bin/maya/${MAYACTL} buildscripts/mayactl/ + @cd buildscripts/mayactl && sudo docker build -t openebs/maya:ci --build-arg BUILD_DATE=${BUILD_DATE} . + @rm buildscripts/mayactl/${MAYACTL} + @sh buildscripts/mayactl/push # You might need to use sudo -install: bin/${MAYACTL} - install -o root -g root -m 0755 ./bin/${MAYACTL} /usr/local/bin/${MAYACTL} +install: bin/maya/${MAYACTL} + install -o root -g root -m 0755 ./bin/maya/${MAYACTL} /usr/local/bin/${MAYACTL} # Use this to build only the maya-agent. maya-agent: @@ -109,7 +109,7 @@ apiserver: # Currently both mayactl & apiserver binaries are pushed into # m-apiserver image. This is going to be decoupled soon. -apiserver-image: bin apiserver +apiserver-image: mayactl apiserver @echo "----------------------------" @echo "--> apiserver image " @echo "----------------------------" @@ -120,4 +120,4 @@ apiserver-image: bin apiserver @rm buildscripts/apiserver/${MAYACTL} @sh buildscripts/apiserver/push -.PHONY: all bin cov integ test vet maya-agent test-nodep apiserver apiserver-image +.PHONY: all bin cov integ test vet maya-agent test-nodep apiserver apiserver-image maya-image diff --git a/buildscripts/ctl/Dockerfile b/buildscripts/mayactl/Dockerfile similarity index 100% rename from buildscripts/ctl/Dockerfile rename to buildscripts/mayactl/Dockerfile diff --git a/buildscripts/ctl/build.sh b/buildscripts/mayactl/build.sh similarity index 100% rename from buildscripts/ctl/build.sh rename to buildscripts/mayactl/build.sh diff --git a/buildscripts/ctl/push b/buildscripts/mayactl/push similarity index 100% rename from buildscripts/ctl/push rename to buildscripts/mayactl/push