From 93a584b7c24cbf223ecef301c6edb0ace367c000 Mon Sep 17 00:00:00 2001 From: Bruno Quaresma Date: Mon, 5 May 2025 11:10:50 -0300 Subject: [PATCH 1/4] fix: fix windsurf icon on light theme (#17679) --- site/src/modules/resources/AppLink/BaseIcon.tsx | 3 ++- site/src/theme/externalImages.ts | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/site/src/modules/resources/AppLink/BaseIcon.tsx b/site/src/modules/resources/AppLink/BaseIcon.tsx index 1f2885a49a02f..b768facbdd482 100644 --- a/site/src/modules/resources/AppLink/BaseIcon.tsx +++ b/site/src/modules/resources/AppLink/BaseIcon.tsx @@ -1,5 +1,6 @@ import ComputerIcon from "@mui/icons-material/Computer"; import type { WorkspaceApp } from "api/typesGenerated"; +import { ExternalImage } from "components/ExternalImage/ExternalImage"; import type { FC } from "react"; interface BaseIconProps { @@ -9,7 +10,7 @@ interface BaseIconProps { export const BaseIcon: FC = ({ app, onIconPathError }) => { return app.icon ? ( - {`${app.display_name}([ ["/icon/rust.svg", "monochrome"], ["/icon/terminal.svg", "monochrome"], ["/icon/widgets.svg", "monochrome"], + ["/icon/windsurf.svg", "monochrome"], ]); From 4369765996bb39468d8df146b2b6825932353d86 Mon Sep 17 00:00:00 2001 From: Ethan <39577870+ethanndickson@users.noreply.github.com> Date: Tue, 6 May 2025 00:15:24 +1000 Subject: [PATCH 2/4] test: fix `TestWorkspaceAgentReportStats` flake (#17678) Closes https://github.com/coder/internal/issues/609. As seen in the below logs, the `last_used_at` time was updating, but just to the same value that it was on creation; `dbtime.Now` was called in quick succession. ``` t.go:106: 2025-05-05 12:11:54.166 [info] coderd.workspace_usage_tracker: updated workspaces last_used_at count=1 now="2025-05-05T12:11:54.161329Z" t.go:106: 2025-05-05 12:11:54.172 [debu] coderd: GET host=localhost:50422 path=/api/v2/workspaces/745b7ff3-47f2-4e1a-9452-85ea48ba5c46 proto=HTTP/1.1 remote_addr=127.0.0.1 start="2025-05-05T12:11:54.1669073Z" workspace_name=peaceful_faraday34 requestor_id=b2cf02ae-2181-480b-bb1f-95dc6acb6497 requestor_name=testuser requestor_email="" took=5.2105ms status_code=200 latency_ms=5 params_workspace=745b7ff3-47f2-4e1a-9452-85ea48ba5c46 request_id=7fd5ea90-af7b-4104-91c5-9ca64bc2d5e6 workspaceagentsrpc_test.go:70: Error Trace: C:/actions-runner/coder/coder/coderd/workspaceagentsrpc_test.go:70 Error: Should be true Test: TestWorkspaceAgentReportStats Messages: 2025-05-05 12:11:54.161329 +0000 UTC is not after 2025-05-05 12:11:54.161329 +0000 UTC ``` If we change the initial `LastUsedAt` time to be a time in the past, ticking with a `dbtime.Now` will always update it to a later value. If it never updates, the condition will still fail. --- coderd/workspaceagentsrpc_test.go | 1 + 1 file changed, 1 insertion(+) diff --git a/coderd/workspaceagentsrpc_test.go b/coderd/workspaceagentsrpc_test.go index 3f1f1a2b8a764..caea9b39c2f54 100644 --- a/coderd/workspaceagentsrpc_test.go +++ b/coderd/workspaceagentsrpc_test.go @@ -32,6 +32,7 @@ func TestWorkspaceAgentReportStats(t *testing.T) { r := dbfake.WorkspaceBuild(t, db, database.WorkspaceTable{ OrganizationID: user.OrganizationID, OwnerID: user.UserID, + LastUsedAt: dbtime.Now().Add(-time.Minute), }).WithAgent().Do() ac := agentsdk.New(client.URL) From 6b4d3f83bc37a53778762c5e2f2a248d894ca004 Mon Sep 17 00:00:00 2001 From: Hugo Dutka Date: Mon, 5 May 2025 18:49:58 +0200 Subject: [PATCH 3/4] chore: reduce "Upload tests to datadog" times in CI (#17668) This PR speeds up the "Upload tests to datadog" step by downloading the `datadog-ci` binary directly from GitHub releases. Most of the time used to be spent in `npm install`, which consistently timed out on Windows after a minute. [Now it takes 3 seconds](https://github.com/coder/coder/actions/runs/14834976784/job/41644230049?pr=17668#step:10:1). I updated it to version v2.48.0 because v2.21.0 didn't have the artifacts for arm64 macOS. --- .github/actions/upload-datadog/action.yaml | 43 +++++++++++++++++++++- 1 file changed, 41 insertions(+), 2 deletions(-) diff --git a/.github/actions/upload-datadog/action.yaml b/.github/actions/upload-datadog/action.yaml index 11eecac636636..a2df93ab14b28 100644 --- a/.github/actions/upload-datadog/action.yaml +++ b/.github/actions/upload-datadog/action.yaml @@ -10,6 +10,8 @@ runs: steps: - shell: bash run: | + set -e + owner=${{ github.repository_owner }} echo "owner: $owner" if [[ $owner != "coder" ]]; then @@ -21,8 +23,45 @@ runs: echo "No API key provided, skipping..." exit 0 fi - npm install -g @datadog/datadog-ci@2.21.0 - datadog-ci junit upload --service coder ./gotests.xml \ + + BINARY_VERSION="v2.48.0" + BINARY_HASH_WINDOWS="b7bebb8212403fddb1563bae84ce5e69a70dac11e35eb07a00c9ef7ac9ed65ea" + BINARY_HASH_MACOS="e87c808638fddb21a87a5c4584b68ba802965eb0a593d43959c81f67246bd9eb" + BINARY_HASH_LINUX="5e700c465728fff8313e77c2d5ba1ce19a736168735137e1ddc7c6346ed48208" + + TMP_DIR=$(mktemp -d) + + if [[ "${{ runner.os }}" == "Windows" ]]; then + BINARY_PATH="${TMP_DIR}/datadog-ci.exe" + BINARY_URL="https://github.com/DataDog/datadog-ci/releases/download/${BINARY_VERSION}/datadog-ci_win-x64" + elif [[ "${{ runner.os }}" == "macOS" ]]; then + BINARY_PATH="${TMP_DIR}/datadog-ci" + BINARY_URL="https://github.com/DataDog/datadog-ci/releases/download/${BINARY_VERSION}/datadog-ci_darwin-arm64" + elif [[ "${{ runner.os }}" == "Linux" ]]; then + BINARY_PATH="${TMP_DIR}/datadog-ci" + BINARY_URL="https://github.com/DataDog/datadog-ci/releases/download/${BINARY_VERSION}/datadog-ci_linux-x64" + else + echo "Unsupported OS: ${{ runner.os }}" + exit 1 + fi + + echo "Downloading DataDog CI binary version ${BINARY_VERSION} for ${{ runner.os }}..." + curl -sSL "$BINARY_URL" -o "$BINARY_PATH" + + if [[ "${{ runner.os }}" == "Windows" ]]; then + echo "$BINARY_HASH_WINDOWS $BINARY_PATH" | sha256sum --check + elif [[ "${{ runner.os }}" == "macOS" ]]; then + echo "$BINARY_HASH_MACOS $BINARY_PATH" | shasum -a 256 --check + elif [[ "${{ runner.os }}" == "Linux" ]]; then + echo "$BINARY_HASH_LINUX $BINARY_PATH" | sha256sum --check + fi + + # Make binary executable (not needed for Windows) + if [[ "${{ runner.os }}" != "Windows" ]]; then + chmod +x "$BINARY_PATH" + fi + + "$BINARY_PATH" junit upload --service coder ./gotests.xml \ --tags os:${{runner.os}} --tags runner_name:${{runner.name}} env: DATADOG_API_KEY: ${{ inputs.api-key }} From 4587082fcf84a92bda6413733371373acae2392f Mon Sep 17 00:00:00 2001 From: Jaayden Halko Date: Mon, 5 May 2025 22:13:39 +0100 Subject: [PATCH 4/4] chore: update design of External auth section of CreateWorkspacePage (#17683) contributes to coder/preview#59 Figma: https://www.figma.com/design/SMg6H8VKXnPSkE6h9KPoAD/UX-Presets?node-id=2180-2995&t=RL6ICIf6KUL5YUpB-1 This updates the design of the External authentication section of the create workspace page form for both the existing and the new experimental create workspace pages. Screenshot 2025-05-05 at 18 15 28 --- .../CreateWorkspacePage.test.tsx | 2 +- .../CreateWorkspacePageViewExperimental.tsx | 6 +- .../ExternalAuthButton.tsx | 130 ++++++++++-------- 3 files changed, 73 insertions(+), 65 deletions(-) diff --git a/site/src/pages/CreateWorkspacePage/CreateWorkspacePage.test.tsx b/site/src/pages/CreateWorkspacePage/CreateWorkspacePage.test.tsx index b24542b34021d..64deba2116fb1 100644 --- a/site/src/pages/CreateWorkspacePage/CreateWorkspacePage.test.tsx +++ b/site/src/pages/CreateWorkspacePage/CreateWorkspacePage.test.tsx @@ -209,7 +209,7 @@ describe("CreateWorkspacePage", () => { .mockResolvedValue([MockTemplateVersionExternalAuthGithubAuthenticated]); await screen.findByText( - "Authenticated with GitHub", + "Authenticated", {}, { interval: 500, timeout: 5000 }, ); diff --git a/site/src/pages/CreateWorkspacePage/CreateWorkspacePageViewExperimental.tsx b/site/src/pages/CreateWorkspacePage/CreateWorkspacePageViewExperimental.tsx index 1a07596854f8d..6751961e3cb2e 100644 --- a/site/src/pages/CreateWorkspacePage/CreateWorkspacePageViewExperimental.tsx +++ b/site/src/pages/CreateWorkspacePage/CreateWorkspacePageViewExperimental.tsx @@ -304,7 +304,7 @@ export const CreateWorkspacePageViewExperimental: FC<
{Boolean(error) && } @@ -397,14 +397,14 @@ export const CreateWorkspacePageViewExperimental: FC< {externalAuth && externalAuth.length > 0 && (
-

+

External Authentication

This template uses external services for authentication.

-
+
{Boolean(error) && !hasAllRequiredExternalAuth && ( To create a workspace using this template, please connect to diff --git a/site/src/pages/CreateWorkspacePage/ExternalAuthButton.tsx b/site/src/pages/CreateWorkspacePage/ExternalAuthButton.tsx index 427c62b7bdf93..9a647b507947e 100644 --- a/site/src/pages/CreateWorkspacePage/ExternalAuthButton.tsx +++ b/site/src/pages/CreateWorkspacePage/ExternalAuthButton.tsx @@ -1,11 +1,15 @@ -import ReplayIcon from "@mui/icons-material/Replay"; -import LoadingButton from "@mui/lab/LoadingButton"; -import Button from "@mui/material/Button"; -import Tooltip from "@mui/material/Tooltip"; -import { visuallyHidden } from "@mui/utils"; import type { TemplateVersionExternalAuth } from "api/typesGenerated"; +import { Badge } from "components/Badge/Badge"; +import { Button } from "components/Button/Button"; import { ExternalImage } from "components/ExternalImage/ExternalImage"; -import { Pill } from "components/Pill/Pill"; +import { Spinner } from "components/Spinner/Spinner"; +import { + Tooltip, + TooltipContent, + TooltipProvider, + TooltipTrigger, +} from "components/Tooltip/Tooltip"; +import { Check, Redo } from "lucide-react"; import type { FC } from "react"; export interface ExternalAuthButtonProps { @@ -24,62 +28,66 @@ export const ExternalAuthButton: FC = ({ error, }) => { return ( - <> -
- - ) - } - disabled={auth.authenticated} - onClick={() => { - window.open( - auth.authenticate_url, - "_blank", - "width=900,height=600", - ); - onStartPolling(); - }} - > - {auth.authenticated ? ( - `Authenticated with ${auth.display_name}` - ) : ( - <> - Login with {auth.display_name} - {!auth.optional && ( - - Required - - )} - - )} - +
+ + {auth.display_icon && ( + + )} +

{auth.display_name}

+ {!auth.optional && ( + + Required + + )} +
+ + + {auth.authenticated ? ( + <> + +

+ Authenticated +

+ + ) : ( + + )} - {displayRetry && ( - - - + {displayRetry && !auth.authenticated && ( + + + + + + + Retry login with {auth.display_name} + + + )} -
- + +
); };