fix: Put export script in own image
HEREDOC support for podman doesn't work exactly 1-1 with Dockerfiles. This fix gives the export script its own image that we mount.
This commit is contained in:
parent
ae9c3ef83a
commit
19c93ce742
9 changed files with 29 additions and 28 deletions
|
|
@ -75,12 +75,6 @@ pub struct GithubIssueTemplate<'a> {
|
|||
terminal_version: Cow<'a, str>,
|
||||
}
|
||||
|
||||
fn print_export_script() -> String {
|
||||
trace!("print_export_script()");
|
||||
|
||||
include_str!("../templates/export.sh").replace('$', r"\$")
|
||||
}
|
||||
|
||||
fn has_cosign_file() -> bool {
|
||||
trace!("has_cosign_file()");
|
||||
std::env::current_dir()
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
# syntax=docker/dockerfile:1
|
||||
{%- include "stages.j2" %}
|
||||
|
||||
FROM {{ recipe.base_image }}:{{ recipe.image_version }}
|
||||
|
|
|
|||
|
|
@ -1,26 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Function to retrieve module configs and populate an array
|
||||
# Arguments:
|
||||
# 1. Variable name to store result
|
||||
# 2. jq query
|
||||
# 3. Module config content
|
||||
get_yaml_array() {
|
||||
local -n arr=$1
|
||||
local jq_query=$2
|
||||
local module_config=$3
|
||||
|
||||
if [[ -z $jq_query || -z $module_config ]]; then
|
||||
echo "Usage: get_yaml_array VARIABLE_TO_STORE_RESULTS JQ_QUERY MODULE_CONFIG" >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
readarray -t arr < <(echo "$module_config" | yq -I=0 "$jq_query")
|
||||
}
|
||||
|
||||
# Parse OS version and export it
|
||||
export OS_VERSION=$(grep -Po "(?<=VERSION_ID=)\d+" /usr/lib/os-release)
|
||||
|
||||
# Export functions for use in sub-shells or sourced scripts
|
||||
export -f get_yaml_array
|
||||
|
||||
|
|
@ -27,15 +27,14 @@ 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=stage-exports,src=/exports.sh,dst=/tmp/exports.sh \
|
||||
--mount=type=bind,from=ghcr.io/blue-build/cli/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 \
|
||||
/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"
|
||||
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 %}
|
||||
|
|
|
|||
|
|
@ -42,11 +42,3 @@ COPY cosign.pub /keys/{{ recipe.name|replace('/', "_") }}.pub
|
|||
{%- endif %}
|
||||
|
||||
{%- include "modules/akmods/akmods.j2" %}
|
||||
|
||||
# This stage is responsible for holding onto
|
||||
# exports like the exports.sh
|
||||
FROM docker.io/alpine as stage-exports
|
||||
COPY <<EOF /exports.sh
|
||||
{{ self::print_export_script() }}
|
||||
EOF
|
||||
RUN chmod +x /exports.sh
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue