From dabd9d676c18b94e19782cd1fd230194581fffa5 Mon Sep 17 00:00:00 2001 From: Guillaume Boutry Date: Thu, 1 Feb 2024 21:57:24 +0100 Subject: [PATCH] Use slurp module to fetch remote file content The slurp module will fetch as b64 the content of remote file. Using slurp allows working in relative path like other modules, instead of trying absolute paths in a lookup. Change-Id: I773819d1d17fb6faaedacf73dea8f645b3cb9699 --- roles/charm-publish/tasks/publish.yaml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/roles/charm-publish/tasks/publish.yaml b/roles/charm-publish/tasks/publish.yaml index c25686e0..d154a275 100644 --- a/roles/charm-publish/tasks/publish.yaml +++ b/roles/charm-publish/tasks/publish.yaml @@ -37,10 +37,17 @@ dest: "{{ zuul.project.src_dir }}/{{ charm_build_name }}" remote_src: true + - name: Read metadata.yaml + slurp: + src: "{{ zuul.project.src_dir }}/{{ charm_build_name }}/metadata.yaml" + register: metadata_file + + - name: Parse metadata.yaml + set_fact: + metadata: "{{ metadata_file.content | b64decode | from_yaml }}" + - name: Upload oci-image to charmhub register: upload_oci_image_output - vars: - metadata: "{{ lookup('file', zuul.executor.work_root + '/' + zuul.project.src_dir + '/' + charm_build_name + '/metadata.yaml') | from_yaml }}" args: executable: /bin/bash shell: |