feat: Move module run logic into its own script (#168)

This will help make the Containerfile just a little bit easier to read
(ignoring all the mounts lol). This would also allow us to add logic
later to support modules that run executables other than `*.sh`.
This commit is contained in:
Gerald Pinder 2024-04-27 15:19:58 -04:00 committed by GitHub
parent 3898202bc3
commit 0c7033ccd2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 44 additions and 13 deletions

View file

@ -30,14 +30,10 @@ RUN \
{%- if type == "akmods" %}
--mount=type=bind,from=stage-akmods-{{ module.generate_akmods_info(os_version).stage_name }},src=/rpms,dst=/tmp/rpms,rw \
{%- endif %}
--mount=type=bind,from=ghcr.io/blue-build/cli:{{ exports_tag }}-exports,src=/exports.sh,dst=/tmp/exports.sh \
--mount=type=bind,from=ghcr.io/blue-build/cli:{{ exports_tag }}-build-scripts,src=/scripts/,dst=/tmp/scripts/ \
--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
source /tmp/scripts/exports.sh \
&& /tmp/scripts/run_module.sh {{ type }} '{{ module.print_module_context() }}'
{%- endif %}
{%- endif %}
{%- endfor %}