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

chore: refactor uds ui to use vendored runtime #967

Merged
merged 19 commits into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
8 changes: 2 additions & 6 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,8 @@ jobs:
owner: defenseunicorns
repositories: homebrew-tap

- name: Download Runtime binaries for embedding
run: |
./hack/update-uds-runtime-binaries.sh uds-runtime-linux-amd64
./hack/update-uds-runtime-binaries.sh uds-runtime-linux-arm64
./hack/update-uds-runtime-binaries.sh uds-runtime-darwin-amd64
./hack/update-uds-runtime-binaries.sh uds-runtime-darwin-arm64
- name: Download Runtime assets for embedding
run: ./hack/download-uds-runtime-assets.sh

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@286f3b13b1b49da4ac219696163fb8c1c93e1200 # v6.0.0
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-schema-and-docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ jobs:
- name: Install UDS CLI
uses: ./.github/actions/install-uds-cli

- name: Pull UDS Runtime binary
run: ./hack/update-uds-runtime-binaries.sh uds-runtime-linux-amd64
- name: Pull UDS Runtime Assets
run: ./hack/download-uds-runtime-assets.sh

- name: Test schemas
run: uds run schema:test
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-unit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ jobs:
- name: Install UDS CLI
uses: ./.github/actions/install-uds-cli

- name: Pull UDS Runtime binary
run: ./hack/update-uds-runtime-binaries.sh uds-runtime-linux-amd64
- name: Pull UDS Runtime Assets
run: ./hack/download-uds-runtime-assets.sh

- name: Run unit tests
run: uds run test:unit
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,5 @@ out.txt
*.gif
*.mp4
src/cmd/bin
src/cmd/certs
*.pem
4 changes: 4 additions & 0 deletions docs/command-reference/uds_ui.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ type: docs

[beta] Launch UDS Runtime and view UI

### Synopsis

[beta] Launch UDS Runtime and view UI

```
uds ui [flags]
```
Expand Down
26 changes: 12 additions & 14 deletions docs/quickstart-and-usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,20 +131,21 @@ e.g.

```yaml
core-slim-dev:
- docker.io/istio/pilot:1.22.3-distroless
- docker.io/istio/proxyv2:1.22.3-distroless
- ghcr.io/defenseunicorns/pepr/controller:v0.34.1
- quay.io/keycloak/keycloak:24.0.5
- ghcr.io/defenseunicorns/uds/identity-config:0.6.0
- docker.io/istio/pilot:1.22.3-distroless
- docker.io/istio/proxyv2:1.22.3-distroless
- ghcr.io/defenseunicorns/pepr/controller:v0.34.1
- quay.io/keycloak/keycloak:24.0.5
- ghcr.io/defenseunicorns/uds/identity-config:0.6.0
init:
- library/registry:2.8.3
- library/registry:2.8.3
- ghcr.io/zarf-dev/zarf/agent:v0.38.2
- library/registry:2.8.3
- library/registry:2.8.3
- ghcr.io/zarf-dev/zarf/agent:v0.38.2
```

*To extract only the image names and de-dupe*:
_To extract only the image names and de-dupe_:

`uds inspect k3d-core-slim-dev:0.26.0 --list-images | yq '.[] | .[]'` | sort | uniq

```yaml
docker.io/istio/pilot:1.22.3-distroless
docker.io/istio/proxyv2:1.22.3-distroless
Expand All @@ -155,7 +156,6 @@ library/registry:2.8.3
quay.io/keycloak/keycloak:24.0.5
```


#### Viewing SBOMs

There are 2 additional flags for the `uds inspect` command you can use to extract and view SBOMs:
Expand Down Expand Up @@ -312,7 +312,9 @@ In a bundle, variables can come from 6 sources. Those sources and their preceden
That is to say, variables set using the `--set` flag take precedence over all other variable sources.

### Configuring Zarf Init Packages

Zarf init packages that are typically deployed using `zarf init` have a few special flags that are attached to that command. These options can be configured like any other variable: specified in a `uds-config.yaml`, as an environment variable prefixed with `UDS_` or via the `--set` flag.

```yaml
# uds-config.yaml
variables:
Expand Down Expand Up @@ -505,7 +507,3 @@ uds scan -o defenseunicorns -n packages/uds/gitlab-runner -g 16.10.0-uds.0-upstr
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`.

{{% alert-note %}}
There is currently a known data loading [issue](https://github.com/defenseunicorns/uds-runtime/issues/365) with opening UDS Runtime via `uds ui` in multiple tabs or windows. If you encounter this issue, please ensure there is only one tab or window of UDS Runtime open at a time.
{{% /alert-note %}}
7 changes: 7 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ 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.6.1
github.com/defenseunicorns/uds-security-hub v0.0.7
github.com/fsnotify/fsnotify v1.7.0
github.com/goccy/go-yaml v1.12.0
Expand Down Expand Up @@ -69,6 +70,7 @@ require (
github.com/BurntSushi/toml v1.4.0 // indirect
github.com/CycloneDX/cyclonedx-go v0.9.0 // 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
Expand Down Expand Up @@ -232,6 +234,7 @@ 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
Expand Down Expand Up @@ -449,6 +452,9 @@ 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.3 // 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
Expand Down Expand Up @@ -502,6 +508,7 @@ require (
golang.org/x/term v0.24.0 // indirect
golang.org/x/text v0.18.0 // indirect
golang.org/x/time v0.6.0 // indirect
golang.org/x/tools v0.25.0 // indirect
golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect
google.golang.org/api v0.195.0 // indirect
google.golang.org/genproto v0.0.0-20240823204242-4ba0660f739c // indirect
Expand Down
12 changes: 12 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,8 @@ 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=
Expand Down Expand Up @@ -632,6 +634,8 @@ github.com/defenseunicorns/pkg/kubernetes v0.3.0 h1:f4VSIaUdvn87/dhiZvRbUfHhcHa8
github.com/defenseunicorns/pkg/kubernetes v0.3.0/go.mod h1:FsuKQGpPZOnZWifBse7v787+avtIu2lte5LTsaojDkY=
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.6.1 h1:S4suI8HZ4HH3AJ2RNbOamYVlp4R9iRw9GIAJVbYj9RE=
github.com/defenseunicorns/uds-runtime v0.6.1/go.mod h1:un/UY3wqqUXg84sVZZ2adMy+V6JDk7KSYQBgyByfgdA=
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=
Expand Down Expand Up @@ -786,6 +790,8 @@ 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=
Expand Down Expand Up @@ -1649,6 +1655,12 @@ 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.3 h1:PnCYjPCah8FK4I26l2F/KQ4yz3sILcVUN3cTlBFA9Pg=
github.com/swaggo/swag v1.16.3/go.mod h1:DImHIuOFXKpMFAQjcC7FG4m3Dg4+QuUgUzJmKjI/gRk=
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=
Expand Down
67 changes: 67 additions & 0 deletions hack/download-uds-runtime-assets.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
#!/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.6.1"

# 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
71 changes: 0 additions & 71 deletions hack/update-uds-runtime-binaries.sh

This file was deleted.

Loading
Loading