diff --git a/molecule/default/roles/helm/files/test-chart/Chart.yaml b/molecule/default/roles/helm/files/test-chart/Chart.yaml new file mode 100644 index 00000000..5d09a08c --- /dev/null +++ b/molecule/default/roles/helm/files/test-chart/Chart.yaml @@ -0,0 +1,6 @@ +apiVersion: v2 +name: test-chart +description: A chart used in molecule tests +type: application +version: 0.1.0 +appVersion: "default" diff --git a/molecule/default/roles/helm/tasks/tests_chart/from_local_path.yml b/molecule/default/roles/helm/tasks/tests_chart/from_local_path.yml index 8b874718..4de4f8c0 100644 --- a/molecule/default/roles/helm/tasks/tests_chart/from_local_path.yml +++ b/molecule/default/roles/helm/tasks/tests_chart/from_local_path.yml @@ -18,6 +18,40 @@ chart_source: "/tmp/helm_test_repo/stable/{{ chart_test }}/" chart_source_upgrade: "/tmp/helm_test_repo_upgrade/stable/{{ chart_test }}/" +- name: Test appVersion idempotence + vars: + chart_test: "test-chart" + chart_test_version: "0.1.0" + chart_test_version_upgrade: "0.1.0" + chart_test_app_version: "v1" + chart_test_upgrade_app_version: "v2" + block: + - name: Copy test chart + copy: + src: "{{ chart_test }}" + dest: "/tmp/helm_test_appversion/" + + - name: Create test archives + block: + - name: "Package chart into archive with appVersion {{ item }}" + command: "{{ helm_binary }} package --app-version {{ item }} /tmp/helm_test_appversion/{{ chart_test }}" + + - name: "Move appVersion {{ item }} chart archive" + copy: + remote_src: true + src: "test-chart-{{ chart_test_version }}.tgz" + dest: "/tmp/helm_test_appversion/{{ chart_test }}-{{ item }}-{{ chart_test_version }}.tgz" + with_items: + - "{{ chart_test_app_version }}" + - "{{ chart_test_upgrade_app_version }}" + + - name: Install Chart from local path + include_tasks: "../tests_chart.yml" + vars: + source: local_path + chart_source: "/tmp/helm_test_appversion/{{ chart_test }}-{{ chart_test_app_version }}-{{ chart_test_version }}.tgz" + chart_source_upgrade: "/tmp/helm_test_appversion/{{ chart_test }}-{{ chart_test_upgrade_app_version }}-{{ chart_test_version }}.tgz" + - name: Remove clone repos file: path: "{{ item }}" @@ -25,3 +59,4 @@ with_items: - /tmp/helm_test_repo - /tmp/helm_test_repo_upgrade + - /tmp/helm_test_repo_upgrade diff --git a/plugins/modules/helm.py b/plugins/modules/helm.py index ea62bb3f..54c14fad 100644 --- a/plugins/modules/helm.py +++ b/plugins/modules/helm.py @@ -496,7 +496,8 @@ def main(): changed = True elif force or release_values != release_status['values'] \ - or (chart_info['name'] + '-' + chart_info['version']) != release_status["chart"]: + or (chart_info['name'] + '-' + chart_info['version']) != release_status["chart"] \ + or chart_info['appVersion'] != release_status["app_version"]: helm_cmd = deploy(helm_cmd, release_name, release_values, chart_ref, wait, wait_timeout, disable_hook, force, atomic=atomic, create_namespace=create_namespace, replace=replace)