From 506b239bde900c794c25f7fde83171bffb48c72b Mon Sep 17 00:00:00 2001 From: Clint Date: Thu, 7 Nov 2024 07:26:06 -0600 Subject: [PATCH] chore: remove uds-runtime (ui) (#1010) Signed-off-by: catsby --- .github/workflows/release.yaml | 3 - .github/workflows/test-schema-and-docs.yaml | 3 - .github/workflows/test-unit.yaml | 3 - CONTRIBUTING.md | 2 - design-docs/0001-bundle-state.md | 136 -------------------- design-docs/0002-uds-ui.md | 29 ----- docs/reference/CLI/commands/uds.md | 1 - docs/reference/CLI/commands/uds_ui.md | 40 ------ docs/reference/CLI/quickstart-and-usage.md | 6 - go.mod | 7 - go.sum | 16 --- hack/download-uds-runtime-assets.sh | 67 ---------- renovate.json | 8 -- src/cmd/ui.go | 35 ----- src/cmd/vendored.go | 16 --- src/config/lang/lang.go | 3 - src/test/e2e/ui_test.go | 62 --------- tasks.yaml | 4 - tasks/tests.yaml | 4 +- 19 files changed, 2 insertions(+), 443 deletions(-) delete mode 100644 design-docs/0001-bundle-state.md delete mode 100644 design-docs/0002-uds-ui.md delete mode 100644 docs/reference/CLI/commands/uds_ui.md delete mode 100755 hack/download-uds-runtime-assets.sh delete mode 100644 src/cmd/ui.go delete mode 100644 src/test/e2e/ui_test.go diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 8057d8873..3d7c373c0 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -53,9 +53,6 @@ jobs: owner: defenseunicorns repositories: homebrew-tap - - name: Download Runtime assets for embedding - run: ./hack/download-uds-runtime-assets.sh - - name: Run GoReleaser uses: goreleaser/goreleaser-action@286f3b13b1b49da4ac219696163fb8c1c93e1200 # v6.0.0 with: diff --git a/.github/workflows/test-schema-and-docs.yaml b/.github/workflows/test-schema-and-docs.yaml index 58a1a549e..e5122318b 100644 --- a/.github/workflows/test-schema-and-docs.yaml +++ b/.github/workflows/test-schema-and-docs.yaml @@ -21,9 +21,6 @@ jobs: - name: Install UDS CLI uses: ./.github/actions/install-uds-cli - - name: Pull UDS Runtime Assets - run: ./hack/download-uds-runtime-assets.sh - - name: Test schemas run: uds run schema:test diff --git a/.github/workflows/test-unit.yaml b/.github/workflows/test-unit.yaml index 064b8de2f..adabb6d00 100644 --- a/.github/workflows/test-unit.yaml +++ b/.github/workflows/test-unit.yaml @@ -36,9 +36,6 @@ jobs: - name: Install UDS CLI uses: ./.github/actions/install-uds-cli - - name: Pull UDS Runtime Assets - run: ./hack/download-uds-runtime-assets.sh - - name: Run unit tests run: uds run test:unit diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b235a146a..b3fff92ca 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -62,8 +62,6 @@ We strive to test all changes made to UDS CLI. If you're adding a new feature or #### Unit Tests Unit tests reside alongside the source code in a `*_test.go` file. These tests should be used to test individual functions or methods in isolation. Unit tests should be fast and focused on a single piece of functionality. -In order to run the unit tests in `src/cmd`, you must ensure that you have pulled the UDS Runtime binary into the `src/cmd/bin` dir. This can be done by running the `./hack/update-uds-runtime-binaries.sh` script or by running the build task for your os/architectecture (eg. `uds run build-cli-mac-apple`). - #### E2E Tests E2E tests reside in the `src/test/e2e` directory. They use bundles located in the `src/test/e2e/bundles` which contain Zarf packages from the `src/test/e2e/packages` directory. Feel free to add new bundles and packages where appropriate. It's encouraged to write comments/metadata in any new bundles or packages to explain what they are testing. diff --git a/design-docs/0001-bundle-state.md b/design-docs/0001-bundle-state.md deleted file mode 100644 index c56a49e0c..000000000 --- a/design-docs/0001-bundle-state.md +++ /dev/null @@ -1,136 +0,0 @@ -# Bundle State - -### Update September 24th, 2024 - -After initial rollout we decided to remove state due to unforeseen issues. For -posterity this document is left intact, but the state feature described has been -removed. We will very likely revisit the idea in the future. - ------- - -## Context - -The following 2 issues provide context driving the need for a UDS state tracking mechanism: - -#### 1. What's in my cluster? - -UDS CLI users have requested the ability to see the state of their bundles that are currently deployed in K8s cluster. This information is useful to know before applying upgrades, troubleshooting, removing bundles, etc. Currently, Zarf provides a `package list` command that lists all the packages in the cluster and users would like similar functionality for bundles. - -#### 2. Unreferenced Zarf Packages - -Today it's possible for packages that have been removed from a `uds-bundle.yaml` but previously deployed in the cluster to become unreferenced. For example, an engineer has created a UDS bundle consisting of 3 packages and deployed this bundle to a mission environment. Later, the engineer decides one of those packages is no longer needed, so they remove it from the bundle and deploy the bundle again. The package that was removed from the bundle is still present in the cluster and is now unreferenced, and the engineer must manually remove it. - -## UDS State - -In order to address the above issues, the team has decided to implement a state tracking mechanism that will store metadata about a bundle that has been deployed to the cluster. - -#### Design Principles - -- Keep state as simple as possible. Meaning that we should think of state as a record of an event, as opposed to a complex object that drives CLI behavior. -- No destructive action should be taken based on UDS state unless the user explicitly requests it. -- State should be backwards compatible and should not interfere with existing UDS CLI functionality. - - For now, do not base any UDS CLI business logic on UDS state - - On backwards compatibility: if a user attempts an action that is based on state but state does not exist, CLI should fail quickly and indicate to the user that state does not exist and provide instructions on how to create it (likely simply re-deploying the bundle) - -## State Storage - -The following options were considered for storing UDS state: - -- K8s Secrets - - Pros: limits access by namespace; Helm and Zarf's proven implementation - - Cons: hacking a secret resource for something isn't technically a secret -- K8s ConfigMaps - - Pros: Easy to use - - Cons: Not as secure as secrets (any namespace can access) -- K8s Custom Resources - - Pros: Custom resource designed to store bundle information - - Cons: Heavy-handed approach; we don't want to secret data to be easily manipulated by users - -### Decision - -We will use K8s Secrets to store UDS state. This decision was made because it is the most secure option and aligns with the way Helm and Zarf store state information. - -## State Contents and Location - -Each UDS bundle deployed in the cluster will have its own state secret. The state secret will take the following form: - -```go -type PkgStatus struct { - Name string `json:"name"` - Version string `json:"version"` - Status string `json:"status"` - DateUpdated time.Time `json:"date_updated"` -} - -type BundleState struct { - Name string `json:"name"` - Version string `json:"version"` - PkgStatuses []PkgStatus `json:"packages"` - Status string `json:"status"` - DateUpdated time.Time `json:"date_updated"` -} -``` - -Note that the `BundleState.DateUpdated` field refers to the last time the bundle itself or any of the bundled packages were updated. The `BundleState` struct will be stored in the secret's `data` field as a base64 encoded JSON string. - -#### Namespace - -The UDS state secret will be stored in the `uds` namespace. If the `uds` namespace doesn't exist, the CLI will create it. - -### Viewing State -For now, we will not introduce a dedicated UDS CLI command for users to view state. To view state, users can either used the vendored tools (`kubectl` and/or `k9s`) or view the state in UDS Runtime. - -## State Implementation - -Generally speaking, UDS CLI will update a bundle's state during deploy and remove operations. The bundle state will serve as a record of the bundle's deployment status and the status of each package in the bundle. - -### Behaviors - -- Bundle states will track the packages in the bundle and their statuses, if a package has been removed in future versions of a bundle, CLI will provide a mechanism to prune the cluster and state. -- The state secret will be created during the first deployment of a bundle. If the bundle is deployed again, the state secret will be updated. -- The state secret will be deleted when a bundle is removed. -- If using the `--packages` flag, the CLI will only update the state for the specified packages, but the bundle secret will indicate that a package in the bundle hasn't been deployed, or in the case of removal, that a package has been removed. - -### API Design -UDS CLI will provide a bundle state API in the form of a Go pkg called `github.com/defenseunicorns/uds-cli/src/pkg/state`. This package will provide an API for creating and interacting with state during the bundle lifecycle. Proposed public methods include: - -- `NewClient`: creates a new state client -- `InitBundleState`: creates the `uds` namespace if it doesn't exist; creates a new state secret or returns an existing state secret for a previously deployed bundle -- `GetBundleState`: retrieves the state for a given bundle -- `GetBundlePkgState`: retrieves the state for a given package inside a bundle -- `UpdateBundleState`: updates the state for a given bundle -- `UpdateBundlePkgState`: updates the state for a given package inside a bundle -- `RemoveBundleState`: deletes the state for a given bundle; note that this will remove the K8s secret containing the state - -### Statuses - -`BundleState` and corresponding `PkgStatus` will be limited to the following statuses: - -```go - Success = "success" // deployed successfully - Failed = "failed" // failed to deploy - Deploying = "deploying" // deployment in progress - NotDeployed = "not_deployed" // package is in the bundle but not deployed - Removing = "removing" // removal in progress - Removed = "removed" // package removed (does not apply to BundleState) - FailedRemove = "failed_remove" // package failed to be removed (does not apply to BundleState) - Unreferenced = "Unreferenced" // package has been removed from the bundle but still exists in the cluster -``` - -We will intentionally keep the list of statuses small to reduce the need for more complex state management. - -### Pruning - -If a package is removed from a bundle, the CLI will provide a mechanism to prune the cluster of unreferenced packages and update state. The general algorithm for pruning is as follows: - -1. An engineer deploys a bundle containing package `foo` and package `bar` -1. UDS state is updated to reflect the bundle and its 2 packages have deployed successfully -1. Later, the engineer decides they no longer need package `bar` and removes it from their `uds-bundle.yaml` -1. Upon the next deployment, the CLI will update the state to reflect that package `bar` is no longer in the bundle and will mark it as `Unreferenced` - -#### Pruning Mechanisms - -There are 2 mechanisms for removing `Unreferenced` packages from the cluster. Using the example above: -1. If the engineer runs `uds deploy ... --prune` then the CLI will remove package `bar` from the cluster and update the state to reflect that package `bar` has been removed, by removing `bar` from the bundle's state -1. If the engineer runs `uds prune ` then the user will be shown a list of unreferenced packages and asked to confirm removal. The CLI will then remove the unreferenced packages from the cluster and update the state to reflect that the packages have been removed. - - `uds prune` will also have a flag `--confirm` to automatically remove unreferenced packages without user confirmation diff --git a/design-docs/0002-uds-ui.md b/design-docs/0002-uds-ui.md deleted file mode 100644 index 771987a4d..000000000 --- a/design-docs/0002-uds-ui.md +++ /dev/null @@ -1,29 +0,0 @@ -# UDS UI - -Author(s): @decleaver -Date Created: Sept 9, 2024 -Status: IMPLEMENTED -Ticket: https://github.com/defenseunicorns/uds-cli/issues/870 - -### Problem Statement - -The goal of the `uds ui` command is to allow uds-cli users to launch the UDS Runtime application from the command line. - -### Proposal - -Bundle the UDS Runtime binaries as a part of uds-cli allowing users to launch UDS Runtime from the command line. - -### Scope and Requirements - -Allow users to launch UDS Runtime locally from uds-cli. When running UDS Runtime locally, API token authentication is required. This is implemented programmatically and is transparent to the user. - -### Implementation Details - -To execute UDS Runtime from uds-cli, the appropriate runtime binary is pulled into the `src/cmd/bin` directory during the uds-cli build process. This is based on the specific build task being run (e.g., `build-cli-linux-arm`). The runtime binary is then packaged with the uds-cli binary. - -To ensure the `uds ui` command works correctly, the uds-cli must be built using the build tasks specified in `tasks.yaml`. If not, the runtime binary might be missing, causing the `uds ui` command to fail. - -### Alternatives Considered - -1. Save runtime binaries directly in the uds-cli repo to avoid having to pull at build time. This approach was discarded because it adds extra size and complexity to the uds-cli repo -2. Vendor UDS Runtime in uds-cli. This approach was discarded because although the Runtime backend can be vendored, it required static assets from the frontend which would need to be embedded in the uds-cli binary, thus negating the benefits of vendoring. diff --git a/docs/reference/CLI/commands/uds.md b/docs/reference/CLI/commands/uds.md index 5ec7909f0..58f9fbedd 100644 --- a/docs/reference/CLI/commands/uds.md +++ b/docs/reference/CLI/commands/uds.md @@ -38,6 +38,5 @@ uds COMMAND [flags] * [uds pull](/reference/cli/commands/uds_pull/) - Pull a bundle from a remote registry and save to the local file system * [uds remove](/reference/cli/commands/uds_remove/) - Remove a bundle that has been deployed already * [uds run](/reference/cli/commands/uds_run/) - Run a task using maru-runner -* [uds ui](/reference/cli/commands/uds_ui/) - [beta] Launch UDS Runtime and view UI * [uds version](/reference/cli/commands/uds_version/) - Shows the version of the running UDS-CLI binary diff --git a/docs/reference/CLI/commands/uds_ui.md b/docs/reference/CLI/commands/uds_ui.md deleted file mode 100644 index eaf0f0ac9..000000000 --- a/docs/reference/CLI/commands/uds_ui.md +++ /dev/null @@ -1,40 +0,0 @@ ---- -title: uds ui -description: UDS CLI command reference for uds ui. ---- -## uds ui - -[beta] Launch UDS Runtime and view UI - -### Synopsis - -[beta] Launch UDS Runtime and view UI - -``` -uds ui [flags] -``` - -### Options - -``` - -h, --help help for ui -``` - -### Options inherited from parent commands - -``` - -a, --architecture string Architecture for UDS bundles and Zarf packages - --insecure Allow access to insecure registries and disable other recommended security enforcements such as package checksum and signature validation. This flag should only be used if you have a specific reason and accept the reduced security posture. - -l, --log-level string Log level when running UDS-CLI. Valid options are: warn, info, debug, trace (default "info") - --no-color Disable color output - --no-log-file Disable log file creation - --no-progress Disable fancy UI progress bars, spinners, logos, etc - --oci-concurrency int Number of concurrent layer operations to perform when interacting with a remote bundle. (default 3) - --tmpdir string Specify the temporary directory to use for intermediate files - --uds-cache string Specify the location of the UDS cache directory (default "~/.uds-cache") -``` - -### SEE ALSO - -* [uds](/reference/cli/commands/uds/) - CLI for UDS Bundles - diff --git a/docs/reference/CLI/quickstart-and-usage.md b/docs/reference/CLI/quickstart-and-usage.md index 2c34a1c19..058fe47b3 100644 --- a/docs/reference/CLI/quickstart-and-usage.md +++ b/docs/reference/CLI/quickstart-and-usage.md @@ -497,9 +497,3 @@ uds scan --org --package-name --tag [options ```sh uds scan -o defenseunicorns -n packages/uds/gitlab-runner -g 16.10.0-uds.0-upstream -u docker-username -p docker-password -f gitlab-runner.csv ``` - -## UDS Runtime - -The `uds ui` command launches UDS Runtime, which provides a web-based user interface to view what is running in your K8s cluster. More information regarding UDS Runtime can be found [here](https://github.com/defenseunicorns/uds-runtime). - -To exit UDS Runtime, press `Ctrl+C`. diff --git a/go.mod b/go.mod index 31f0c9cb5..638afe101 100644 --- a/go.mod +++ b/go.mod @@ -10,7 +10,6 @@ require ( github.com/defenseunicorns/pkg/exec v0.0.1 github.com/defenseunicorns/pkg/helpers/v2 v2.0.1 github.com/defenseunicorns/pkg/oci v1.0.2 - github.com/defenseunicorns/uds-runtime v0.8.0 github.com/defenseunicorns/uds-security-hub v0.0.7 github.com/fsnotify/fsnotify v1.8.0 github.com/goccy/go-yaml v1.13.6 @@ -70,7 +69,6 @@ require ( github.com/BurntSushi/toml v1.4.0 // indirect github.com/CycloneDX/cyclonedx-go v0.9.1 // indirect github.com/DataDog/zstd v1.5.5 // indirect - github.com/KyleBanks/depth v1.2.1 // indirect github.com/MakeNowJust/heredoc v1.0.0 // indirect github.com/Masterminds/goutils v1.1.1 // indirect github.com/Masterminds/semver v1.5.0 // indirect @@ -233,7 +231,6 @@ require ( github.com/glebarez/go-sqlite v1.21.2 // indirect github.com/glebarez/sqlite v1.11.0 // indirect github.com/go-chi/chi v4.1.2+incompatible // indirect - github.com/go-chi/chi/v5 v5.1.0 // indirect github.com/go-errors/errors v1.4.2 // indirect github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect github.com/go-git/go-billy/v5 v5.5.0 // indirect @@ -451,9 +448,6 @@ require ( github.com/spiffe/go-spiffe/v2 v2.3.0 // indirect github.com/stretchr/objx v0.5.2 // indirect github.com/subosito/gotenv v1.6.0 // indirect - github.com/swaggo/files/v2 v2.0.1 // indirect - github.com/swaggo/http-swagger/v2 v2.0.2 // indirect - github.com/swaggo/swag v1.16.4 // indirect github.com/sylabs/sif/v2 v2.17.1 // indirect github.com/sylabs/squashfs v1.0.0 // indirect github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect @@ -507,7 +501,6 @@ require ( golang.org/x/term v0.25.0 // indirect golang.org/x/text v0.19.0 // indirect golang.org/x/time v0.6.0 // indirect - golang.org/x/tools v0.26.0 // indirect golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect google.golang.org/api v0.196.0 // indirect google.golang.org/genproto v0.0.0-20240903143218-8af14fe29dc1 // indirect diff --git a/go.sum b/go.sum index c09d3e250..d7e2f9a13 100644 --- a/go.sum +++ b/go.sum @@ -270,8 +270,6 @@ github.com/DATA-DOG/go-sqlmock v1.5.2/go.mod h1:88MAG/4G7SMwSE3CeA0ZKzrT5CiOU3OJ github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= github.com/DataDog/zstd v1.5.5 h1:oWf5W7GtOLgp6bciQYDmhHHjdhYkALu6S/5Ni9ZgSvQ= github.com/DataDog/zstd v1.5.5/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= -github.com/KyleBanks/depth v1.2.1 h1:5h8fQADFrWtarTdtDudMmGsC7GPbOAu6RVB3ffsVFHc= -github.com/KyleBanks/depth v1.2.1/go.mod h1:jzSb9d0L43HxTQfT+oSA1EEp2q+ne2uh6XgeJcm8brE= github.com/MakeNowJust/heredoc v1.0.0 h1:cXCdzVdstXyiTqTvfqk9SDHpKNjxuom+DOlyEeQ4pzQ= github.com/MakeNowJust/heredoc v1.0.0/go.mod h1:mG5amYoWBHf8vpLOuehzbGGw0EHxpZZ6lCpQ4fNJ8LE= github.com/MarvinJWendt/testza v0.1.0/go.mod h1:7AxNvlfeHP7Z/hDQ5JtE3OKYT3XFUeLCDE2DQninSqs= @@ -533,12 +531,8 @@ github.com/charmbracelet/bubbletea v1.1.1 h1:KJ2/DnmpfqFtDNVTvYZ6zpPFL9iRCRr0qqK github.com/charmbracelet/bubbletea v1.1.1/go.mod h1:9Ogk0HrdbHolIKHdjfFpyXJmiCzGwy+FesYkZr7hYU4= github.com/charmbracelet/harmonica v0.2.0 h1:8NxJWRWg/bzKqqEaaeFNipOu77YR5t8aSwG4pgaUBiQ= github.com/charmbracelet/harmonica v0.2.0/go.mod h1:KSri/1RMQOZLbw7AHqgcBycp8pgJnQMYYT8QZRqZ1Ao= -github.com/charmbracelet/lipgloss v0.13.1 h1:Oik/oqDTMVA01GetT4JdEC033dNzWoQHdWnHnQmXE2A= -github.com/charmbracelet/lipgloss v0.13.1/go.mod h1:zaYVJ2xKSKEnTEEbX6uAHabh2d975RJ+0yfkFpRBz5U= github.com/charmbracelet/lipgloss v1.0.0 h1:O7VkGDvqEdGi93X+DeqsQ7PKHDgtQfF8j8/O2qFMQNg= github.com/charmbracelet/lipgloss v1.0.0/go.mod h1:U5fy9Z+C38obMs+T+tJqst9VGzlOYGj4ri9reL3qUlo= -github.com/charmbracelet/x/ansi v0.3.2 h1:wsEwgAN+C9U06l9dCVMX0/L3x7ptvY1qmjMwyfE6USY= -github.com/charmbracelet/x/ansi v0.3.2/go.mod h1:dk73KoMTT5AX5BsX0KrqhsTqAnhZZoCBjs7dGWp4Ktw= github.com/charmbracelet/x/ansi v0.4.2 h1:0JM6Aj/g/KC154/gOP4vfxun0ff6itogDYk41kof+qk= github.com/charmbracelet/x/ansi v0.4.2/go.mod h1:dk73KoMTT5AX5BsX0KrqhsTqAnhZZoCBjs7dGWp4Ktw= github.com/charmbracelet/x/term v0.2.0 h1:cNB9Ot9q8I711MyZ7myUR5HFWL/lc3OpU8jZ4hwm0x0= @@ -636,8 +630,6 @@ github.com/defenseunicorns/pkg/helpers/v2 v2.0.1 h1:j08rz9vhyD9Bs+yKiyQMY2tSSejX github.com/defenseunicorns/pkg/helpers/v2 v2.0.1/go.mod h1:u1PAqOICZyiGIVA2v28g55bQH1GiAt0Bc4U9/rnWQvQ= github.com/defenseunicorns/pkg/oci v1.0.2 h1:JRdFbKnJQiGVsMUWmcmm0ZS8aBmmAORXLGSAGkIGhBQ= github.com/defenseunicorns/pkg/oci v1.0.2/go.mod h1:z11UFenAd4HQRucaEp0uhoccor/6zbQiXEQq+Z7vtI0= -github.com/defenseunicorns/uds-runtime v0.8.0 h1:Hqu3F9G9jla+gxj3ZAFpMxahx7IZsQ+QRPhTa/XTg4I= -github.com/defenseunicorns/uds-runtime v0.8.0/go.mod h1:ViJ5JG4wHfIn821ON9xv6f4r8peIjHfHD2HxWwPFFd0= github.com/defenseunicorns/uds-security-hub v0.0.7 h1:4leg+FDagyoFdr3aSeFGlega4XG5+FwXnAdQsB2MebM= github.com/defenseunicorns/uds-security-hub v0.0.7/go.mod h1:4c1w8sRRyQfMDEQ3d+i3/7ENwQGgkNRkvjF5+4D2LZ4= github.com/deitch/magic v0.0.0-20230404182410-1ff89d7342da h1:ZOjWpVsFZ06eIhnh4mkaceTiVoktdU67+M7KDHJ268M= @@ -792,8 +784,6 @@ github.com/gliderlabs/ssh v0.3.7 h1:iV3Bqi942d9huXnzEF2Mt+CY9gLu8DNM4Obd+8bODRE= github.com/gliderlabs/ssh v0.3.7/go.mod h1:zpHEXBstFnQYtGnB8k8kQLol82umzn/2/snG7alWVD8= github.com/go-chi/chi v4.1.2+incompatible h1:fGFk2Gmi/YKXk0OmGfBh0WgmN3XB8lVnEyNz34tQRec= github.com/go-chi/chi v4.1.2+incompatible/go.mod h1:eB3wogJHnLi3x/kFX2A+IbTBlXxmMeXJVKy9tTv1XzQ= -github.com/go-chi/chi/v5 v5.1.0 h1:acVI1TYaD+hhedDJ3r54HyA6sExp3HfXq7QWEEY/xMw= -github.com/go-chi/chi/v5 v5.1.0/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8= github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA= github.com/go-errors/errors v1.4.2/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og= github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 h1:+zs/tPmkDkHx3U66DAb0lQFJrpS6731Oaa12ikc+DiI= @@ -1657,12 +1647,6 @@ github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8 github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= -github.com/swaggo/files/v2 v2.0.1 h1:XCVJO/i/VosCDsJu1YLpdejGsGnBE9deRMpjN4pJLHk= -github.com/swaggo/files/v2 v2.0.1/go.mod h1:24kk2Y9NYEJ5lHuCra6iVwkMjIekMCaFq/0JQj66kyM= -github.com/swaggo/http-swagger/v2 v2.0.2 h1:FKCdLsl+sFCx60KFsyM0rDarwiUSZ8DqbfSyIKC9OBg= -github.com/swaggo/http-swagger/v2 v2.0.2/go.mod h1:r7/GBkAWIfK6E/OLnE8fXnviHiDeAHmgIyooa4xm3AQ= -github.com/swaggo/swag v1.16.4 h1:clWJtd9LStiG3VeijiCfOVODP6VpHtKdQy9ELFG3s1A= -github.com/swaggo/swag v1.16.4/go.mod h1:VBsHJRsDvfYvqoiMKnsdwhNV9LEMHgEDZcyVYX0sxPg= github.com/sylabs/sif/v2 v2.17.1 h1:p6Sl0LWyShXBj2SBsS1dMOMIMrZHe8pwBnBrYt6uo4M= github.com/sylabs/sif/v2 v2.17.1/go.mod h1:XUGB6AQUXGkms3qPOPdevctT3lBLRLWZNWHVnt5HMKE= github.com/sylabs/squashfs v1.0.0 h1:xAyMS21ogglkuR5HaY55PCfqY3H32ma9GkasTYo28Zg= diff --git a/hack/download-uds-runtime-assets.sh b/hack/download-uds-runtime-assets.sh deleted file mode 100755 index 20d38338f..000000000 --- a/hack/download-uds-runtime-assets.sh +++ /dev/null @@ -1,67 +0,0 @@ -#!/bin/bash -# Copyright 2024 Defense Unicorns -# SPDX-License-Identifier: AGPL-3.0-or-later OR LicenseRef-Defense-Unicorns-Commercial - - -OWNER="defenseunicorns" -REPO="uds-runtime" -BASE_PATH="./src/cmd/" -CERTS_PATH="${BASE_PATH}/certs" -ARCHIVE_NAME="uds-runtime-ui.tar.gz" -CURRENT_VERSION="v0.8.0" - -# Get the latest release version from GitHub API -LATEST_VERSION=$(curl -s "https://api.github.com/repos/$OWNER/$REPO/releases/latest" | jq -r .tag_name) - -# Create the base path directory if it doesn't exist -mkdir -p "$BASE_PATH" -mkdir -p "$CERTS_PATH" - -# Download the latest release archive -download_release() { - echo "Downloading $ARCHIVE_NAME for version $LATEST_VERSION" - curl -L "https://github.com/$OWNER/$REPO/releases/download/${LATEST_VERSION}/${ARCHIVE_NAME}" -o "${BASE_PATH}/${ARCHIVE_NAME}" -} - -# Extract the archive into the base path -extract_release() { - echo "Extracting $ARCHIVE_NAME" - tar -xzf "${BASE_PATH}/${ARCHIVE_NAME}" -C "$BASE_PATH" -} - -# Remove old files in the base path -clean_old_files() { - echo "Cleaning up old files" - rm -rf "${BASE_PATH:?}/ui" -} - -# Download raw certs files from the repository's main branch -download_certs() { - echo "Downloading certificates from hack/certs" - FILES=("cert.pem" "key.pem") - for file in "${FILES[@]}"; do - echo "Downloading $file" - curl -L "https://raw.githubusercontent.com/$OWNER/$REPO/main/hack/certs/$file" -o "${CERTS_PATH}/$file" - done -} - -# Check if the current version is different from the latest or the archive doesn't exist -if [[ "$LATEST_VERSION" != "$CURRENT_VERSION" ]] || [[ ! -f "${BASE_PATH}/${ARCHIVE_NAME}" ]]; then - echo "Updating UDS Runtime UI to version $LATEST_VERSION" - - # Clean up old files before downloading the new release - clean_old_files - - # Download and extract the latest release archive - download_release - extract_release - - # Update the current version - CURRENT_VERSION="$LATEST_VERSION" - echo "Updated to version $LATEST_VERSION" -else - echo "UDS Runtime UI is up to date." -fi - -# Download certs files -download_certs diff --git a/renovate.json b/renovate.json index 49fadc106..b24b55e62 100644 --- a/renovate.json +++ b/renovate.json @@ -56,14 +56,6 @@ ], "depNameTemplate": "zarf-dev/zarf", "datasourceTemplate": "github-releases" - }, - { - "fileMatch": ["hack/download-uds-runtime-assets.sh"], - "matchStrings": [ - "CURRENT_VERSION=\"v(?\\d+\\.\\d+\\.\\d+)\"" - ], - "depNameTemplate": "defenseunicorns/uds-runtime", - "datasourceTemplate": "github-releases" } ] } diff --git a/src/cmd/ui.go b/src/cmd/ui.go deleted file mode 100644 index 1d8a5b780..000000000 --- a/src/cmd/ui.go +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2024 Defense Unicorns -// SPDX-License-Identifier: AGPL-3.0-or-later OR LicenseRef-Defense-Unicorns-Commercial - -// Package cmd contains the CLI commands for UDS. -package cmd - -import ( - "embed" - "log/slog" - - ui "github.com/defenseunicorns/uds-runtime/src/pkg/api" -) - -//go:embed ui/build/* -var uiBuild embed.FS - -//go:embed certs/cert.pem -var localCert []byte - -//go:embed certs/key.pem -var localKey []byte - -func startUI() error { - r, incluster, err := ui.Setup(&uiBuild) - if err != nil { - slog.Error("failed to setup UI server", "error", err) - return err - } - err = ui.Serve(r, localCert, localKey, incluster) - if err != nil { - slog.Error("failed to serve UI", "error", err) - return err - } - return nil -} diff --git a/src/cmd/vendored.go b/src/cmd/vendored.go index cbdbdeb60..8cba20aad 100644 --- a/src/cmd/vendored.go +++ b/src/cmd/vendored.go @@ -91,21 +91,6 @@ var scanCmd = &cobra.Command{ DisableFlagParsing: true, } -// uds-runtime -var uiCmd = &cobra.Command{ - Use: "ui", - Short: lang.CmdUIShort, - Long: lang.CmdUIShort, - RunE: func(_ *cobra.Command, _ []string) error { - os.Args = os.Args[1:] // grab 'ui' and onward from the CLI args - if err := startUI(); err != nil { - return err - } - return nil - }, - DisableFlagParsing: true, -} - func init() { // grab Zarf version to make Zarf library checks happy if buildInfo, ok := debug.ReadBuildInfo(); ok { @@ -126,5 +111,4 @@ func init() { rootCmd.AddCommand(runnerCmd) rootCmd.AddCommand(zarfCmd) rootCmd.AddCommand(scanCmd) // uds-security-hub CLI command - rootCmd.AddCommand(uiCmd) } diff --git a/src/config/lang/lang.go b/src/config/lang/lang.go index b9bc6fcc5..0b262bcc6 100644 --- a/src/config/lang/lang.go +++ b/src/config/lang/lang.go @@ -119,7 +119,4 @@ const ( CmdPeprMonitorTimestampFlag = "Show timestamps in Pepr logs" CmdPeprMonitorSinceFlag = "Only return logs newer than a relative duration like 5s, 2m, or 3h. Defaults to all logs." CmdPeprMonitorJSONFlag = "Return the raw JSON output of the logs" - - // ui - CmdUIShort = "[beta] Launch UDS Runtime and view UI" ) diff --git a/src/test/e2e/ui_test.go b/src/test/e2e/ui_test.go deleted file mode 100644 index 222cf998d..000000000 --- a/src/test/e2e/ui_test.go +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2024 Defense Unicorns -// SPDX-License-Identifier: AGPL-3.0-or-later OR LicenseRef-Defense-Unicorns-Commercial - -package test - -import ( - "bytes" - "context" - "os" - "os/exec" - "testing" - "time" - - "github.com/stretchr/testify/require" -) - -func TestUDSUI(t *testing.T) { - t.Run("Test uds ui command", func(t *testing.T) { - // Create a context with a timeout of 10 seconds - ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) - defer cancel() - - // Prepare the command - cmd := exec.CommandContext(ctx, e2e.UDSBinPath, "ui", "-l", "debug") - - // Capture stdout and stderr - var stdout, stderr bytes.Buffer - cmd.Stdout = &stdout - cmd.Stderr = &stderr - - // Start the command - err := cmd.Start() - require.NoError(t, err, "Failed to start the command") - - // Use a channel to signal when the command is done - done := make(chan error, 1) - go func() { - done <- cmd.Wait() - }() - - // Wait for the server to start (adjust sleep time as needed) - time.Sleep(2 * time.Second) - - // Send interrupt signal - err = cmd.Process.Signal(os.Interrupt) - require.NoError(t, err, "Failed to send interrupt signal") - - // Wait for either the command to finish or the context to timeout - select { - case <-ctx.Done(): - t.Fatal("Command did not exit after interrupt") - case err := <-done: - require.Error(t, err) - } - - // Check stdout for Runtime output indicating that it's running as expected - require.Contains(t, stdout.String(), "GET https://runtime-local.uds.dev:8443") - - // Check stderr for CLI output indicating server startup - require.Contains(t, stderr.String(), "Starting server") - }) -} diff --git a/tasks.yaml b/tasks.yaml index eac3aa0e3..b87eaed28 100644 --- a/tasks.yaml +++ b/tasks.yaml @@ -68,7 +68,6 @@ tasks: actions: - task: get-versions - task: build-args - - cmd: ./hack/download-uds-runtime-assets.sh - cmd: CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="${BUILD_ARGS}" -o build/uds main.go - name: build-cli-linux-arm @@ -76,7 +75,6 @@ tasks: actions: - task: get-versions - task: build-args - - cmd: ./hack/download-uds-runtime-assets.sh - cmd: CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags="${BUILD_ARGS}" -o build/uds-arm main.go - name: build-cli-mac-intel @@ -84,7 +82,6 @@ tasks: actions: - task: get-versions - task: build-args - - cmd: ./hack/download-uds-runtime-assets.sh - cmd: GOOS=darwin GOARCH=amd64 go build -ldflags="${BUILD_ARGS}" -o build/uds-mac-intel main.go - name: build-cli-mac-apple @@ -92,5 +89,4 @@ tasks: actions: - task: get-versions - task: build-args - - cmd: ./hack/download-uds-runtime-assets.sh - cmd: GOOS=darwin GOARCH=arm64 go build -ldflags="${BUILD_ARGS}" -o build/uds-mac-apple main.go diff --git a/tasks/tests.yaml b/tasks/tests.yaml index 8b4eb2922..820e45b17 100644 --- a/tasks/tests.yaml +++ b/tasks/tests.yaml @@ -53,8 +53,8 @@ tasks: - cmd: cd src/test/e2e && go test -failfast -v -timeout 30m optional_bundle_test.go commands_test.go main_test.go - name: vendor - description: only run tests for vendored apps (zarf, maru, runtime, security hub) - - cmd: cd src/test/e2e && go test -failfast -v -timeout 30m zarf_test.go runner_test.go ui_test.go security_hub_test.go commands_test.go main_test.go + description: only run tests for vendored apps (zarf, maru, security hub) + - cmd: cd src/test/e2e && go test -failfast -v -timeout 30m zarf_test.go runner_test.go security_hub_test.go commands_test.go main_test.go - name: engine-e2e description: only run engine e2e tests