diff --git a/.travis.yml b/.travis.yml index 1924b093e5..c56e89721d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,7 +14,6 @@ jobs: before_script: - go get -u golang.org/x/lint/golint script: - - make - make verify - stage: E2E Tests before_script: @@ -29,7 +28,7 @@ jobs: - sudo chmod +x /usr/local/bin/kind script: - make cli - - make docker + - make images - make e2e-test-kind after_failure: # Echo logs and upload diff --git a/Makefile b/Makefile index cc88b640e8..57ca148581 100644 --- a/Makefile +++ b/Makefile @@ -1,34 +1,28 @@ BIN_DIR=_output/bin +BIN_OSARCH=linux/amd64 IMAGE=volcanosh/volcano TAG = latest .EXPORT_ALL_VARIABLES: -all: controllers scheduler cli admission +all: init verify cli images e2e-test-kind init: mkdir -p ${BIN_DIR} -controllers: - go build -o ${BIN_DIR}/vk-controllers ./cmd/controllers - -scheduler: - go build -o ${BIN_DIR}/vk-scheduler ./cmd/scheduler - cli: - go build -o ${BIN_DIR}/vkctl ./cmd/cli - -admission: - go build -o ${BIN_DIR}/vk-admission ./cmd/admission + go get github.com/mitchellh/gox + CGO_ENABLED=0 gox -osarch=${BIN_OSARCH} -output ${BIN_DIR}/${BIN_OSARCH}/vkctl ./cmd/cli -release: - CGO_ENABLED=0 go build -o ${BIN_DIR}/rel/vk-controllers ./cmd/controllers - CGO_ENABLED=0 go build -o ${BIN_DIR}/rel/vk-scheduler ./cmd/scheduler - CGO_ENABLED=0 go build -o ${BIN_DIR}/rel/vk-admission ./cmd/admission +image_bins: + go get github.com/mitchellh/gox + for name in controllers scheduler admission; do\ + CGO_ENABLED=0 gox -osarch=${BIN_OSARCH} -output ${BIN_DIR}/${BIN_OSARCH}/vk-$$name ./cmd/$$name; \ + done -docker: release +images: image_bins for name in controllers scheduler admission; do\ - cp ${BIN_DIR}/rel/vk-$$name ./installer/dockerfile/$$name/; \ + cp ${BIN_DIR}/${BIN_OSARCH}/vk-$$name ./installer/dockerfile/$$name/; \ docker build --no-cache -t $(IMAGE)-$$name:$(TAG) ./installer/dockerfile/$$name; \ rm installer/dockerfile/$$name/vk-$$name; \ done @@ -36,9 +30,6 @@ docker: release generate-code: ./hack/update-gencode.sh -e2e-test: - ./hack/run-e2e.sh - unit-test: go list ./... | grep -v e2e | xargs go test -v diff --git a/hack/run-e2e-kind.sh b/hack/run-e2e-kind.sh index 9ae2183cae..eaf721ba3e 100755 --- a/hack/run-e2e-kind.sh +++ b/hack/run-e2e-kind.sh @@ -1,7 +1,7 @@ #!/bin/bash export VK_ROOT=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/.. -export VK_BIN=${VK_ROOT}/_output/bin +export VK_BIN=${VK_ROOT}/${BIN_DIR}/${BIN_OSARCH} export LOG_LEVEL=3 export SHOW_VOLCANO_LOGS=${SHOW_VOLCANO_LOGS:-1} export CLEANUP_CLUSTER=${CLEANUP_CLUSTER:-1} diff --git a/hack/run-e2e.sh b/hack/run-e2e.sh deleted file mode 100755 index b0ade87292..0000000000 --- a/hack/run-e2e.sh +++ /dev/null @@ -1,65 +0,0 @@ -#!/bin/bash - -export PATH="${HOME}/.kubeadm-dind-cluster:${PATH}" -export MASTER="http://127.0.0.1:8080" -export VK_BIN=$PWD/_output/bin -export LOG_LEVEL=2 -export NUM_NODES=3 -export CERT_PATH=/etc/kubernetes/pki -export HOST=localhost -export HOSTPORT=32222 - -kubectl --server=${MASTER} apply -f installer/chart/volcano-init/templates/scheduling_v1alpha1_podgroup.yaml -kubectl --server=${MASTER} apply -f installer/chart/volcano-init/templates/scheduling_v1alpha1_queue.yaml -kubectl --server=${MASTER} apply -f installer/chart/volcano-init/templates/batch_v1alpha1_job.yaml -kubectl --server=${MASTER} apply -f installer/chart/volcano-init/templates/bus_v1alpha1_command.yaml - -# config admission-controller TODO: make it easier to deploy -CA_BUNDLE=`kubectl get configmap -n kube-system extension-apiserver-authentication -o=jsonpath='{.data.client-ca-file}' | base64 | tr -d '\n'` -sed -i "s|{{CA_BUNDLE}}|$CA_BUNDLE|g" hack/e2e-admission-config.yaml -sed -i "s|{{host}}|${HOST}|g" hack/e2e-admission-config.yaml -sed -i "s|{{hostPort}}|${HOSTPORT}|g" hack/e2e-admission-config.yaml - -kubectl apply -f hack/e2e-admission-config.yaml - -# Create default queue for tests -kubectl apply -f installer/chart/volcano/templates/default-queue.yaml - -# start controller -nohup ${VK_BIN}/vk-controllers --kubeconfig ${HOME}/.kube/config --master=${MASTER} --logtostderr --v ${LOG_LEVEL} > controller.log 2>&1 & - -# start scheduler -nohup ${VK_BIN}/vk-scheduler --kubeconfig ${HOME}/.kube/config --scheduler-conf=example/kube-batch-conf.yaml --master=${MASTER} --logtostderr --v ${LOG_LEVEL} > scheduler.log 2>&1 & - -# start admission-controller -nohup ${VK_BIN}/vk-admission --tls-cert-file=${CERT_PATH}/apiserver.crt --tls-private-key-file=${CERT_PATH}/apiserver.key --kubeconfig ${HOME}/.kube/config --port ${HOSTPORT} --logtostderr --v ${LOG_LEVEL} > admission.log 2>&1 & - -# clean up -function cleanup { - killall -9 -r vk-scheduler -r vk-controllers -r vk-admission - - if [[ -f scheduler.log ]] ; then - echo "====================================================================================" - echo "=============================>>>>> Scheduler Logs <<<<<=============================" - echo "====================================================================================" - cat scheduler.log - fi - - if [[ -f controller.log ]] ; then - echo "====================================================================================" - echo "=============================>>>>> Controller Logs <<<<<============================" - echo "====================================================================================" - cat controller.log - fi - - echo "====================================================================================" - echo "=============================>>>>> admission Logs <<<<<============================" - echo "====================================================================================" - - cat admission.log -} - -trap cleanup EXIT - -# Run e2e test -go test ./test/e2e -v -timeout 30m