fix: Improve validation errors

This commit is contained in:
Gerald Pinder 2024-12-11 19:40:12 -05:00
parent 6424bf3573
commit 3d0ae32734
99 changed files with 3773 additions and 425 deletions

View file

@ -1,16 +1,21 @@
import "@typespec/json-schema";
using TypeSpec.JsonSchema;
@jsonSchema("/modules/containerfile.json")
model ContainerfileModule {
/** The containerfile module is a tool for adding custom Containerfile instructions for custom image builds.
* https://blue-build.org/reference/modules/containerfile/
*/
type: "containerfile";
@jsonSchema("/modules/containerfile-latest.json")
model ContainerfileModuleLatest {
...ContainerfileModuleV1;
}
/** Lines to directly insert into the generated Containerfile. */
snippets?: Array<string>;
@jsonSchema("/modules/containerfile-v1.json")
model ContainerfileModuleV1 {
/** The containerfile module is a tool for adding custom Containerfile instructions for custom image builds.
* https://blue-build.org/reference/modules/containerfile/
*/
type: "containerfile" | "containerfile@latest" | "containerfile@v1";
/** Names of directories in ./containerfiles/ containing each a Containerfile to insert into the generated Containerfile. */
containerfiles?: Array<string>;
}
/** Lines to directly insert into the generated Containerfile. */
snippets?: Array<string>;
/** Names of directories in ./containerfiles/ containing each a Containerfile to insert into the generated Containerfile. */
containerfiles?: Array<string>;
}

View file

@ -1,12 +1,17 @@
import "@typespec/json-schema";
using TypeSpec.JsonSchema;
@jsonSchema("/modules/copy.json")
model CopyModule {
@jsonSchema("/modules/copy-latest.json")
model CopyModuleLatest {
...CopyModuleV1;
}
@jsonSchema("/modules/copy-v1.json")
model CopyModuleV1 {
/** The copy module is a short-hand method of adding a COPY instruction into the Containerfile.
* https://blue-build.org/reference/modules/copy/
*/
type: "copy";
type: "copy" | "copy@latest" | "copy@v1";
/** Equivalent to the --from property in a COPY statement, use to specify an image to copy from.
* By default, the COPY source is the build environment's file tree.

View file

@ -22,7 +22,7 @@ RUN \
{%- else if module.is_local_source() %}
--mount=type=bind,from=stage-modules,src=/modules,dst=/tmp/modules,rw \
{%- else %}
--mount=type=bind,from={{ blue_build_utils::constants::BLUE_BUILD_MODULE_IMAGE_REF }}/{{ module.module_type.typ() }}:{{ module.module_type.version() }},src=/modules,dst=/tmp/modules,rw \
--mount=type=bind,from={{ module.get_module_image() }},src=/modules,dst=/tmp/modules,rw \
{%- endif %}
{%- if module.module_type.typ() == "akmods" %}
--mount=type=bind,from=stage-akmods-{{ module.generate_akmods_info(os_version).stage_name }},src=/rpms,dst=/tmp/rpms,rw \
@ -61,7 +61,7 @@ RUN \
{%- else if module.is_local_source() %}
--mount=type=bind,from=stage-modules,src=/modules,dst=/tmp/modules,rw \
{%- else %}
--mount=type=bind,from={{ blue_build_utils::constants::BLUE_BUILD_MODULE_IMAGE_REF }}/{{ module.module_type.typ() }}:{{ module.module_type.version() }},src=/modules,dst=/tmp/modules,rw \
--mount=type=bind,from={{ module.get_module_image() }},src=/modules,dst=/tmp/modules,rw \
{%- endif %}
--mount=type=bind,from={{ build_scripts_image }},src=/scripts/,dst=/tmp/scripts/ \
/tmp/scripts/run_module.sh '{{ module.module_type.typ() }}' '{{ module|json|safe }}'