Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: init package clarity and cleanup #2447

Merged
merged 21 commits into from
Apr 24, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
reordering
  • Loading branch information
AustinAbro321 committed Apr 24, 2024
commit 2a92710eff17e1f5bc391be72dc307da495d8bef
69 changes: 4 additions & 65 deletions site/src/content/docs/ref/create.mdx
Original file line number Diff line number Diff line change
@@ -1,79 +1,18 @@
---
title: Create a Package
title: Create Templates
sidebar:
order: 60
order: 32
---

import Mermaid from "@components/Mermaid.astro";
import Details from "@components/Details.astro";

The following diagram shows the order of operations for the `zarf package create` command and the hook locations for [actions](/ref/actions).

<Details label="Lifecycle Diagram">
<Mermaid diagram={`
graph TD
A1(set working directory)-->A2
A2(parse zarf.yaml)-->A3
A3(filter components by architecture)-->A4
A4(detect init package)-->A5
A5(handle deprecations)-->A6
A6(parse component imports)-->A7
A7(process create-time variables)-->A8
A8(write build data and zarf.yaml)-->A9

A9(run validations)-->A10
A10(confirm package create):::prompt-->A11
A11{Init package?}
A11 -->|Yes| A12(add seed image)-->A13
A11 -->|No| A13

subgraph ""
A13(add each component)-->A13
A13 --> A14(run each '.actions.onCreate.before'):::action-->A14
A14 --> A15(load '.charts')-->A16
A16(load '.files')-->A17
A17(load '.dataInjections')-->A18
A18(load '.manifests')-->A19
A19(load '.repos')-->A20
A20(run each '.actions.onCreate.after'):::action-->A20
A20-->A21{Success?}
A21-->|Yes|A22(run each\n'.actions.onCreate.success'):::action-->A22
A21-->|No|A23(run each\n'.actions.onCreate.failure'):::action-->A23-->A999
end

A22-->A24(load all '.images')
A24-->A25{Skip SBOM?}
A25-->|Yes|A27
A25-->|No|A26
A26(generate SBOM)-->A27
A27(reset working directory)-->A28
A28(create package archive)-->A29
A29{Is multipart?}
A29-->|Yes|A30(split package archive)-->A31
A29-->|No|A31
A31(handle sbom view/out flags)

A999[Abort]:::fail

classDef prompt fill:#4adede,color:#000000
classDef action fill:#bd93f9,color:#000000
classDef fail fill:#aa0000
`}/>
</Details>

## Package creation

To create a package run `zarf package create` in a directory with a zarf.yaml

### Package Templates
Templates are used during `zarf package create` to template the `zarf.yaml` file. Templates are baked into the Zarf package meaning they cannot be changed post create.

:::caution

`zarf package create` templates only template `###ZARF_PKG_TMPL_*###` entries the `zarf.yaml` file while `zarf package deploy` only templates other `manifests`, `charts`, `files`, and `actions`. To learn more about using deployment values see the [Deployment Values](/ref/values) page.

:::

You can also specify `zarf.yaml` package configuration templates at package create time by including `###_ZARF_PKG_TMPL_*###` as the value for any string-type data in your package definition. These values are discovered during `zarf package create` and will always be prompted for if not using `--confirm` or `--set`. An example of this is below:
You can specify `zarf.yaml` package configuration templates at package create time by including `###_ZARF_PKG_TMPL_*###` as the value for any string-type data in your package definition. These values are discovered during `zarf package create` and will always be prompted for if not using `--confirm` or not already set. Templates be set using [config files](/ref/config-files/) or the `--set` flag. An example of a package using templates is below:

```yaml
kind: ZarfPackageConfig
Expand Down
57 changes: 57 additions & 0 deletions site/src/content/docs/ref/packages.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ sidebar:
order: 20
---

import Mermaid from "@components/Mermaid.astro";
import Details from "@components/Details.astro";

Zarf offers a comprehensive solution for deploying system software or capabilities while fully disconnected. This is accomplished through the use of a single tarball archive, which includes all necessary components and is defined by a `zarf.yaml` file.

Zarf packages are created while you are connected to internet or intranet resources defined in a Zarf package configuration. This allows these resources to be pulled and stored within a package archive and be deployed on disconnected systems without requiring a connection to the outside world.
Expand Down Expand Up @@ -81,3 +84,57 @@ In addition to the traditional sources outlined above, there is also a special "
Additionally, inspecting a package deployed to a cluster will not be able to show the package's SBOMs, as they are not currently persisted to the cluster.

:::

The following diagram shows the order of operations for the `zarf package create` command and the hook locations for [actions](/ref/actions).

<Details label="Lifecycle Diagram">
<Mermaid diagram={`
graph TD
A1(set working directory)-->A2
A2(parse zarf.yaml)-->A3
A3(filter components by architecture)-->A4
A4(detect init package)-->A5
A5(handle deprecations)-->A6
A6(parse component imports)-->A7
A7(process create-time variables)-->A8
A8(write build data and zarf.yaml)-->A9

A9(run validations)-->A10
A10(confirm package create):::prompt-->A11
A11{Init package?}
A11 -->|Yes| A12(add seed image)-->A13
A11 -->|No| A13

subgraph ""
A13(add each component)-->A13
A13 --> A14(run each '.actions.onCreate.before'):::action-->A14
A14 --> A15(load '.charts')-->A16
A16(load '.files')-->A17
A17(load '.dataInjections')-->A18
A18(load '.manifests')-->A19
A19(load '.repos')-->A20
A20(run each '.actions.onCreate.after'):::action-->A20
A20-->A21{Success?}
A21-->|Yes|A22(run each\n'.actions.onCreate.success'):::action-->A22
A21-->|No|A23(run each\n'.actions.onCreate.failure'):::action-->A23-->A999
end

A22-->A24(load all '.images')
A24-->A25{Skip SBOM?}
A25-->|Yes|A27
A25-->|No|A26
A26(generate SBOM)-->A27
A27(reset working directory)-->A28
A28(create package archive)-->A29
A29{Is multipart?}
A29-->|Yes|A30(split package archive)-->A31
A29-->|No|A31
A31(handle sbom view/out flags)

A999[Abort]:::fail

classDef prompt fill:#4adede,color:#000000
classDef action fill:#bd93f9,color:#000000
classDef fail fill:#aa0000
`}/>
</Details>
Loading