As outlined in https://lists.opendev.org/archives/list/service-discuss@lists.opendev.org/thread/VTMDDVSPM5HRUYWAATNMZOILT5OE57VR/ the current structure of building all the charts into one directory is causing issues on the opendev infra due too many entries in one directory. Switch away from using a Makefile to using an Ansible role to build each chart and then use chart-testing to identify the charts that need to be rebuilt and lastly build them build put the output into a subdir matching the chart name. Change-Id: I61f11950ba381c7897eb6bfff05a508ca4db9f06 Signed-off-by: Doug Goldstein <cardoe@cardoe.com> Signed-off-by: Vladimir Kozhukalov <kozhukalov@gmail.com>
71 lines
2.2 KiB
YAML
71 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:
|
|
- ensure-python
|
|
- ensure-pip
|
|
- ensure-helm
|
|
- ensure-chart-testing
|
|
- name: chart-testing
|
|
chart_testing_options: "--target-branch=master --chart-dirs=. --validate-maintainers=false --check-version-increment=false"
|
|
zuul_work_dir: "{{ work_dir }}"
|
|
vars:
|
|
work_dir: "{{ zuul.project.src_dir }}"
|
|
|
|
tasks:
|
|
- name: Install yamllint
|
|
pip:
|
|
name:
|
|
- yq
|
|
- yamllint
|
|
virtualenv: "{{ virtualenv }}"
|
|
virtualenv_command: python3 -m venv
|
|
|
|
- name: Run yamllint
|
|
shell: |
|
|
cat > /tmp/yamllint.sh <<EOF
|
|
#!/bin/bash
|
|
set -xe
|
|
source "{{ virtualenv }}/bin/activate"
|
|
pip freeze
|
|
rm -rf */charts/helm-toolkit
|
|
mkdir .yamllint
|
|
cp -r * .yamllint
|
|
rm -rf .yamllint/roles
|
|
rm -rf .yamllint/*/templates
|
|
|
|
for i in */; do
|
|
# avoid helm-toolkit to symlink on itself
|
|
[ -d "\$i/templates" -a "\$i" != "helm-toolkit/" ] || continue
|
|
mkdir -p \$i/charts
|
|
ln -s ../../helm-toolkit \$i/charts/helm-toolkit
|
|
helm template \$i --output-dir .yamllint 2>&1 > /dev/null
|
|
done
|
|
find .yamllint -type f -exec sed -i 's/%%%.*/XXX/g' {} +
|
|
|
|
shopt -s globstar extglob
|
|
# Lint all yaml files except templates
|
|
yamllint -c yamllint.conf .yamllint/*{,/!(templates)/**}/*.y*ml yamllint*.conf
|
|
# Lint templates
|
|
yamllint -c yamllint-templates.conf .yamllint/*/templates/*.yaml
|
|
EOF
|
|
chmod +x /tmp/yamllint.sh
|
|
/tmp/yamllint.sh
|
|
args:
|
|
chdir: "{{ work_dir }}"
|
|
executable: /bin/bash
|
|
...
|