openstack-helm-infra/playbooks/lint.yml
Vladimir Kozhukalov cf2cdd7821 Fix prevent trailing whitespace lint command
Recently we added a jpg file to OSH documentation
but the lint job didn't run due to the job configuration.

But then for the next PR link job did run and failed
due to trailing whitespace in the jpg file.

Change-Id: I9abf8f93a4566411076190965f282375846dc5db
2024-02-02 14:12:26 -06:00

82 lines
2.7 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: ensure-helm
helm_version: "3.6.3"
- name: ensure-chart-testing
chart_testing_version: "3.4.0"
- 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('') }}"
tasks:
- name: make all
make:
chdir: "{{ zuul.project.src_dir }}"
target: all
- name: make all osh
make:
chdir: "{{ zuul.project.src_dir }}/{{ zuul_osh_relative_path | default('../openstack-helm/') }}"
target: all
when: lint_osh is defined
- name: Prevent trailing whitespaces
shell: find . \! \( -path "*/\.*" -o -path "*/doc/build/*" -o -name "*.tgz" -o -name "*.png" -o -name "*.jpg" \) -type f -exec grep -El " +$" {} \;
register: _found_whitespaces
failed_when: _found_whitespaces.stdout != ""
args:
chdir: "{{ ansible_user_dir }}/src/{{ zuul.project.canonical_name }}"
- name: Check release note version matches
shell: ../openstack-helm-infra/tools/gate/reno-check.sh
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
- name: Execute yamllint check for osh values* yaml files
command: tox -e lint
args:
chdir: "{{ zuul.project.src_dir }}/{{ zuul_osh_relative_path | default('../openstack-helm/') }}"
when: yamllintconf.stat.exists == True and lint_osh is defined
...