diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 1c90db4a81..cbb9711967 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -123,3 +123,57 @@ jobs: run: | # Exit with status code 1 if there are differences (i.e. unformatted files) git diff --exit-code + + app: + # The UCX Databricks App: type-check and build the frontend, then build the wheel and check that it contains the + # app. Release builds must run `make build` the same way, see docs/ucx/docs/dev/contributing.mdx. + runs-on: + group: databrickslabs-protected-runner-group + labels: linux-ubuntu-latest + permissions: + # Authenticate with JFrog for package resolution. + id-token: write + steps: + - name: Checkout + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + + - name: Setup uv + uses: astral-sh/setup-uv@5a095e7a2014a4212f075830d4f7277575a9d098 # v7.3.1 + with: + version: "0.13.7" + checksum: "c5221ff41b7892bfc223543883600125f6a47fe845093e0f5bdff4f359196d83" + + - name: Setup Node.js + uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 + with: + node-version: "26" + + - name: Setup pnpm + uses: pnpm/action-setup@73e46992e05b19abd31f2f3c20e0e7370d762115 # v6.1.1 + with: + version: "9.15.9" + + # After the tools: it configures npm (and so pnpm) for JFrog, with ignore-scripts=true. + - name: Setup for JFrog + uses: ./.github/actions/jfrog-auth + + - name: Type-check the frontend + working-directory: app-ui + run: | + pnpm install --frozen-lockfile + pnpm typecheck + + - name: Build the wheel with the app + run: make build + + - name: Check that the wheel contains the app + run: | + set -euo pipefail + wheel="$(ls dist/databricks_labs_ucx-*-py3-none-any.whl)" + for required in databricks/labs/ucx/app/static/index.html databricks/labs/ucx/app/bundle/requirements.txt \ + databricks/labs/ucx/app/bundle/databricks.yml databricks/labs/ucx/app/bundle/app.yaml; do + if ! unzip -l "$wheel" "$required" > /dev/null; then + printf '::error::%s\n' "$wheel is missing $required" + exit 1 + fi + done diff --git a/.gitignore b/.gitignore index ff48d3a0cd..05d709bba5 100644 --- a/.gitignore +++ b/.gitignore @@ -153,3 +153,7 @@ dev/cleanup.py .databricks-login.json *.out foo + +# UCX app frontend, built by `make app-ui` +src/databricks/labs/ucx/app/static/ +src/databricks/labs/ucx/app/bundle/requirements.txt diff --git a/Makefile b/Makefile index 7b2ece59c7..d345ddf915 100644 --- a/Makefile +++ b/Makefile @@ -37,7 +37,22 @@ coverage: $(UV_TEST) --cov src tests/unit --cov-report=html --cov-fail-under=89 open htmlcov/index.html -build: +# The app frontend is a static export, built into the Python package so that it ships in the wheel. +APP_UI_STATIC := src/databricks/labs/ucx/app/static + +app-ui: + cd app-ui && pnpm install --frozen-lockfile && NEXT_TELEMETRY_DISABLED=1 pnpm build + rm -rf $(APP_UI_STATIC) + cp -R app-ui/out $(APP_UI_STATIC) + +# Hashed requirements of the app, from uv.lock: `deploy-app` installs exactly these in the app environment. +APP_REQUIREMENTS := src/databricks/labs/ucx/app/bundle/requirements.txt + +app-requirements: + uv export --frozen --extra app --no-default-groups --no-emit-project --no-header --no-annotate \ + --format requirements-txt --output-file $(APP_REQUIREMENTS) + +build: app-ui app-requirements uv build --require-hashes --build-constraints=.build-constraints.txt lock-dependencies: UV_FROZEN := 0 @@ -74,4 +89,4 @@ docs-serve: docs-build yarn --cwd docs/ucx serve .DEFAULT: all -.PHONY: all clean dev lint fmt test integration coverage build lock-dependencies known cmds solacc docs-install docs-serve-dev docs-build docs-serve +.PHONY: all clean dev lint fmt test integration coverage app-ui app-requirements build lock-dependencies known cmds solacc docs-install docs-serve-dev docs-build docs-serve diff --git a/README.md b/README.md index eb1df26f4a..3bb453bf7d 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,9 @@ UCX is a toolkit for enabling Unity Catalog (UC) in your Databricks workspace. U Please refer to the [UCX documentation](https://databrickslabs.github.io/ucx/) for detailed information on how to use UCX. +To run the assessment, review the table mapping and migrate tables from a web UI, deploy the +[UCX App](https://databrickslabs.github.io/ucx/docs/reference/app) with `databricks labs ucx deploy-app`. + # Developer documentation diff --git a/app-ui/.gitignore b/app-ui/.gitignore new file mode 100644 index 0000000000..29c353c977 --- /dev/null +++ b/app-ui/.gitignore @@ -0,0 +1,5 @@ +node_modules/ +.next/ +out/ +next-env.d.ts +*.tsbuildinfo diff --git a/app-ui/app/assessment/page.tsx b/app-ui/app/assessment/page.tsx new file mode 100644 index 0000000000..a24a053082 --- /dev/null +++ b/app-ui/app/assessment/page.tsx @@ -0,0 +1,93 @@ +"use client"; + +import { ExternalLink, Play } from "lucide-react"; +import { useState } from "react"; +import useSWR from "swr"; + +import { useRuns } from "@/components/runs"; +import { PageTitle } from "@/components/shell"; +import { Alert } from "@/components/ui/alert"; +import { Button } from "@/components/ui/button"; +import { Card, CardTitle } from "@/components/ui/card"; +import { Checkbox } from "@/components/ui/checkbox"; +import { api, fetcher } from "@/lib/api"; +import type { Dashboard } from "@/lib/types"; + +export default function AssessmentPage() { + const { track } = useRuns(); + const [forceRefresh, setForceRefresh] = useState(false); + const [starting, setStarting] = useState(false); + const [runError, setRunError] = useState(null); + const { data: dashboard, error: dashboardError } = useSWR("/api/assessment/dashboard", fetcher); + + async function runAssessment() { + setStarting(true); + setRunError(null); + try { + const run = await api.runAssessment(forceRefresh); + track({ run_id: run.run_id, run_url: run.run_url, name: run.workflow }); + } catch (e) { + setRunError((e as Error).message); + } finally { + setStarting(false); + } + } + + return ( +
+ + + Run assessment +
+ + + +
+ {runError ? ( + {runError} + ) : ( + + The run starts in the background. Progress shows in the Active runs window. + + )} +
+ + + + Open in new tab + + + ) + } + > + Assessment dashboard + + {dashboardError && {dashboardError.message}} + {dashboard && ( + <> +