Add basic Helm jobs
This adds a simple job which runs the `chart-testing` linter against a repository. Change-Id: I974c64343e88c235a6dc887d5378f7db2ee3b1fc
This commit is contained in:
parent
b62c488eab
commit
b476e34ab0
4
doc/source/helm-jobs.rst
Normal file
4
doc/source/helm-jobs.rst
Normal file
@ -0,0 +1,4 @@
|
||||
Helm Jobs
|
||||
=========
|
||||
|
||||
.. zuul:autojob:: chart-testing-lint
|
5
doc/source/helm-roles.rst
Normal file
5
doc/source/helm-roles.rst
Normal file
@ -0,0 +1,5 @@
|
||||
Helm Roles
|
||||
==========
|
||||
|
||||
.. zuul:autorole:: ensure-helm
|
||||
.. zuul:autorole:: ensure-chart-testing
|
@ -9,3 +9,4 @@ Jobs
|
||||
js-jobs
|
||||
docker-jobs
|
||||
go-jobs
|
||||
helm-jobs
|
||||
|
@ -17,3 +17,4 @@ Roles
|
||||
puppet-roles
|
||||
python-roles
|
||||
translation-roles
|
||||
helm-roles
|
||||
|
5
playbooks/chart-testing/pre.yaml
Normal file
5
playbooks/chart-testing/pre.yaml
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
- hosts: all
|
||||
roles:
|
||||
- ensure-helm
|
||||
- ensure-chart-testing
|
10
playbooks/chart-testing/run.yaml
Normal file
10
playbooks/chart-testing/run.yaml
Normal 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 }}"
|
7
roles/ensure-chart-testing/README.rst
Normal file
7
roles/ensure-chart-testing/README.rst
Normal file
@ -0,0 +1,7 @@
|
||||
Ensure chart-testing is installed
|
||||
|
||||
**Role Variables**
|
||||
|
||||
.. zuul:rolevar:: chart_testing_version
|
||||
|
||||
Version of chart-testing to install
|
2
roles/ensure-chart-testing/defaults/main.yaml
Normal file
2
roles/ensure-chart-testing/defaults/main.yaml
Normal file
@ -0,0 +1,2 @@
|
||||
---
|
||||
chart_testing_version: 2.4.0
|
29
roles/ensure-chart-testing/tasks/main.yaml
Normal file
29
roles/ensure-chart-testing/tasks/main.yaml
Normal 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
|
7
roles/ensure-helm/README.rst
Normal file
7
roles/ensure-helm/README.rst
Normal file
@ -0,0 +1,7 @@
|
||||
Ensure Helm is installed
|
||||
|
||||
**Role Variables**
|
||||
|
||||
.. zuul:rolevar:: helm_version
|
||||
|
||||
Version of Helm to install
|
2
roles/ensure-helm/defaults/main.yaml
Normal file
2
roles/ensure-helm/defaults/main.yaml
Normal file
@ -0,0 +1,2 @@
|
||||
---
|
||||
helm_version: 2.16.1
|
20
roles/ensure-helm/tasks/main.yaml
Normal file
20
roles/ensure-helm/tasks/main.yaml
Normal 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
6
zuul.d/helm-jobs.yaml
Normal 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
|
Loading…
Reference in New Issue
Block a user