Skip to content

[pull] main from coder:main #192

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

Merged
merged 4 commits into from
May 6, 2025
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
43 changes: 41 additions & 2 deletions .github/actions/upload-datadog/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ runs:
steps:
- shell: bash
run: |
set -e

owner=${{ github.repository_owner }}
echo "owner: $owner"
if [[ $owner != "coder" ]]; then
Expand All @@ -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 }}
1 change: 1 addition & 0 deletions coderd/workspaceagentsrpc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion site/src/modules/resources/AppLink/BaseIcon.tsx
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -9,7 +10,7 @@ interface BaseIconProps {

export const BaseIcon: FC<BaseIconProps> = ({ app, onIconPathError }) => {
return app.icon ? (
<img
<ExternalImage
alt={`${app.display_name} Icon`}
src={app.icon}
style={{ pointerEvents: "none" }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ describe("CreateWorkspacePage", () => {
.mockResolvedValue([MockTemplateVersionExternalAuthGithubAuthenticated]);

await screen.findByText(
"Authenticated with GitHub",
"Authenticated",
{},
{ interval: 500, timeout: 5000 },
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ export const CreateWorkspacePageViewExperimental: FC<
<form
onSubmit={form.handleSubmit}
aria-label="Create workspace form"
className="flex flex-col gap-6 w-full border border-border-default border-solid rounded-lg p-6"
className="flex flex-col gap-10 w-full border border-border-default border-solid rounded-lg p-6"
>
{Boolean(error) && <ErrorAlert error={error} />}

Expand Down Expand Up @@ -397,14 +397,14 @@ export const CreateWorkspacePageViewExperimental: FC<
{externalAuth && externalAuth.length > 0 && (
<section>
<hgroup>
<h2 className="text-xl font-semibold mb-0">
<h2 className="text-xl font-semibold m-0">
External Authentication
</h2>
<p className="text-sm text-content-secondary mt-0">
This template uses external services for authentication.
</p>
</hgroup>
<div>
<div className="flex flex-col gap-4">
{Boolean(error) && !hasAllRequiredExternalAuth && (
<Alert severity="error">
To create a workspace using this template, please connect to
Expand Down
130 changes: 69 additions & 61 deletions site/src/pages/CreateWorkspacePage/ExternalAuthButton.tsx
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -24,62 +28,66 @@ export const ExternalAuthButton: FC<ExternalAuthButtonProps> = ({
error,
}) => {
return (
<>
<div css={{ display: "flex", alignItems: "center", gap: 8 }}>
<LoadingButton
fullWidth
loading={isLoading}
variant="contained"
size="xlarge"
startIcon={
auth.display_icon && (
<ExternalImage
src={auth.display_icon}
alt={`${auth.display_name} Icon`}
css={{ width: 16, height: 16 }}
/>
)
}
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 && (
<Pill type={error ? "error" : "info"} css={{ marginLeft: 12 }}>
Required
</Pill>
)}
</>
)}
</LoadingButton>
<div className="flex items-center gap-2 border border-border border-solid rounded-md p-3 justify-between">
<span className="flex flex-row items-center gap-2">
{auth.display_icon && (
<ExternalImage
className="w-5 h-5"
src={auth.display_icon}
alt={`${auth.display_name} Icon`}
/>
)}
<p className="font-semibold text-sm m-0">{auth.display_name}</p>
{!auth.optional && (
<Badge size="sm" variant={error ? "destructive" : "warning"}>
Required
</Badge>
)}
</span>

<span className="flex flex-row items-center gap-2">
{auth.authenticated ? (
<>
<Check className="w-4 h-4 text-content-success" />
<p className="text-xs font-semibold text-content-secondary m-0">
Authenticated
</p>
</>
) : (
<Button
variant="default"
size="sm"
disabled={isLoading || auth.authenticated}
onClick={() => {
window.open(
auth.authenticate_url,
"_blank",
"width=900,height=600",
);
onStartPolling();
}}
>
<Spinner loading={isLoading} />
Login with {auth.display_name}
</Button>
)}

{displayRetry && (
<Tooltip title="Retry">
<Button
variant="contained"
size="xlarge"
onClick={onStartPolling}
css={{ minWidth: "auto", aspectRatio: "1" }}
>
<ReplayIcon css={{ width: 20, height: 20 }} />
<span aria-hidden css={{ ...visuallyHidden }}>
Refresh external auth
</span>
</Button>
</Tooltip>
{displayRetry && !auth.authenticated && (
<TooltipProvider>
<Tooltip delayDuration={100}>
<TooltipTrigger asChild>
<Button variant="outline" size="icon" onClick={onStartPolling}>
<Redo />
<span className="sr-only">Refresh external auth</span>
</Button>
</TooltipTrigger>
<TooltipContent>
Retry login with {auth.display_name}
</TooltipContent>
</Tooltip>
</TooltipProvider>
)}
</div>
</>
</span>
</div>
);
};
1 change: 1 addition & 0 deletions site/src/theme/externalImages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,4 +160,5 @@ export const defaultParametersForBuiltinIcons = new Map<string, string>([
["/icon/rust.svg", "monochrome"],
["/icon/terminal.svg", "monochrome"],
["/icon/widgets.svg", "monochrome"],
["/icon/windsurf.svg", "monochrome"],
]);
Loading