Skip to content

Commit

Permalink
Remove the max package creation screen and improve docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Racer159 committed Oct 13, 2023
1 parent 87d2f65 commit 8b68d21
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 103 deletions.
55 changes: 0 additions & 55 deletions docs-website/static/docs/tutorials/package_create_size.html

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ zarf package create [ DIRECTORY ] [flags]
-h, --help help for create
-k, --key string Path to private key file for signing packages
--key-pass string Password to the private key file used for signing packages
-m, --max-package-size int Specify the maximum size of the package in megabytes, packages larger than this will be split into multiple parts. Use 0 to disable splitting.
-m, --max-package-size int Specify the maximum size of the package in megabytes, packages larger than this will be split into multiple parts to be loaded onto smaller media (i.e. DVDs). Use 0 to disable splitting.
-o, --output string Specify the output (either a directory or an oci:// URL) for the created Zarf package
--registry-override stringToString Specify a map of domains to override on package create when pulling images (e.g. --registry-override docker.io=dockerio-reg.enterprise.intranet) (default [])
-s, --sbom View SBOM contents after creating the package
Expand Down
27 changes: 20 additions & 7 deletions docs/4-deploy-a-zarf-package/2-package-sources.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,24 @@
# Package Sources

Zarf currently supports consuming the following package sources:
Zarf currently supports consuming packages from the following sources:

- Local Tarball Path (`.tar` and `.tar.zst`) - The default output on `zarf package create`
- Split Tarball Path (`.part...`) - Optionally created by specifying `--max-package-size`
- Remote Tarball URL (`http://` and `https://` ) - A package tarball hosted on a web server
- Remote OCI Reference (`oci://`) - A package published to an OCI compatible registry
### Local Tarball Path (`.tar` and `.tar.zst`)

A local tarball is the default output of `zarf package create` and is a package contained within a tarball with or without [Zstandard](https://facebook.github.io/zstd/) compression. Compression is determined by a given package's [`metadata.uncompressed` key](https://docs.zarf.dev/docs/create-a-zarf-package/zarf-schema#metadata) within it's `zarf.yaml` package definition

### Split Tarball Path (`.part...`)

A split tarball is a local tarball that has been split into multiple parts so that it can fit on smaller media when traveling to a disconnected environment (i.e. on DVDs). These packages are created by specifying a maximum number of megabytes with [`--max-package-size`](../2-the-zarf-cli/100-cli-commands/zarf_package_create.md) on `zarf package create` and if the resulting tarball is larger than that size it will be split into chunks.

### Remote Tarball URL (`http://` and `https://` )

A remote tarball is a Zarf package tarball that is hosted on a web server that is accessible to the current machine. By default Zarf does not provide a mechanism to place a package on a web server, but this is easy to orchestrate with other tooling such as uploading a package to a continuous integration system's artifact storage or to a repository's release page.

### Remote OCI Reference (`oci://`)

An OCI package is one that has been published to an OCI compatible registry using `zarf package publish` or the `-o` option on `zarf package create`. These packages live within a given registry and you can learn more about them in our [Publish & Deploy Packages w/OCI Tutorial](../5-zarf-tutorials/7-publish-and-deploy.md).

## Commands with Sources

A source can be used with the following commands as their first argument:

Expand All @@ -18,11 +31,11 @@ A source can be used with the following commands as their first argument:

:::note

In addition to the traditional sources, there is also a special Cluster source available on `inspect` and `remove` that allows for referencing a package via its name:
In addition to the traditional sources outlined above, there is also a special "Cluster" source available on `inspect` and `remove` that allows for referencing a deployed package via its name:

- `zarf package inspect <package name>`
- `zarf package remove <package name>`

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.
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.

:::
8 changes: 2 additions & 6 deletions docs/5-zarf-tutorials/0-creating-a-zarf-package.md
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ To add this to our `zarf.yaml` we can simply specify it under our `wordpress` co

Once you have followed the above you should now have a `zarf.yaml` file that matches the one found on the [WordPress example page](../../examples/wordpress/README.md).

Creating this package is as simple as running the `zarf package create` command with the directory containing our `zarf.yaml`. Zarf will show us the `zarf.yaml` one last time asking if we would like to build the package, and will ask us for a maximum package size (useful if you need to split a package across multiple [Compact Discs](https://en.wikipedia.org/wiki/Compact_disc)). Upon confirmation Zarf will pull down all of the resources and bundle them into a package tarball.
Creating this package is as simple as running the `zarf package create` command with the directory containing our `zarf.yaml`. Zarf will show us the `zarf.yaml` one last time asking if we would like to build the package, and upon confirmation Zarf will pull down all of the resources and bundle them into a package tarball.

```bash
zarf package create .
Expand All @@ -246,15 +246,11 @@ You can skip this confirmation by adding the `--confirm` flag when running the c

:::

After you confirm package creation, you have the option to specify a maximum file size for the package. To disable this feature, enter `0`.

<iframe src="/docs/tutorials/package_create_size.html" height="100px" width="100%"></iframe>

This will create a zarf package in the current directory with a package name that looks something like `zarf-package-wordpress-amd64-16.0.4.tar.zst`, although it might be slightly different depending on your system architecture.

:::tip

You can learn more about what is going on behind the scenes of this process on the [package create lifecycle page](../3-create-a-zarf-package/5-package-create-lifecycle.md), and can view other useful command flags like `--differential` and `--registry-override` on the [package create command flags page](../2-the-zarf-cli/100-cli-commands/zarf_package_create.md).
You can learn more about what is going on behind the scenes of this process on the [package create lifecycle page](../3-create-a-zarf-package/5-package-create-lifecycle.md), and can view other useful command flags like `--max-package-size`, `--differential` and `--registry-override` on the [package create command flags page](../2-the-zarf-cli/100-cli-commands/zarf_package_create.md).

:::

Expand Down
6 changes: 1 addition & 5 deletions docs/5-zarf-tutorials/8-custom-init-packages.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,7 @@ You can skip this confirmation by adding the `--confirm` flag when running the c

:::

After you confirm package creation, you have the option to specify a maximum file size for the package. To disable this feature, enter `0`.

<iframe src="/docs/tutorials/package_create_size.html" height="100px" width="100%"></iframe>

Once you enter your response for the package size, Zarf will create the Zarf 'init' package in the current directory. In this case, the package name should look something like `zarf-init-amd64-vX.X.X.tar.zst`, although it might differ slightly depending on your system architecture.
After you confirm package creation, Zarf will create the Zarf 'init' package in the current directory. In this case, the package name should look something like `zarf-init-amd64-vX.X.X.tar.zst`, although it might differ slightly depending on your system architecture.

## Customizing the 'init' Package

Expand Down
2 changes: 1 addition & 1 deletion src/config/lang/english.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ const (
CmdPackageCreateFlagSbom = "View SBOM contents after creating the package"
CmdPackageCreateFlagSbomOut = "Specify an output directory for the SBOMs from the created Zarf package"
CmdPackageCreateFlagSkipSbom = "Skip generating SBOM for this package"
CmdPackageCreateFlagMaxPackageSize = "Specify the maximum size of the package in megabytes, packages larger than this will be split into multiple parts. Use 0 to disable splitting."
CmdPackageCreateFlagMaxPackageSize = "Specify the maximum size of the package in megabytes, packages larger than this will be split into multiple parts to be loaded onto smaller media (i.e. DVDs). Use 0 to disable splitting."
CmdPackageCreateFlagSigningKey = "Path to private key file for signing packages"
CmdPackageCreateFlagSigningKeyPassword = "Password to the private key file used for signing packages"
CmdPackageCreateFlagDifferential = "[beta] Build a package that only contains the differential changes from local resources and differing remote resources from the specified previously built package"
Expand Down
26 changes: 0 additions & 26 deletions src/pkg/packager/interactive.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,13 @@ import (
"fmt"
"os"
"path/filepath"
"strconv"

"github.com/AlecAivazis/survey/v2"
"github.com/defenseunicorns/zarf/src/config"
"github.com/defenseunicorns/zarf/src/internal/packager/sbom"
"github.com/defenseunicorns/zarf/src/pkg/interactive"
"github.com/defenseunicorns/zarf/src/pkg/layout"
"github.com/defenseunicorns/zarf/src/pkg/message"
"github.com/defenseunicorns/zarf/src/pkg/utils"
"github.com/defenseunicorns/zarf/src/types"
"github.com/pterm/pterm"
)

Expand Down Expand Up @@ -86,29 +83,6 @@ func (p *Packager) confirmAction(stage string) (confirm bool) {
return false
}

// On create in interactive mode, prompt for max package size if it is still the default value of 0
// Note: it will not be 0 if the user has provided a value via the --max-package-size flag or Viper config
if stage == config.ZarfCreateStage && p.cfg.CreateOpts.MaxPackageSizeMB == 0 {
value, err := interactive.PromptVariable(types.ZarfPackageVariable{
Name: "Maximum Package Size",
Description: "Specify a maximum file size for this package in Megabytes. Above this size, the package will be split into multiple files. 0 will disable this feature.",
Default: "0",
})
if err != nil {
// User aborted, cancel the action
return false
}

// Try to parse the value, on error warn and move on
maxPackageSize, err := strconv.Atoi(value)
if err != nil {
message.Warnf("Unable to parse \"%s\" as a number for the maximum file size. This package will not be split into multiple files.", value)
return true
}

p.cfg.CreateOpts.MaxPackageSizeMB = maxPackageSize
}

return true
}

Expand Down
2 changes: 1 addition & 1 deletion src/test/e2e/30_config_file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ func configFileDefaultTests(t *testing.T) {
"create.output: 52d061d5",
"Skip generating SBOM for this package (default true)",
"[thing1=1a2b3c4d]",
"Specify the maximum size of the package in megabytes, packages larger than this will be split into multiple parts. Use 0 to disable splitting. (default 42)",
"Specify the maximum size of the package in megabytes, packages larger than this will be split into multiple parts to be loaded onto smaller media (i.e. DVDs). Use 0 to disable splitting. (default 42)",
}

packageDeployFlags := []string{
Expand Down
2 changes: 1 addition & 1 deletion src/test/packages/05-multi-part/zarf.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
kind: ZarfPackageConfig
metadata:
name: multi-part
description: Example to demonstrate how to create multi-part zarf packages. By default, packages will not be split into multiple parts. To produce a multi-part package, use the command "zarf package create --max-package-size=1"
description: Example to demonstrate how to create multi-part zarf packages. By default, packages will not be split into multiple parts to be loaded onto smaller media (i.e. DVDs). To produce a multi-part package, use the command "zarf package create --max-package-size=1"

components:
- name: big-ol-file
Expand Down

0 comments on commit 8b68d21

Please sign in to comment.