Basic zuul gates
- Pep8, bandit and unit tests - Document build (no publish) Change-Id: I2ca67e69f80aff63576bebd14da412e2f138f54a
This commit is contained in:
parent
d9e9803f4f
commit
4ad86e0728
49
.zuul.yaml
49
.zuul.yaml
@ -14,13 +14,60 @@
|
||||
check:
|
||||
jobs:
|
||||
- airship-pegleg-linter
|
||||
- airship-pegleg-doc-build
|
||||
- airship-pegleg-lint-pep8
|
||||
- airship-pegleg-unit-py35
|
||||
- airship-pegleg-security-bandit
|
||||
|
||||
gate:
|
||||
jobs:
|
||||
- airship-pegleg-linter
|
||||
- airship-pegleg-doc-build
|
||||
- airship-pegleg-lint-pep8
|
||||
- airship-pegleg-unit-py35
|
||||
- airship-pegleg-security-bandit
|
||||
|
||||
- nodeset:
|
||||
name: airship-pegleg-single-node
|
||||
nodes:
|
||||
- name: primary
|
||||
label: ubuntu-xenial
|
||||
|
||||
- job:
|
||||
name: airship-pegleg-linter
|
||||
description: |
|
||||
Lints all files by checking them for whitespace.
|
||||
run: tools/gate/playbooks/zuul-linter.yaml
|
||||
nodeset: openstack-helm-single-node
|
||||
nodeset: airship-pegleg-single-node
|
||||
|
||||
- job:
|
||||
name: airship-pegleg-lint-pep8
|
||||
description: |
|
||||
Lints Python files against the PEP8 standard
|
||||
run: tools/gate/playbooks/pep8-linter.yaml
|
||||
timeout: 300
|
||||
nodeset: airship-pegleg-single-node
|
||||
|
||||
- job:
|
||||
name: airship-pegleg-unit-py35
|
||||
description: |
|
||||
Executes unit tests under Python 3.5
|
||||
run: tools/gate/playbooks/unit-py35.yaml
|
||||
timeout: 300
|
||||
nodeset: airship-pegleg-single-node
|
||||
|
||||
- job:
|
||||
name: airship-pegleg-security-bandit
|
||||
description: |
|
||||
Executes the Bandit security scanner against Python files
|
||||
run: tools/gate/playbooks/security-bandit.yaml
|
||||
timeout: 300
|
||||
nodeset: airship-pegleg-single-node
|
||||
|
||||
- job:
|
||||
name: airship-pegleg-doc-build
|
||||
description: |
|
||||
Locally build the documentation to check for errors
|
||||
run: tools/gate/playbooks/doc-build.yaml
|
||||
timeout: 300
|
||||
nodeset: airship-pegleg-single-node
|
||||
|
8
Makefile
8
Makefile
@ -41,6 +41,10 @@ run_pegleg: build_pegleg
|
||||
.PHONY: tests
|
||||
tests: run_tests
|
||||
|
||||
.PHONY: security
|
||||
security:
|
||||
tox -c src/bin/pegleg/tox.ini -e bandit
|
||||
|
||||
# Run all unit tests under src/bin/pegleg
|
||||
.PHONY: run_tests
|
||||
run_tests:
|
||||
@ -65,6 +69,10 @@ ifeq ($(PUSH_IMAGE), true)
|
||||
docker push $(IMAGE)
|
||||
endif
|
||||
|
||||
.PHONY: docs
|
||||
docs: clean
|
||||
tox -edocs
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
rm -rf build
|
||||
|
@ -5,3 +5,6 @@ mock==2.0.0
|
||||
|
||||
# Linting
|
||||
flake8==3.3.0
|
||||
|
||||
# Security
|
||||
bandit==1.4.0
|
||||
|
@ -27,5 +27,8 @@ commands =
|
||||
yapf -rd {toxinidir}/pegleg {toxinidir}/tests
|
||||
flake8 {toxinidir}/pegleg
|
||||
|
||||
[testenv:bandit]
|
||||
commands = bandit -r pegleg -n 5
|
||||
|
||||
[flake8]
|
||||
ignore = E125,E251,W503
|
||||
|
20
tools/gate/playbooks/doc-build.yaml
Normal file
20
tools/gate/playbooks/doc-build.yaml
Normal file
@ -0,0 +1,20 @@
|
||||
# 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: Build documents locally
|
||||
make:
|
||||
chdir: "{{ zuul.project.src_dir }}"
|
||||
target: docs
|
||||
register: result
|
||||
failed_when: result.failed
|
20
tools/gate/playbooks/pep8-linter.yaml
Normal file
20
tools/gate/playbooks/pep8-linter.yaml
Normal file
@ -0,0 +1,20 @@
|
||||
# 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 PEP8 linting
|
||||
make:
|
||||
chdir: "{{ zuul.project.src_dir }}"
|
||||
target: py_lint
|
||||
register: result
|
||||
failed_when: result.failed
|
20
tools/gate/playbooks/security-bandit.yaml
Normal file
20
tools/gate/playbooks/security-bandit.yaml
Normal file
@ -0,0 +1,20 @@
|
||||
# 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 security scanning
|
||||
make:
|
||||
chdir: "{{ zuul.project.src_dir }}"
|
||||
target: security
|
||||
register: result
|
||||
failed_when: result.failed
|
20
tools/gate/playbooks/unit-py35.yaml
Normal file
20
tools/gate/playbooks/unit-py35.yaml
Normal file
@ -0,0 +1,20 @@
|
||||
# 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 unit testing
|
||||
make:
|
||||
chdir: "{{ zuul.project.src_dir }}"
|
||||
target: tests
|
||||
register: result
|
||||
failed_when: result.failed
|
15
tools/gate/playbooks/vars.yaml
Normal file
15
tools/gate/playbooks/vars.yaml
Normal file
@ -0,0 +1,15 @@
|
||||
# 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.
|
||||
|
||||
null: null
|
@ -15,6 +15,6 @@
|
||||
- hosts: primary
|
||||
tasks:
|
||||
- name: Execute a Whitespace Linter check
|
||||
command: find . -not -path "*/\.*" -not -path "*/doc/build/*" -not -name "*.tgz" -type f -exec egrep -l " +$" {} \;
|
||||
command: find . -not -path "*/\.*" -not -path "*/docs/build/*" -not -name "*.tgz" -type f -exec egrep -l " +$" {} \;
|
||||
register: result
|
||||
failed_when: result.stdout != ""
|
||||
|
Loading…
x
Reference in New Issue
Block a user