Merge "Add basic Helm jobs"

This commit is contained in:
Zuul 2020-01-09 21:19:44 +00:00 committed by Gerrit Code Review
commit 14478de03f
13 changed files with 99 additions and 0 deletions

4
doc/source/helm-jobs.rst Normal file
View File

@ -0,0 +1,4 @@
Helm Jobs
=========
.. zuul:autojob:: chart-testing-lint

View File

@ -0,0 +1,5 @@
Helm Roles
==========
.. zuul:autorole:: ensure-helm
.. zuul:autorole:: ensure-chart-testing

View File

@ -9,3 +9,4 @@ Jobs
js-jobs
docker-jobs
go-jobs
helm-jobs

View File

@ -17,3 +17,4 @@ Roles
puppet-roles
python-roles
translation-roles
helm-roles

View File

@ -0,0 +1,5 @@
---
- hosts: all
roles:
- ensure-helm
- ensure-chart-testing

View File

@ -0,0 +1,10 @@
---
- hosts: all
tasks:
- name: Run linters
# NOTE(mnaser): We use --validate-maintainers=false because chart-testing
# relies on the existance of a remote URL which is /dev/null
# in Zuul and fails.
command: ct lint --validate-maintainers=false
args:
chdir: "{{ zuul.project.src_dir }}"

View File

@ -0,0 +1,7 @@
Ensure chart-testing is installed
**Role Variables**
.. zuul:rolevar:: chart_testing_version
Version of chart-testing to install

View File

@ -0,0 +1,2 @@
---
chart_testing_version: 2.4.0

View File

@ -0,0 +1,29 @@
---
- name: Install Python dependencies
become: true
pip:
name:
- yamale==1.8.0
- yamllint==1.13.0
- name: Install chart-testing
become: true
unarchive:
remote_src: true
src: "https://github.com/helm/chart-testing/releases/download/v{{ chart_testing_version }}/chart-testing_{{ chart_testing_version }}_linux_amd64.tar.gz"
dest: /usr/local/bin
- name: Setup /etc/ct
become: true
file:
path: /etc/ct
state: directory
- name: Install configuration files
become: true
get_url:
url: "https://raw.githubusercontent.com/helm/chart-testing/v{{ chart_testing_version }}/etc/{{ item }}"
dest: "/etc/ct/{{ item }}"
loop:
- chart_schema.yaml
- lintconf.yaml

View File

@ -0,0 +1,7 @@
Ensure Helm is installed
**Role Variables**
.. zuul:rolevar:: helm_version
Version of Helm to install

View File

@ -0,0 +1,2 @@
---
helm_version: 2.16.1

View File

@ -0,0 +1,20 @@
---
- name: Download Helm
unarchive:
remote_src: true
src: "https://get.helm.sh/helm-v{{ helm_version }}-linux-amd64.tar.gz"
dest: /tmp
- name: Install Helm
become: true
copy:
remote_src: true
src: /tmp/linux-amd64/helm
dest: /usr/local/bin/helm
mode: '0755'
- name: Initialize Helm
shell: helm init --client-only
tags:
# NOTE(mnaser): The `helm` module does not support running init only.
- skip_ansible_lint

6
zuul.d/helm-jobs.yaml Normal file
View File

@ -0,0 +1,6 @@
- job:
name: chart-testing-lint
description: |
Run chart-testing on Helm charts
pre-run: playbooks/chart-testing/pre.yaml
run: playbooks/chart-testing/run.yaml