Clean up gates

- Remove OSH-based gate as it is not relevant at this point
- Add entries for unit testing, linting and security scans
- Some trivial changes to trigger all gates

Change-Id: Icb2731573b45f3824cde8cb44ef64e9d04c017bc
This commit is contained in:
Scott Hussey 2018-05-24 16:57:29 -05:00
parent d107e65a98
commit 53f6ccbfb7
12 changed files with 106 additions and 218 deletions

View File

@ -13,46 +13,73 @@
- project: - project:
check: check:
jobs: jobs:
- airship-drydock-linter - airship-drydock-lint-ws
- airship-drydock-ubuntu: - airship-drydock-lint-pep8:
voting: false files:
irrelevant-files: - ^.*\.py$
- ^.*\.rst$ - airship-drydock-lint-chart:
- ^doc/.*$ files:
- ^releasenotes/.*$ - ^charts/.*$
- airship-drydock-unit-py35
- airship-drydock-security-bandit:
files:
- ^.*\.py$
gate: gate:
jobs: jobs:
- airship-drydock-linter - airship-drydock-lint-ws
# NOTE(portdirect): enable when voting enabled. - airship-drydock-lint-pep8:
# - airship-drydock-ubuntu: files:
# irrelevant-files: - ^.*\.py$
# - ^.*\.rst$ - airship-drydock-lint-chart:
# - ^doc/.*$ files:
# - ^releasenotes/.*$ - ^charts/.*$
- airship-drydock-unit-py35
- airship-drydock-security-bandit:
files:
- ^.*\.py$
- nodeset:
name: airship-drydock-single-node
nodes:
- name: primary
label: ubuntu-xenial
- job: - job:
name: airship-drydock-linter name: airship-drydock-lint-ws
description: |
Lints all files for trailing whitespace
run: tools/gate/playbooks/zuul-linter.yaml run: tools/gate/playbooks/zuul-linter.yaml
nodeset: openstack-helm-single-node timeout: 300
nodeset: airship-drydock-single-node
- job: - job:
name: airship-drydock name: airship-drydock-lint-pep8
roles: description: |
- zuul: openstack/openstack-helm-infra Lints Python files against the PEP8 standard
vars: run: tools/gate/playbooks/pep8-linter.yaml
zuul_osh_infra_relative_path: ../openstack-helm-infra/ timeout: 300
timeout: 7200 nodeset: airship-drydock-single-node
pre-run:
- tools/gate/playbooks/osh-infra-upgrade-host.yaml
- tools/gate/playbooks/osh-infra-deploy-docker.yaml
- tools/gate/playbooks/osh-infra-build.yaml
- tools/gate/playbooks/osh-infra-deploy-k8s.yaml
run: tools/gate/playbooks/airship-drydock-check.yaml
post-run: tools/gate/playbooks/osh-infra-collect-logs.yaml
required-projects:
- openstack/openstack-helm-infra
- job: - job:
name: airship-drydock-ubuntu name: airship-drydock-lint-chart
parent: airship-drydock description: |
nodeset: openstack-helm-single-node Lints Helm charts for validity
run: tools/gate/playbooks/helm-linter.yaml
timeout: 300
nodeset: airship-drydock-single-node
- job:
name: airship-drydock-unit-py35
description: |
Executes unit tests under Python 3.5
run: tools/gate/playbooks/unit-py35.yaml
timeout: 300
nodeset: airship-drydock-single-node
- job:
name: airship-drydock-security-bandit
description: |
Executes the Bandit security scanner against Python files
run: tools/gate/playbooks/security-bandit.yaml
timeout: 300
nodeset: airship-drydock-single-node

View File

@ -35,12 +35,12 @@ run_images: run_drydock
# Run tests # Run tests
.PHONY: tests .PHONY: tests
tests: external_dep pep8 security docs unit_tests tests: pep8 security docs unit_tests
# Intall external (not managed by tox/pip) dependencies # Intall external (not managed by tox/pip) dependencies
.PHONY: external_dep external_dep: requirements-host.txt
external_dep:
sudo ./hostdeps.sh sudo ./hostdeps.sh
touch external_dep
# Run unit and Postgres integration tests in coverage mode # Run unit and Postgres integration tests in coverage mode
.PHONY: coverage_test .PHONY: coverage_test
@ -49,7 +49,7 @@ coverage_test: build_drydock external_dep
# Run just unit tests # Run just unit tests
.PHONY: unit_tests .PHONY: unit_tests
unit_tests: unit_tests: external_dep
tox -re unit tox -re unit
# Run the drydock container and exercise simple tests # Run the drydock container and exercise simple tests
@ -104,11 +104,11 @@ endif
docs: clean drydock_docs docs: clean drydock_docs
.PHONY: security .PHONY: security
security: security: external_dep
tox -e bandit tox -e bandit
.PHONY: drydock_docs .PHONY: drydock_docs
drydock_docs: drydock_docs: external_dep
tox -e docs tox -e docs
.PHONY: clean .PHONY: clean
@ -120,10 +120,10 @@ clean:
rm -rf charts/drydock/requirements.lock rm -rf charts/drydock/requirements.lock
.PHONY: pep8 .PHONY: pep8
pep8: pep8: external_dep
tox -e pep8 tox -e pep8
.PHONY: helm_lint .PHONY: helm_lint
helm_lint: clean helm_lint: clean helm-init
tools/helm_tk.sh $(HELM) tools/helm_tk.sh $(HELM)
$(HELM) lint charts/drydock $(HELM) lint charts/drydock

View File

@ -24,7 +24,7 @@ labels:
images: images:
tags: tags:
drydock: quay.io/attcomdev/drydock:1.0.1 drydock: quay.io/attcomdev/drydock:1.0.1
dep_check: quay.io/stackanetes/kubernetes-entrypoint:v0.2.1 dep_check: quay.io/stackanetes/kubernetes-entrypoint:v0.3.1
ks_user: docker.io/openstackhelm/heat:newton ks_user: docker.io/openstackhelm/heat:newton
ks_service: docker.io/openstackhelm/heat:newton ks_service: docker.io/openstackhelm/heat:newton
ks_endpoints: docker.io/openstackhelm/heat:newton ks_endpoints: docker.io/openstackhelm/heat:newton

View File

@ -11,6 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
"""Service initialization for the Drydock API."""
import logging import logging
import sys import sys
import os import os

View File

@ -1,5 +1,4 @@
# Copyright 2017 The Openstack-Helm Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
@ -14,9 +13,9 @@
- hosts: primary - hosts: primary
tasks: tasks:
- name: Build Charts - name: Execute the make target for Helm chart linting
shell: | make:
set -xe; chdir: "{{ zuul.project.src_dir }}"
./tools/gate/scripts/010-build-charts.sh target: helm_lint
args: register: result
chdir: "{{ zuul_osh_relative_path | default(zuul.project.src_dir) }}" failed_when: result.failed

View File

@ -1,43 +0,0 @@
# 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: all
vars_files:
- vars.yaml
vars:
work_dir: "{{ zuul.project.src_dir }}/{{ zuul_osh_infra_relative_path | default('') }}"
gather_facts: False
become: yes
roles:
- deploy-python
tags:
- deploy-python
- hosts: all
vars_files:
- vars.yaml
vars:
work_dir: "{{ zuul.project.src_dir }}/{{ zuul_osh_infra_relative_path | default('') }}"
gather_facts: True
become: yes
roles:
- setup-firewall
- deploy-python-pip
- deploy-docker
- deploy-yq
tags:
- setup-firewall
- deploy-python-pip
- deploy-docker
- deploy-yq

View File

@ -1,41 +0,0 @@
# 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: all
vars_files:
- vars.yaml
vars:
work_dir: "{{ zuul.project.src_dir }}/{{ zuul_osh_infra_relative_path | default('') }}"
gather_facts: False
become: yes
roles:
- deploy-python
tags:
- deploy-python
- hosts: all
vars_files:
- vars.yaml
vars:
work_dir: "{{ zuul.project.src_dir }}/{{ zuul_osh_infra_relative_path | default('') }}"
gather_facts: True
become: yes
roles:
- upgrade-host
- start-zuul-console
- disable-local-nameserver
tags:
- upgrade-host
- start-zuul-console
- disable-local-nameserver

View File

@ -1,5 +1,3 @@
# Copyright 2017 The Openstack-Helm Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
@ -12,19 +10,11 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
- hosts: all - hosts: primary
vars: tasks:
work_dir: "{{ zuul.project.src_dir }}/{{ zuul_osh_infra_relative_path | default('') }}" - name: Execute the make target for PEP8 linting
logs_dir: "/tmp/logs" make:
roles: chdir: "{{ zuul.project.src_dir }}"
- gather-host-logs target: pep8
- helm-release-status register: result
- describe-kubernetes-objects failed_when: result.failed
- gather-pod-logs
- gather-prom-metrics
tags:
- gather-host-logs
- helm-release-status
- describe-kubernetes-objects
- gather-pod-logs
- gather-prom-metrics

View File

@ -1,5 +1,3 @@
# Copyright 2017 The Openstack-Helm Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
@ -13,24 +11,10 @@
# limitations under the License. # limitations under the License.
- hosts: primary - hosts: primary
vars_files: tasks:
- vars.yaml - name: Execute the make target for security scanning
vars: make:
work_dir: "{{ zuul.project.src_dir }}/{{ zuul_osh_infra_relative_path | default('') }}" chdir: "{{ zuul.project.src_dir }}"
gather_facts: True target: security
roles: register: result
- build-helm-packages failed_when: result.failed
tags:
- build-helm-packages
- hosts: all
vars_files:
- vars.yaml
vars:
work_dir: "{{ zuul.project.src_dir }}/{{ zuul_osh_infra_relative_path | default('') }}"
gather_facts: False
become: yes
roles:
- build-images
tags:
- build-images

View File

@ -1,5 +1,3 @@
# Copyright 2017 The Openstack-Helm Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
@ -13,24 +11,10 @@
# limitations under the License. # limitations under the License.
- hosts: primary - hosts: primary
vars_files: tasks:
- vars.yaml - name: Execute the make target for unit testing
vars: make:
work_dir: "{{ zuul.project.src_dir }}/{{ zuul_osh_infra_relative_path | default('') }}" chdir: "{{ zuul.project.src_dir }}"
gather_facts: True target: unit_tests
roles: register: result
- build-helm-packages failed_when: result.failed
- deploy-kubeadm-aio-master
tags:
- build-helm-packages
- deploy-kubeadm-aio-master
- hosts: nodes
vars_files:
- vars.yaml
vars:
work_dir: "{{ zuul.project.src_dir }}/{{ zuul_osh_infra_relative_path | default('') }}"
roles:
- deploy-kubeadm-aio-node
tags:
- deploy-kubeadm-aio-node

View File

@ -1,19 +0,0 @@
#!/bin/bash
# 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.
set -xe
make charts

View File

@ -58,6 +58,12 @@ pushd openstack-helm/$HTK_PATH
git reset --hard "${HTK_STABLE_COMMIT}" git reset --hard "${HTK_STABLE_COMMIT}"
helm_serve helm_serve
# OSH Makefile is bugged, so ensure helm is in the path
if [[ ${HELM} != "helm" ]]
then
export PATH=${PATH}:$(dirname ${HELM})
fi
make helm-toolkit make helm-toolkit
popd && popd popd && popd
for c in $DEP_UP_LIST for c in $DEP_UP_LIST