fix: Unable to use SHELL with podman, encapsulate commands in /bin/bash -c

This commit is contained in:
Gerald Pinder 2024-03-26 22:02:41 -04:00
parent 189141924b
commit ae9c3ef83a
3 changed files with 13 additions and 11 deletions

View file

@ -75,10 +75,12 @@ impl<'a> Module<'a> {
#[must_use]
pub fn print_module_context(&'a self) -> String {
serde_json::to_string(self).unwrap_or_else(|e| {
error!("Failed to parse module!!!!!: {e}");
process::exit(1);
})
serde_json::to_string(self)
.unwrap_or_else(|e| {
error!("Failed to parse module!!!!!: {e}");
process::exit(1);
})
.replace('"', r#"\""#)
}
#[must_use]

View file

@ -17,6 +17,4 @@ ARG CONFIG_DIRECTORY="/tmp/config"
ARG IMAGE_NAME="{{ recipe.name }}"
ARG BASE_IMAGE="{{ recipe.base_image }}"
SHELL ["bash", "-c"]
{% include "modules/modules.j2" %}

View file

@ -29,11 +29,13 @@ RUN \
{%- endif %}
--mount=type=bind,from=stage-exports,src=/exports.sh,dst=/tmp/exports.sh \
--mount=type=cache,dst=/var/cache/rpm-ostree,id=rpm-ostree-cache-{{ recipe.name }}-{{ recipe.image_version }},sharing=locked \
echo "========== Start {{ type|capitalize }} module ==========" \
&& chmod +x /tmp/modules/{{ type }}/{{ type }}.sh \
&& source /tmp/exports.sh && /tmp/modules/{{ type }}/{{ type }}.sh '{{ module.print_module_context() }}' \
&& echo "========== End {{ type|capitalize }} module ==========" \
&& ostree container commit
/bin/bash -c " \
echo '========== Start {{ type|capitalize }} module ==========' \
&& chmod +x /tmp/modules/{{ type }}/{{ type }}.sh \
&& source /tmp/exports.sh \
&& /tmp/modules/{{ type }}/{{ type }}.sh '{{ module.print_module_context() }}' \
&& echo '========== End {{ type|capitalize }} module ==========' \
&& ostree container commit"
{%- endif %}
{%- endif %}
{%- endfor %}