openstack-helm-infra/playbooks/lint.yml
Mohammed Naser d4e2228f03 lint: enable running on changed charts only
At the moment, we are using --all which means run the linting on all of
the charts.  However, the problem with using --all is that it disables
version checking which means we can't enforce version changes on Helm
charts.

This patch drops it which means the chart-testing logic will go over the
changed files and make sure that it lints those charts which have
undergone changes.

Because we use a mdoel of 1 commit per merge within Gerrit, this should
still give us the exact coverage that we need without potentially
missing any linting changes.

Change-Id: I64c7896b25c1f3daaa4f61723de8a6c722aaf3a6
2020-09-17 13:50:26 -04:00

63 lines
2.2 KiB
YAML

---
# Copyright 2018 SUSE LINUX GmbH.
#
# 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
roles:
- name: build-helm-packages
work_dir: "{{ zuul.projects['opendev.org/openstack/openstack-helm-infra'].src_dir }}"
- name: build-helm-packages
work_dir: "{{ zuul.projects['opendev.org/openstack/openstack-helm'].src_dir }}"
when: "zuul.project.name == 'openstack/openstack-helm'"
- ensure-chart-testing
- name: chart-testing
chart_testing_options: "--chart-dirs=. --validate-maintainers=false"
zuul_work_dir: "{{ work_dir }}"
vars:
work_dir: "{{ zuul.project.src_dir }}/{{ zuul_osh_infra_relative_path | default('') }}"
- hosts: all[0]
tasks:
- name: Prevent trailing whitespaces
shell: find . \! \( -path "*/\.*" -o -path "*/doc/build/*" -o -name "*.tgz" -o -name "*.png" \) -type f -exec egrep -l " +$" {} \;
register: _found_whitespaces
failed_when: _found_whitespaces.stdout != ""
args:
chdir: "{{ ansible_user_dir }}/src/{{ zuul.project.canonical_name }}"
- name: Check if yamllint.conf exists
stat:
path: "{{ ansible_user_dir }}/src/{{ zuul.project.canonical_name }}/yamllint.conf"
register: yamllintconf
- name: Install jq and pip
apt:
pkg:
- jq
- python3-pip
become: yes
when: yamllintconf.stat.exists == True
- name: Install tox
shell: pip3 install -U tox
become: yes
when: yamllintconf.stat.exists == True
- name: Execute yamllint check for values* yaml files
command: tox -e lint
args:
chdir: "{{ ansible_user_dir }}/src/{{ zuul.project.canonical_name }}"
when: yamllintconf.stat.exists == True
...