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

feat: uds dev deploy beta note, packages flag, skip sbom #557

Merged
merged 2 commits into from
Apr 8, 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
2 changes: 1 addition & 1 deletion adr/0004-tui.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 3. Terminal User Interface (TUI)
# 4. Terminal User Interface (TUI)

Date: 22 March 2024

Expand Down
25 changes: 25 additions & 0 deletions adr/0005-dev-mode.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# 5. Dev Mode

Date: 05 April 2024

## Status
In Progress

## Context

Zarf currently has a dev command that helps speed up the zarf package development cycle, we want to provide similar capabilities to help speed up the UDS bundle development cycle.

The current bundle development lifecycle is:

1. Create a local zarf package or reference a remote zarf package
2. Create a `bundle.yaml` and add packages
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
2. Create a `bundle.yaml` and add packages
2. Create a `uds-bundle.yaml` and add packages

3. Create a bundle with `uds create <dir>`
4. Start up a cluster if one does not already exist
5. Run `uds zarf init` to initialize th cluster
6. Deploy the bundle with `uds deploy BUNDLE_TARBALL|OCI_REF]`

## Decision
Introduce `uds dev deploy` which allows you to deploy a UDS bundle in dev mode. If a local zarf package is missing, this command will create that zarf package for you assuming that your `zarf.yaml` file and zarf package are expected in the same directory. It will then create your bundle and deploy your zarf packages in [YOLO](https://docs.zarf.dev/docs/faq#what-is-yolo-mode-and-why-would-i-use-it) mode, eliminating the need to do a `uds zarf init`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add a note about being in-memory vs creating local artifacts (both bundle and Zarf artifacts)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, are there any limitations for local vs remote packages?


## Consequences
Commands under `dev` are meant to be used in **development** environments, and are **not** meant to be used in **production** environments. There is still the possibility that a user will use `uds dev deploy` in a production environment, but the command name and documentation will make it clear that this is not the intended use case.
3 changes: 3 additions & 0 deletions src/cmd/dev.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ var devDeployCmd = &cobra.Command{
Use: "deploy",
Args: cobra.MaximumNArgs(1),
Short: lang.CmdDevDeployShort,
Long: lang.CmdDevDeployLong,
PreRun: func(_ *cobra.Command, args []string) {
setBundleFile(args)
},
Expand All @@ -44,6 +45,7 @@ var devDeployCmd = &cobra.Command{

config.CommonOptions.Confirm = true
bundleCfg.CreateOpts.SourceDirectory = srcDir

configureZarf()

// load uds-config if it exists
Expand Down Expand Up @@ -78,4 +80,5 @@ func init() {
initViper()
rootCmd.AddCommand(devCmd)
devCmd.AddCommand(devDeployCmd)
devDeployCmd.Flags().StringArrayVarP(&bundleCfg.DeployOpts.Packages, "packages", "p", []string{}, lang.CmdBundleDeployFlagPackages)
}
3 changes: 2 additions & 1 deletion src/config/lang/lang.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,5 +83,6 @@ const (

// uds dev
CmdDevShort = "Commands useful for developing bundles"
CmdDevDeployShort = "Creates and deploys a dev UDS bundle from a given directory"
CmdDevDeployShort = "[beta] Creates and deploys a UDS bundle from a given directory in dev mode"
CmdDevDeployLong = "[beta] Creates and deploys a UDS bundle from a given directory in dev mode, setting package options like YOLO mode for faster iteration."
)
2 changes: 1 addition & 1 deletion src/pkg/bundle/dev.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func (b *Bundle) CreateZarfPkgs() {
}
// create local zarf package if it doesn't exist
if !packageFound {
os.Args = []string{"zarf", "package", "create", path, "--confirm", "-o", path}
os.Args = []string{"zarf", "package", "create", path, "--confirm", "-o", path, "--skip-sbom"}
zarfCLI.Execute()
if err != nil {
message.Fatalf(err, "Failed to create package %s: %s", pkg.Name, err.Error())
Expand Down
9 changes: 8 additions & 1 deletion src/test/e2e/commands_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,14 @@ func deployWithTUI(t *testing.T, source string) (stdout string, stderr string) {
}

func devDeploy(t *testing.T, tarballPath string) (stdout string, stderr string) {
cmd := strings.Split(fmt.Sprintf("dev deploy %s --no-tea", tarballPath), " ")
cmd := strings.Split(fmt.Sprintf("dev deploy %s", tarballPath), " ")
stdout, stderr, err := e2e.UDS(cmd...)
require.NoError(t, err)
return stdout, stderr
}

func devDeployPackages(t *testing.T, tarballPath string, packages string) (stdout string, stderr string) {
cmd := strings.Split(fmt.Sprintf("dev deploy %s --packages %s", tarballPath, packages), " ")
stdout, stderr, err := e2e.UDS(cmd...)
require.NoError(t, err)
return stdout, stderr
Expand Down
4 changes: 2 additions & 2 deletions src/test/e2e/dev_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ func TestDevDeploy(t *testing.T) {
bundleDir := "src/test/bundles/03-local-and-remote"
bundlePath := filepath.Join(bundleDir, fmt.Sprintf("uds-bundle-test-local-and-remote-%s-0.0.1.tar.zst", e2e.Arch))

devDeploy(t, bundleDir)
devDeployPackages(t, bundleDir, "podinfo")

deployments, _, _ := e2e.UDS(cmd...)
require.Contains(t, deployments, "podinfo")
require.Contains(t, deployments, "nginx")
require.NotContains(t, deployments, "nginx")

remove(t, bundlePath)
})
Expand Down
Loading