(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

@ -16,13 +16,13 @@ $ make build
Launching on Kubernetes
=======================
This will create the bridge necessary for MaaS provisioning (fixed with the name 'maas' rigt now) and launch the region controller
and rack controller containers on kubernetes using kubectl by leveraging the YAML manifests in maas/deployments.
This will create the bridge necessary for MaaS provisioning (fixed with the name 'maas' rigt now) and launch the region controller
and rack controller containers on kubernetes using kubectl by leveraging the YAML manifests in maas/deployments.
```
$ make kuber_bridge
...
$ make kuber_deploy
sudo kubectl create -f deployment/maas-service.yaml
service "maas-region-ui" created
@ -54,7 +54,7 @@ $ make kuber_clean
```
Once the region controller comes up, and you can login as admin/admin, you must configure a gateway within the UI on the
10.7.200.0 network, setting that to 10.7.200.1. You must also enable DHCP and set the primary rack controller to the
10.7.200.0 network, setting that to 10.7.200.1. You must also enable DHCP and set the primary rack controller to the
maas rack container booted (it will be a drop down choice). This will eventually be automated.
Running Containers
@ -68,7 +68,7 @@ d7462aabf4d8982621c30d7df36adf6c3e0f634701c0a070f7214301829fa92e
```
$ make run_rack
sudo docker run -d -v /sys/fs/cgroup:/sys/fs/cgroup:ro --privileged --name maas-rack-controller maas-rack:dockerfile
sudo docker run -d -v /sys/fs/cgroup:/sys/fs/cgroup:ro --privileged --name maas-rack-controller maas-rack:dockerfile
fb36837cd68e56356cad2ad853ae517201ee3349fd1f80039185b71d052c5326
```
@ -100,7 +100,7 @@ $ make get_region_api_key
ksKQbjtTzjZrZy2yP7:jVq2g4x5FYdxDqBQ7P:KGfnURCrYSKmGE6k2SXWk4QVHVSJHBfr
```
You can also retrieve the region secret and IP address, used to initialize the
You can also retrieve the region secret and IP address, used to initialize the
rack controller:
```
@ -125,8 +125,7 @@ will initiate an image sync with the rack.
```
$ make register_rack -e URL=http://172.16.84.4 SECRET=2036ba7575697b03d73353fc72a01686
sudo docker exec maas-rack-controller maas-rack register --url http://172.16.84.4 --secret 2036ba7575697b03d73353fc72a01686
alan@hpdesktop:~/Workbench/att/attcomdev/dockerfiles/maas$
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