diff --git a/Makefile b/Makefile index 214da95c30..0a43d596c9 100644 --- a/Makefile +++ b/Makefile @@ -14,6 +14,7 @@ .PHONY: ceph bootstrap mariadb etcd keystone memcached rabbitmq helm-toolkit mistral neutron nova cinder heat senlin ingress all clean +TASK :=build B64_DIRS := helm-toolkit/secrets B64_EXCLUDE := $(wildcard helm-toolkit/secrets/*.b64) @@ -22,40 +23,40 @@ TOOLKIT_TPL := helm-toolkit/templates/_globals.tpl all: helm-toolkit ceph bootstrap mariadb etcd rabbitmq memcached keystone glance horizon mistral neutron nova cinder heat senlin ingress -helm-toolkit: build-helm-toolkit +helm-toolkit: $(TASK)-helm-toolkit #ceph: nolint-build-ceph -ceph: build-ceph +ceph: $(TASK)-ceph -bootstrap: build-bootstrap +bootstrap: $(TASK)-bootstrap -mariadb: build-mariadb +mariadb: $(TASK)-mariadb -etcd: build-etcd +etcd: $(TASK)-etcd -keystone: build-keystone +keystone: $(TASK)-keystone -cinder: build-cinder +cinder: $(TASK)-cinder -horizon: build-horizon +horizon: $(TASK)-horizon -rabbitmq: build-rabbitmq +rabbitmq: $(TASK)-rabbitmq -glance: build-glance +glance: $(TASK)-glance -mistral: build-mistral +mistral: $(TASK)-mistral -neutron: build-neutron +neutron: $(TASK)-neutron -nova: build-nova +nova: $(TASK)-nova -heat: build-heat +heat: $(TASK)-heat -senlin: build-senlin +senlin: $(TASK)-senlin -memcached: build-memcached +memcached: $(TASK)-memcached -ingress: build-ingress +ingress: $(TASK)-ingress clean: $(shell rm -rf helm-toolkit/secrets/*.b64) @@ -70,3 +71,10 @@ build-%: helm lint $* helm package $* @echo + +lint-%: + @echo + if [ -f $*/Makefile ]; then make -C $*; fi + if [ -f $*/requirements.yaml ]; then helm dep up $*; fi + helm lint $* + @echo diff --git a/tools/gate/setup_gate.sh b/tools/gate/setup_gate.sh index 6ebb09f9ae..e6f85ad952 100755 --- a/tools/gate/setup_gate.sh +++ b/tools/gate/setup_gate.sh @@ -11,9 +11,51 @@ # 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 -ex -#TODO(lamt) Need to replace with actual gate logic. Placeholder for now. -env -exit 0 \ No newline at end of file +HELM_VERSION=${2:-v2.3.0} +WORK_DIR=$(pwd) + +function helm_install { + TMP_DIR=$(mktemp -d) + sudo apt-get update -y + sudo apt-get install -y --no-install-recommends -qq \ + git \ + make \ + curl + + # install helm + curl -sSL https://storage.googleapis.com/kubernetes-helm/helm-${HELM_VERSION}-linux-amd64.tar.gz | tar -zxv --strip-components=1 -C ${TMP_DIR} + sudo mv ${TMP_DIR}/helm /usr/local/bin/helm + rm -rf ${TMP_DIR} +} + +function helm_lint { + if [[ -d "$HOME/.helm" ]]; then + echo ".helm directory found" + else + helm init --client-only + fi + if [[ -z $(curl -s 127.0.0.1:8879 | grep 'Helm Repository') ]]; then + helm serve & > /dev/null + while [[ -z $(curl -s 127.0.0.1:8879 | grep 'Helm Repository') ]]; do + sleep 1 + echo "Waiting for Helm Repository" + done + else + echo "Helm serve already running" + fi + + if [[ -f "$HOME/.helm/repository/stable/index.yaml" ]]; then + helm repo remove stable + fi + if [[ -z $(-f "$HOME/.helm/repository/local/index.yaml") ]]; then + helm repo add local http://localhost:8879/charts + fi + + make build-helm-toolkit -C ${WORK_DIR} + make TASK=lint -C ${WORK_DIR} +} + +helm_install +helm_lint