(zuul) Basic zuul gates

- Charting linting

Change-Id: I7c15ba455bab3d2c9d8b458de1d7ebe15e1c97a4
This commit is contained in:
Scott Hussey 2018-06-01 09:40:51 -05:00
parent e3f8ffe9ae
commit 90a5ed3e78
8 changed files with 155 additions and 14 deletions

45
.zuul.yaml Normal file
View File

@ -0,0 +1,45 @@
# 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.
- project:
check:
jobs:
- airship-maas-lint-ws
- airship-maas-lint-chart
gate:
jobs:
- airship-maas-lint-ws
- airship-maas-lint-chart
- nodeset:
name: airship-maas-single-node
nodes:
- name: primary
label: ubuntu-xenial
- job:
name: airship-maas-lint-ws
description: |
Lints all files for trailing whitespace
run: tools/gate/playbooks/zuul-linter.yaml
timeout: 300
nodeset: airship-maas-single-node
- job:
name: airship-maas-lint-chart
files:
- ^charts/.*$
description: |
Lints Helm charts for validity
run: tools/gate/playbooks/helm-linter.yaml
timeout: 600
nodeset: airship-maas-single-node

View File

@ -22,11 +22,12 @@ CACHE_SUFFIX ?= maas-cache
CACHE_IMG_DIR ?= images/sstream-cache
IMAGE_PREFIX ?= attcomdev
IMAGE_TAG ?= latest
HELM ?= helm
PROXY ?= http://one.proxy.att.com:8080
USE_PROXY ?= false
LABEL ?= commit-id
IMAGE_NAME := maas-rack-controller maas-region-controller sstream-cache
BUILD_DIR := $(shell mktemp -d)
HELM := $(BUILD_DIR)/helm
.PHONY: images
#Build all images in the list
@ -54,6 +55,11 @@ dry-run: helm_lint
# Make targets intended for use by the primary targets above.
# Install helm binary
.PHONY: helm-install
helm-install:
tools/helm_install.sh $(HELM)
.PHONY: build
build:
ifeq ($(USE_PROXY), true)
@ -67,7 +73,7 @@ clean:
rm -rf build
.PHONY: helm_lint
helm_lint: clean
helm_lint: clean helm-install
tools/helm_tk.sh $(HELM)
mkdir -p build/charts/maas
cp -R charts/maas build/charts/

View File

@ -13,7 +13,7 @@
# limitations under the License.
apiVersion: v1
description: Chart to run MaaS
description: Chart to run Canonical MaaS
name: maas
version: 0.1.0
home: https://docs.ubuntu.com/maas
@ -21,4 +21,4 @@ sources:
- https://git.launchpad.net/maas
- https://git.openstack.org/cgit/openstack/openstack-helm
maintainers:
- name: OpenStack-Helm Authors
- name: Openstack Airship Contributors

View File

@ -129,4 +129,3 @@ alan@hpdesktop:~/Workbench/att/attcomdev/dockerfiles/maas$
```
Finally, to access your MaaS UI, visit http://172.0.0.1:7777/MAAS/ and login as admin/admin.

View File

@ -0,0 +1,21 @@
# 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.
- hosts: primary
tasks:
- name: Execute the make target for Helm chart linting
make:
chdir: "{{ zuul.project.src_dir }}"
target: helm_lint
register: result
failed_when: result.failed

View File

@ -0,0 +1,20 @@
# Copyright 2017 The Openstack-Helm 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.
- hosts: primary
tasks:
- name: Execute a Whitespace Linter check
command: find . -not -path "*/\.*" -not -name "*.tgz" -not -name "*.patch" -type f -exec egrep -l " +$" {} \;
register: result
failed_when: result.stdout != ""

43
tools/helm_install.sh Executable file
View File

@ -0,0 +1,43 @@
#!/bin/bash
# Copyright 2018 AT&T Intellectual Property. All other rights reserved.
#
# 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 -x
HELM=$1
HELM_ARTIFACT_URL=${HELM_ARTIFACT_URL:-"https://storage.googleapis.com/kubernetes-helm/helm-v2.7.2-linux-amd64.tar.gz"}
function install_helm_binary {
if [[ -z "${HELM}" ]]
then
echo "No Helm binary target location."
exit -1
fi
if [[ -w "$(dirname ${HELM})" ]]
then
TMP_DIR=$(dirname ${HELM})
curl -o "${TMP_DIR}/helm.tar.gz" "${HELM_ARTIFACT_URL}"
cd ${TMP_DIR}
tar -xvzf helm.tar.gz
cp "${TMP_DIR}/linux-amd64/helm" "${HELM}"
else
echo "Cannot write to ${HELM}"
exit -1
fi
}
install_helm_binary

View File

@ -18,6 +18,7 @@
HELM=$1
HTK_REPO=${HTK_REPO:-"https://github.com/openstack/openstack-helm"}
HTK_PATH=${HTK_PATH:-""}
HTK_STABLE_COMMIT=${HTK_COMMIT:-"f902cd14fac7de4c4c9f7d019191268a6b4e9601"}
DEP_UP_LIST=${DEP_UP_LIST:-"maas"}
if [[ ! -z $(echo $http_proxy) ]]
@ -50,12 +51,18 @@ function helm_serve {
${HELM} repo add local http://localhost:8879/charts
}
# OSH Makefile is bugged, so ensure helm is in the path
if [[ ${HELM} != "helm" ]]
then
export PATH=${PATH}:$(dirname ${HELM})
fi
mkdir -p build
pushd build
git clone --depth 1 $HTK_REPO || true
git clone $HTK_REPO || true
pushd openstack-helm/$HTK_PATH
git reset --hard "${HTK_STABLE_COMMIT}"
git pull
helm_serve
make helm-toolkit
popd && popd