Skip to content

Commit

Permalink
Merge branch 'main' into cw/supervisor-ng
Browse files Browse the repository at this point in the history
  • Loading branch information
csweichel authored Sep 22, 2023
2 parents 665de4f + 0a44cfa commit b514391
Show file tree
Hide file tree
Showing 123 changed files with 3,043 additions and 784 deletions.
23 changes: 21 additions & 2 deletions components/blobserve/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/gitpod-io/gitpod/blobserve
go 1.20

require (
github.com/containerd/containerd v1.7.3
github.com/containerd/containerd v1.7.6
github.com/docker/cli v24.0.5+incompatible
github.com/docker/distribution v2.8.2+incompatible
github.com/gitpod-io/gitpod/common-go v0.0.0-00010101000000-000000000000
Expand All @@ -19,21 +19,31 @@ require (
)

require (
github.com/AdaLogics/go-fuzz-headers v0.0.0-20230106234847-43070de90fa1 // indirect
github.com/AdaLogics/go-fuzz-headers v0.0.0-20230811130428-ced1acdcaa24 // indirect
github.com/AdamKorcz/go-118-fuzz-build v0.0.0-20230306123547-8075edf89bb0 // indirect
github.com/Microsoft/go-winio v0.6.1 // indirect
github.com/Microsoft/hcsshim v0.11.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/containerd/cgroups v1.1.0 // indirect
github.com/containerd/continuity v0.4.2 // indirect
github.com/containerd/fifo v1.1.0 // indirect
github.com/containerd/ttrpc v1.2.2 // indirect
github.com/containerd/typeurl/v2 v2.1.1 // indirect
github.com/crackcomm/go-gitignore v0.0.0-20170627025303-887ab5e44cc3 // indirect
github.com/cyphar/filepath-securejoin v0.2.3 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
github.com/docker/docker-credential-helpers v0.8.0 // indirect
github.com/docker/go-events v0.0.0-20190806004212-e31b211e4f1c // indirect
github.com/felixge/httpsnoop v1.0.3 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/gitpod-io/gitpod/components/scrubber v0.0.0-00010101000000-000000000000 // indirect
github.com/gitpod-io/gitpod/registry-facade/api v0.0.0-00010101000000-000000000000 // indirect
github.com/go-logr/logr v1.2.4 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/uuid v1.3.0 // indirect
Expand Down Expand Up @@ -71,6 +81,9 @@ require (
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/moby/locker v1.0.1 // indirect
github.com/moby/sys/mountinfo v0.6.2 // indirect
github.com/moby/sys/sequential v0.5.0 // indirect
github.com/moby/sys/signal v0.7.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/mr-tron/base58 v1.2.0 // indirect
Expand All @@ -83,6 +96,9 @@ require (
github.com/multiformats/go-multistream v0.4.1 // indirect
github.com/multiformats/go-varint v0.0.7 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/runc v1.1.5 // indirect
github.com/opencontainers/runtime-spec v1.1.0-rc.1 // indirect
github.com/opencontainers/selinux v1.11.0 // indirect
github.com/opentracing/opentracing-go v1.2.0 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/polydawn/refmt v0.89.0 // indirect
Expand All @@ -96,6 +112,7 @@ require (
github.com/spf13/pflag v1.0.5 // indirect
github.com/uber/jaeger-client-go v2.29.1+incompatible // indirect
github.com/uber/jaeger-lib v2.4.1+incompatible // indirect
go.opencensus.io v0.24.0 // indirect
go.opentelemetry.io/otel v1.16.0 // indirect
go.opentelemetry.io/otel/metric v1.16.0 // indirect
go.opentelemetry.io/otel/trace v1.16.0 // indirect
Expand All @@ -104,10 +121,12 @@ require (
go.uber.org/zap v1.24.0 // indirect
golang.org/x/crypto v0.10.0 // indirect
golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df // indirect
golang.org/x/mod v0.11.0 // indirect
golang.org/x/net v0.10.0 // indirect
golang.org/x/sys v0.11.0 // indirect
golang.org/x/text v0.10.0 // indirect
golang.org/x/time v0.0.0-20220922220347-f3bd1da661af // indirect
golang.org/x/tools v0.9.1 // indirect
google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4 // indirect
google.golang.org/grpc v1.55.0 // indirect
google.golang.org/protobuf v1.30.0 // indirect
Expand Down
101 changes: 101 additions & 0 deletions components/blobserve/go.sum

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion components/blobserve/leeway.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Licensed under the GNU Affero General Public License (AGPL).
# See License.AGPL.txt in the project root for license information.

FROM cgr.dev/chainguard/wolfi-base:latest@sha256:74ba560a654f12586e0b8524097e00b326f9a6a9cd432a44ded9cad69a5a39c7
FROM cgr.dev/chainguard/wolfi-base:latest@sha256:d141305384203efd88710c735d71a3975371174ad882c181b5ce0bdb583615e6

# Ensure latest packages are present, like security updates.
RUN apk upgrade --no-cache \
Expand Down
7 changes: 4 additions & 3 deletions components/common-go/go-update-wc-deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,16 @@

set -eo pipefail

cd ../..
DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)
cd "$DIR"/../..

# an array of commponents we'll update and test at the end
COMPONENTS_TO_TEST=( )

# an associative array to describe dependencies we'd like to search for and update to
declare -A WORKSPACE_CLUSTER_DEPENDENCIES
WORKSPACE_CLUSTER_DEPENDENCIES["github.com/containerd/containerd"]="1.6.21"
WORKSPACE_CLUSTER_DEPENDENCIES["github.com/moby/buildkit"]="0.11.6"
WORKSPACE_CLUSTER_DEPENDENCIES["github.com/containerd/containerd"]="1.7.6"
WORKSPACE_CLUSTER_DEPENDENCIES["github.com/moby/buildkit"]="0.12.2"

# loop through keys of each associative array
for key in "${!WORKSPACE_CLUSTER_DEPENDENCIES[@]}"
Expand Down
2 changes: 1 addition & 1 deletion components/content-service/leeway.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Licensed under the GNU Affero General Public License (AGPL).
# See License.AGPL.txt in the project root for license information.

FROM cgr.dev/chainguard/wolfi-base:latest@sha256:74ba560a654f12586e0b8524097e00b326f9a6a9cd432a44ded9cad69a5a39c7
FROM cgr.dev/chainguard/wolfi-base:latest@sha256:d141305384203efd88710c735d71a3975371174ad882c181b5ce0bdb583615e6

# Ensure latest packages are present, like security updates.
RUN apk upgrade --no-cache \
Expand Down
6 changes: 5 additions & 1 deletion components/dashboard/BUILD.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ packages:
- "src/**/*.svg"
- "src/**/*.png"
- "src/**/*.webp"
- "src/**/*.json"
- "typings/**"
- package.json
- tailwind.config.js
Expand All @@ -21,7 +22,10 @@ packages:
- components/public-api/typescript:lib
config:
commands:
build: ["yarn", "build"]
build:
- sh
- -c
- yq w -i src/service/config.json commit commit-${__git_commit} -j && yarn build
test: ["yarn", "test:unit"]
yarnLock: ${coreYarnLockBase}/yarn.lock
dontTest: false
Expand Down
2 changes: 1 addition & 1 deletion components/dashboard/leeway.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Licensed under the GNU Affero General Public License (AGPL).
# See License.AGPL.txt in the project root for license information.

FROM cgr.dev/chainguard/wolfi-base:latest@sha256:74ba560a654f12586e0b8524097e00b326f9a6a9cd432a44ded9cad69a5a39c7 as compress
FROM cgr.dev/chainguard/wolfi-base:latest@sha256:d141305384203efd88710c735d71a3975371174ad882c181b5ce0bdb583615e6 as compress

RUN apk add brotli gzip

Expand Down
2 changes: 1 addition & 1 deletion components/dashboard/src/Login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export const Login: FC<LoginProps> = ({ onLoggedIn }) => {

const updateUser = useCallback(async () => {
await getGitpodService().reconnect();
const [user] = await Promise.all([getGitpodService().server.getLoggedInUser()]);
const user = await getGitpodService().server.getLoggedInUser();
setUser(user);
markLoggedIn();
}, [setUser]);
Expand Down
16 changes: 3 additions & 13 deletions components/dashboard/src/components/RepositoryFinder.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import { ReactComponent as RepositoryIcon } from "../icons/RepositoryWithColor.s
import { useSuggestedRepositories } from "../data/git-providers/suggested-repositories-query";
import { useFeatureFlag } from "../data/featureflag-query";
import { SuggestedRepository } from "@gitpod/gitpod-protocol";
import classNames from "classnames";
import { MiddleDot } from "./typography/MiddleDot";

// TODO: Remove this once we've fully enabled `includeProjectsOnCreateWorkspace`
Expand Down Expand Up @@ -157,14 +156,7 @@ export default function RepositoryFinder(props: RepositoryFinderProps) {
searchPlaceholder="Paste repository URL or type to find suggestions"
>
<DropDown2SelectedElement
// TODO: clean this up - have to use different icons to keep the right shade of gray when there's no project
icon={
selectedSuggestion?.projectId ? (
<RepositoryIcon className={classNames("w-8 h-8 text-orange-500")} />
) : (
RepositorySVG
)
}
icon={RepositorySVG}
htmlTitle={displayContextUrl(props.selectedContextURL) || "Repository"}
title={
<div className="truncate w-80">
Expand All @@ -178,7 +170,7 @@ export default function RepositoryFinder(props: RepositoryFinderProps) {
subtitle={
// Only show the url if we have a project or repo name, otherwise it's redundant w/ the title
selectedSuggestion?.projectName || selectedSuggestion?.repositoryName
? selectedSuggestion?.url
? displayContextUrl(selectedSuggestion?.url)
: undefined
}
loading={props.loading || isLoading}
Expand All @@ -199,9 +191,7 @@ const SuggestedRepositoryOption: FC<SuggestedRepositoryOptionProps> = ({ repo })
aria-label={`${repo.projectId ? "Project" : "Repo"}: ${repo.url}`}
>
<span className={"pr-2"}>
<RepositoryIcon
className={classNames("w-5 h-5 text-orange-500", !repo.projectId && "filter-grayscale")}
/>
<RepositoryIcon className={"w-5 h-5 text-gray-400"} />
</span>

{name && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

import { ErrorCodes } from "@gitpod/gitpod-protocol/lib/messaging/error";
import { QueryErrorResetBoundary } from "@tanstack/react-query";
import { QueryErrorResetBoundary, useQueryClient } from "@tanstack/react-query";
import { FC } from "react";
import { ErrorBoundary, FallbackProps } from "react-error-boundary";
import { hasLoggedInBefore, Login } from "../../Login";
Expand All @@ -28,11 +28,14 @@ export const QueryErrorBoundary: FC = ({ children }) => {

// This handles any expected errors, i.e. errors w/ a code that an api call produced
const ExpectedQueryErrorsFallback: FC<FallbackProps> = ({ error, resetErrorBoundary }) => {
const client = useQueryClient();
// adjust typing, as we may have caught an api error here w/ a code property
const caughtError = error as CaughtError;

// User needs to Login
if (caughtError.code === ErrorCodes.NOT_AUTHENTICATED) {
console.log("clearing query cache for unauthenticated user");
client.clear();
// Before we show a Login screen, check to see if we need to redirect to www site
// Redirects if it's the root, no user, and no gp cookie present (has logged in recently)
if (isGitpodIo() && window.location.pathname === "/" && window.location.hash === "") {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,18 @@ import { getGitpodService } from "../../service/service";
export const useSuggestedRepositories = () => {
const { data: org } = useCurrentOrg();

return useQuery(["suggested-repositories", { orgId: org?.id }], async () => {
if (!org) {
throw new Error("No org selected");
}
return useQuery(
["suggested-repositories", { orgId: org?.id }],
async () => {
if (!org) {
throw new Error("No org selected");
}

return await getGitpodService().server.getSuggestedRepositories(org.id);
});
return await getGitpodService().server.getSuggestedRepositories(org.id);
},
{
// Keeps data in cache for 24h - will still refresh though
cacheTime: 1000 * 60 * 60 * 24,
},
);
};
6 changes: 6 additions & 0 deletions components/dashboard/src/data/setup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ export function isNoPersistence(queryKey: QueryKey): boolean {

export const setupQueryClientProvider = () => {
const client = new QueryClient({
defaultOptions: {
queries: {
// Default stale time to help avoid re-fetching data too frequently
staleTime: 1000 * 5, // 5 seconds
},
},
queryCache: new QueryCache({
// log any errors our queries throw
onError: (error) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@

import { useQuery } from "@tanstack/react-query";
import { getGitpodService } from "../../service/service";
import { GetDefaultWorkspaceImageResult } from "@gitpod/gitpod-protocol";

export const useDefaultWorkspaceImageQuery = () => {
return useQuery<string>({
queryKey: ["default-workspace-image"],
export const useDefaultWorkspaceImageQuery = (workspaceId?: string) => {
return useQuery<GetDefaultWorkspaceImageResult>({
queryKey: ["default-workspace-image", { workspaceId }],
staleTime: 1000 * 60 * 10, // 10 minute
queryFn: async () => {
const image = await getGitpodService().server.getDefaultWorkspaceImage();
return image;
return await getGitpodService().server.getDefaultWorkspaceImage({ workspaceId });
},
});
};
64 changes: 33 additions & 31 deletions components/dashboard/src/menu/Menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,38 @@ const UserMenu: FC<UserMenuProps> = ({ user, className, withAdminLink, withFeedb
return items;
}, [onFeedback, user?.rolesOrPermissions, withAdminLink, withFeedbackLink]);

const menuEntries = useMemo(() => {
return [
{
title: (user && (User.getPrimaryEmail(user) || user?.name)) || "User",
customFontStyle: "text-gray-400",
separator: true,
},
{
title: "User Settings",
link: "/user/settings",
},
{
title: "Docs",
href: "https://www.gitpod.io/docs/",
target: "_blank",
rel: "noreferrer",
},
{
title: "Help",
href: "https://www.gitpod.io/support/",
target: "_blank",
rel: "noreferrer",
separator: true,
},
...extraSection,
{
title: "Log out",
href: gitpodHostUrl.asApiLogout().toString(),
},
];
}, [extraSection, user]);

return (
<div
className={classNames(
Expand All @@ -199,37 +231,7 @@ const UserMenu: FC<UserMenuProps> = ({ user, className, withAdminLink, withFeedb
)}
data-analytics='{"label":"Account"}'
>
<ContextMenu
menuEntries={[
{
title: (user && (User.getPrimaryEmail(user) || user?.name)) || "User",
customFontStyle: "text-gray-400",
separator: true,
},
{
title: "User Settings",
link: "/user/settings",
},
{
title: "Docs",
href: "https://www.gitpod.io/docs/",
target: "_blank",
rel: "noreferrer",
},
{
title: "Help",
href: "https://www.gitpod.io/support/",
target: "_blank",
rel: "noreferrer",
separator: true,
},
...extraSection,
{
title: "Log out",
href: gitpodHostUrl.asApiLogout().toString(),
},
]}
>
<ContextMenu menuEntries={menuEntries}>
<img className="rounded-full w-8 h-8" src={user?.avatarUrl || ""} alt={user?.name || "Anonymous"} />
</ContextMenu>
</div>
Expand Down
Loading

0 comments on commit b514391

Please sign in to comment.