From c90ee9f4c80c12fe4d8aba3d6682706812f9eac1 Mon Sep 17 00:00:00 2001 From: catsby Date: Wed, 6 Nov 2024 14:21:00 -0600 Subject: [PATCH] chore: remove uds-runtime (ui) Signed-off-by: catsby --- CONTRIBUTING.md | 2 - 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 ------ tasks.yaml | 4 -- 9 files changed, 161 deletions(-) delete mode 100755 hack/download-uds-runtime-assets.sh delete mode 100644 src/cmd/ui.go diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b235a146..b3fff92c 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/docs/reference/CLI/quickstart-and-usage.md b/docs/reference/CLI/quickstart-and-usage.md index 2c34a1c1..058fe47b 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 31f0c9cb..638afe10 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 c09d3e25..d7e2f9a1 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 20d38338..00000000 --- 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 49fadc10..b24b55e6 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 1d8a5b78..00000000 --- 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 cbdbdeb6..8cba20aa 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/tasks.yaml b/tasks.yaml index eac3aa0e..b87eaed2 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