From 8dff48ff382368a4faf339ad760f5669583639af Mon Sep 17 00:00:00 2001 From: Roman Mohr Date: Fri, 12 Jan 2018 07:43:50 +0100 Subject: [PATCH] Place generated manifests in _out folder By also moving the manifests to _out, we have all produced artifacts in the _out folder. Signed-off-by: Roman Mohr --- .gitignore | 1 - .travis.yml | 2 +- Makefile | 1 - cluster/deploy.sh | 9 +++++---- hack/build-manifests.sh | 16 +++++++--------- hack/common.sh | 11 +++++++++++ 6 files changed, 24 insertions(+), 16 deletions(-) create mode 100644 hack/common.sh diff --git a/.gitignore b/.gitignore index 6e3b087d15a4..f89c8a358862 100644 --- a/.gitignore +++ b/.gitignore @@ -3,7 +3,6 @@ vendor/* .idea *.iml tools/openapispec/openapispec -manifests/**/*.yaml **/bin bin/* .vagrant diff --git a/.travis.yml b/.travis.yml index ffbb860ed553..7259c6561194 100644 --- a/.travis.yml +++ b/.travis.yml @@ -60,7 +60,7 @@ deploy: file_glob: true file: - _out/cmd/virtctl/virtctl-* - - manifests/release/kubevirt.yaml + - _out/manifests/release/kubevirt.yaml prerelease: true on: tags: true diff --git a/Makefile b/Makefile index 3e2efca127c8..1a92fc447326 100644 --- a/Makefile +++ b/Makefile @@ -49,7 +49,6 @@ clean: rm tools/openapispec/openapispec -rf distclean: clean - find manifests -name "*.yaml" -type f -delete rm -rf vendor/ rm -f .glide.*.hash glide cc diff --git a/cluster/deploy.sh b/cluster/deploy.sh index 6bab15502699..971dafe40fc7 100755 --- a/cluster/deploy.sh +++ b/cluster/deploy.sh @@ -21,6 +21,7 @@ set -ex PROVIDER=${PROVIDER:-vagrant} +source hack/common.sh source cluster/$PROVIDER/provider.sh source hack/config.sh @@ -31,7 +32,7 @@ _kubectl delete pods -n kube-system -l="kubevirt.io=libvirt" --force --grace-per _kubectl delete pods -n kube-system -l="kubevirt.io=virt-handler" --force --grace-period 0 2>/dev/null || : # Delete everything, no matter if release, devel or infra -_kubectl delete -f manifests -R --grace-period 1 2>/dev/null || : +_kubectl delete -f ${MANIFESTS_OUT_DIR}/ -R --grace-period 1 2>/dev/null || : # Delete exposures _kubectl delete services -l "kubevirt.io" -n kube-system @@ -42,12 +43,12 @@ echo "Deploying ..." # Deploy the right manifests for the right target if [ -z "$TARGET" ] || [ "$TARGET" = "vagrant-dev" ]; then - _kubectl create -f manifests/dev -R $i + _kubectl create -f ${MANIFESTS_OUT_DIR}/dev -R $i elif [ "$TARGET" = "vagrant-release" ]; then - _kubectl create -f manifests/release -R $i + _kubectl create -f ${MANIFESTS_OUT_DIR}/release -R $i fi # Deploy additional infra for testing -_kubectl create -f manifests/testing -R $i +_kubectl create -f ${MANIFESTS_OUT_DIR}/testing -R $i echo "Done" diff --git a/hack/build-manifests.sh b/hack/build-manifests.sh index 274146bee5a8..71458a810835 100755 --- a/hack/build-manifests.sh +++ b/hack/build-manifests.sh @@ -20,20 +20,18 @@ set -e source hack/config.sh +source hack/common.sh -if [ $# -eq 0 ]; then - args=$(find manifests -type f -name "*.yaml.in") -else - args=$@ -fi +args=$(cd ${KUBEVIRT_DIR}/manifests && find * -type f -name "*.yaml.in") -# Delete all generated manifests in case an input file was deleted or renamed -find manifests -name "*.yaml" -type f -delete +rm -rf ${MANIFESTS_OUT_DIR} -# Render kubernetes manifests for arg in $args; do + final_out_dir=$(dirname ${MANIFESTS_OUT_DIR}/${arg}) + mkdir -p ${final_out_dir} + manifest=$(basename -s .in ${arg}) sed -e "s/{{ master_ip }}/$master_ip/g" \ -e "s/{{ docker_tag }}/$docker_tag/g" \ -e "s/{{ docker_prefix }}/$docker_prefix/g" \ - $arg >${arg%%.in} + ${KUBEVIRT_DIR}/manifests/$arg >${final_out_dir}/${manifest} done diff --git a/hack/common.sh b/hack/common.sh new file mode 100644 index 000000000000..ed5864b56af9 --- /dev/null +++ b/hack/common.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +KUBEVIRT_DIR="$( + cd "$(dirname "$0")/../" + pwd +)" +OUT_DIR=$KUBEVIRT_DIR/_out/ +CMD_OUT_DIR=$KUBEVIRT_DIR/_out/cmd/ +TESTS_OUT_DIR=$KUBEVIRT_DIR/_out/cmd/ +APIDOCS_OUT_DIR=$KUBEVIRT_DIR/_out/apidocs +MANIFESTS_OUT_DIR=$KUBEVIRT_DIR/_out/manifests