helm: handle multiline output (#64)

Fixes: #399

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
This commit is contained in:
Abhijeet Kasurde
2021-04-20 12:07:28 +05:30
committed by GitHub
parent 5f993e6028
commit 5a0f5d6b93
7 changed files with 187 additions and 94 deletions

View File

@@ -0,0 +1,11 @@
name: "sample_plugin"
version: "0.0.1"
usage: "Sample Helm Plugin"
description: |-
This plugin provides sample plugin to Helm.
usage:
This is new line
This is another line
ignoreFlags: false
useTunnel: false
command: "$HELM_PLUGIN_DIR/main.sh"

View File

@@ -75,3 +75,36 @@
- assert:
that:
- not uninstall_env.changed
# https://github.com/ansible-collections/community.kubernetes/issues/399
- name: Copy required plugin files
copy:
src: "files/sample_plugin"
dest: "/tmp/helm_plugin_test/"
- name: Install sample_plugin from the directory
helm_plugin:
binary_path: "{{ helm_binary }}"
state: present
plugin_path: "/tmp/helm_plugin_test/sample_plugin"
register: sample_plugin_output
- name: Assert that sample_plugin is installed or not
assert:
that:
- sample_plugin_output.changed
- name: Gather Helm plugin info
helm_plugin_info:
register: r
- name: Set sample_plugin version
set_fact:
plugin_version: "{{ ( r.plugin_list | selectattr('name', 'equalto', plugin_name) | list )[0].version }}"
vars:
plugin_name: "sample_plugin"
- name: Assert if sample_plugin with multiline comment is installed
assert:
that:
- plugin_version == "0.0.1"