Skip to content

Commit

Permalink
Merge branch 'main' into ft/focus-targets
Browse files Browse the repository at this point in the history
  • Loading branch information
filiptronicek authored Jun 23, 2023
2 parents c201542 + 41abfc1 commit 7ecc449
Show file tree
Hide file tree
Showing 50 changed files with 229 additions and 158 deletions.
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:490977f0fd3d8596d173839dbb314153797312553b43f6a24b0e341cf2e8d473
FROM cgr.dev/chainguard/wolfi-base:latest@sha256:5dcb7597e50978fc9dea77d96665bcd47ab0600386710c6e8dab35adf1102122

# Ensure latest packages are present, like security updates.
RUN apk upgrade --no-cache \
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:490977f0fd3d8596d173839dbb314153797312553b43f6a24b0e341cf2e8d473
FROM cgr.dev/chainguard/wolfi-base:latest@sha256:5dcb7597e50978fc9dea77d96665bcd47ab0600386710c6e8dab35adf1102122

# Ensure latest packages are present, like security updates.
RUN apk upgrade --no-cache \
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:490977f0fd3d8596d173839dbb314153797312553b43f6a24b0e341cf2e8d473 as compress
FROM cgr.dev/chainguard/wolfi-base:latest@sha256:5dcb7597e50978fc9dea77d96665bcd47ab0600386710c6e8dab35adf1102122 as compress

RUN apk add brotli gzip

Expand Down
12 changes: 5 additions & 7 deletions components/dashboard/src/components/InputWithCopy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,11 @@ export function InputWithCopy(props: { value: string; tip?: string; className?:
type="text"
value={props.value}
/>
<div className="cursor-pointer" onClick={() => handleCopyToClipboard(props.value)}>
<div className="absolute top-1/3 right-3">
<Tooltip content={copied ? "Copied" : tip}>
<img src={copy} alt="copy icon" title={tip} />
</Tooltip>
</div>
</div>
<button className="reset absolute top-1/3 right-3" onClick={() => handleCopyToClipboard(props.value)}>
<Tooltip content={copied ? "Copied" : tip}>
<img src={copy} alt="copy icon" title={tip} />
</Tooltip>
</button>
</div>
);
}
1 change: 1 addition & 0 deletions components/dashboard/src/data/featureflag-query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const featureFlags = {
enableDedicatedOnboardingFlow: false,
usageDownload: false,
phoneVerificationByCall: false,
doRetryUserLoader: true,
};

export const useFeatureFlag = (featureFlag: keyof typeof featureFlags) => {
Expand Down
14 changes: 12 additions & 2 deletions components/dashboard/src/hooks/use-user-loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,12 @@ import { trackLocation } from "../Analytics";
import { refreshSearchData } from "../components/RepositoryFinder";
import { useQuery } from "@tanstack/react-query";
import { noPersistence } from "../data/setup";
import { ErrorCodes } from "@gitpod/gitpod-protocol/lib/messaging/error";
import { useFeatureFlag } from "../data/featureflag-query";

export const useUserLoader = () => {
const { user, setUser } = useContext(UserContext);
const doRetryUserLoader = useFeatureFlag("doRetryUserLoader");

// For now, we're using the user context to store the user, but letting react-query handle the loading
// In the future, we should remove the user context and use react-query to access the user
Expand All @@ -27,8 +30,15 @@ export const useUserLoader = () => {
// We'll let an ErrorBoundary catch the error
useErrorBoundary: true,
// It's important we don't retry as we want to show the login screen as quickly as possible if a 401
// TODO: In the future we can consider retrying for non 401 errors
retry: false,
retry: (_failureCount: number, error: Error & { code?: number }) => {
if (!doRetryUserLoader) {
return false;
}
return error.code !== ErrorCodes.NOT_AUTHENTICATED;
},
// docs: https://tanstack.com/query/v4/docs/react/guides/query-retries
// backoff by doubling, max. 10s
retryDelay: (attemptIndex) => Math.min(1000 * 2 ** attemptIndex, 10000),
cacheTime: 1000 * 60 * 60 * 1, // 1 hour
staleTime: 1000 * 60 * 60 * 1, // 1 hour
onSuccess: (loadedUser) => {
Expand Down
5 changes: 5 additions & 0 deletions components/dashboard/src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@
button {
@apply cursor-pointer px-4 py-2 my-auto bg-green-600 dark:bg-green-700 hover:bg-green-700 dark:hover:bg-green-600 text-gray-100 dark:text-green-100 text-sm font-medium rounded-md focus:outline-none focus:ring transition ease-in-out;
}
button.reset {
@apply bg-transparent hover:bg-transparent font-normal rounded-none;
padding: unset;
text-align: start;
}
button.secondary {
@apply bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 text-gray-500 dark:text-gray-100 hover:text-gray-600;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,7 @@ export const GitIntegrationModal: FunctionComponent<Props> = (props) => {
const isNew = !savedProvider;

// This is a readonly value to copy and plug into external oauth config
const redirectURL = useMemo(() => {
let url = "";

// Once it's saved, use what's stored
if (!isNew) {
url = savedProvider?.oauth.callBackUrl ?? url;
} else {
// Otherwise construct it w/ their provided host value or example
url = callbackUrl(host || getPlaceholderForIntegrationType(type));
}

return url;
}, [host, isNew, savedProvider?.oauth.callBackUrl, type]);
const redirectURL = callbackUrl();

// "bitbucket.org" is set as host value whenever "Bitbucket" is selected
useEffect(() => {
Expand Down Expand Up @@ -281,13 +269,8 @@ export const GitIntegrationModal: FunctionComponent<Props> = (props) => {
);
};

const callbackUrl = (host: string) => {
// Negative Lookahead (?!\/)
// `\/` matches the character `/`
// "https://foobar:80".replace(/:(?!\/)/, "_")
// => 'https://foobar_80'
host = host.replace(/:(?!\/)/, "_");
const pathname = `/auth/${host}/callback`;
const callbackUrl = () => {
const pathname = `/auth/callback`;
return gitpodHostUrl.with({ pathname }).toString();
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ test("should update redirectURL preview", async () => {

const redirectURL = screen.getByLabelText(/Redirect/i);
// screen.debug(redirectURL);
expect((redirectURL as HTMLInputElement).value).toEqual("http://localhost/auth/gitlab.gitpod.io_80/callback");
expect((redirectURL as HTMLInputElement).value).toEqual("http://localhost/auth/callback");
});
12 changes: 3 additions & 9 deletions components/dashboard/src/user-settings/Integrations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -504,13 +504,8 @@ export function GitIntegrationModal(
onAuthorize?: (payload?: string) => void;
},
) {
const callbackUrl = (host: string) => {
// Negative Lookahead (?!\/)
// `\/` matches the character `/`
// "https://foobar:80".replace(/:(?!\/)/, "_")
// => 'https://foobar_80'
host = host.replace(/:(?!\/)/, "_");
const pathname = `/auth/${host}/callback`;
const callbackUrl = () => {
const pathname = `/auth/callback`;
return gitpodHostUrl.with({ pathname }).toString();
};

Expand All @@ -519,7 +514,7 @@ export function GitIntegrationModal(

const [type, setType] = useState<string>("GitLab");
const [host, setHost] = useState<string>("");
const [redirectURI, setRedirectURI] = useState<string>(callbackUrl("gitlab.example.com"));
const [redirectURI, setRedirectURI] = useState<string>(callbackUrl());
const [clientId, setClientId] = useState<string>("");
const [clientSecret, setClientSecret] = useState<string>("");
const [busy, setBusy] = useState<boolean>(false);
Expand Down Expand Up @@ -632,7 +627,6 @@ export function GitIntegrationModal(
}

setHost(newHostValue);
setRedirectURI(callbackUrl(newHostValue));
setErrorMessage(undefined);
}
};
Expand Down
2 changes: 1 addition & 1 deletion components/ee/agent-smith/leeway.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@



FROM cgr.dev/chainguard/wolfi-base:latest@sha256:490977f0fd3d8596d173839dbb314153797312553b43f6a24b0e341cf2e8d473
FROM cgr.dev/chainguard/wolfi-base:latest@sha256:5dcb7597e50978fc9dea77d96665bcd47ab0600386710c6e8dab35adf1102122

RUN apk add --no-cache git bash ca-certificates
COPY components-ee-agent-smith--app/agent-smith /app/
Expand Down
2 changes: 1 addition & 1 deletion components/ide-metrics/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:490977f0fd3d8596d173839dbb314153797312553b43f6a24b0e341cf2e8d473
FROM cgr.dev/chainguard/wolfi-base:latest@sha256:5dcb7597e50978fc9dea77d96665bcd47ab0600386710c6e8dab35adf1102122

# Ensure latest packages are present, like security updates.
RUN apk upgrade --no-cache \
Expand Down
2 changes: 1 addition & 1 deletion components/ide-proxy/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:490977f0fd3d8596d173839dbb314153797312553b43f6a24b0e341cf2e8d473 as compress
FROM cgr.dev/chainguard/wolfi-base:latest@sha256:5dcb7597e50978fc9dea77d96665bcd47ab0600386710c6e8dab35adf1102122 as compress

RUN apk add brotli gzip

Expand Down
2 changes: 1 addition & 1 deletion components/ide-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:490977f0fd3d8596d173839dbb314153797312553b43f6a24b0e341cf2e8d473
FROM cgr.dev/chainguard/wolfi-base:latest@sha256:5dcb7597e50978fc9dea77d96665bcd47ab0600386710c6e8dab35adf1102122

# Ensure latest packages are present, like security updates.
RUN apk upgrade --no-cache \
Expand Down
4 changes: 2 additions & 2 deletions components/ide/jetbrains/backend-plugin/leeway.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
# 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:490977f0fd3d8596d173839dbb314153797312553b43f6a24b0e341cf2e8d473 as base_builder
FROM cgr.dev/chainguard/wolfi-base:latest@sha256:5dcb7597e50978fc9dea77d96665bcd47ab0600386710c6e8dab35adf1102122 as base_builder
RUN mkdir /ide-desktop-plugins

# for debugging
# FROM cgr.dev/chainguard/wolfi-base:latest@sha256:490977f0fd3d8596d173839dbb314153797312553b43f6a24b0e341cf2e8d473
# FROM cgr.dev/chainguard/wolfi-base:latest@sha256:5dcb7597e50978fc9dea77d96665bcd47ab0600386710c6e8dab35adf1102122
FROM scratch
ARG JETBRAINS_BACKEND_QUALIFIER
# ensures right permissions for /ide-desktop-plugins
Expand Down
4 changes: 2 additions & 2 deletions components/ide/jetbrains/image/leeway.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
# 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:490977f0fd3d8596d173839dbb314153797312553b43f6a24b0e341cf2e8d473 as base_builder
FROM cgr.dev/chainguard/wolfi-base:latest@sha256:5dcb7597e50978fc9dea77d96665bcd47ab0600386710c6e8dab35adf1102122 as base_builder
RUN mkdir /ide-desktop

# for debugging
# FROM cgr.dev/chainguard/wolfi-base:latest@sha256:490977f0fd3d8596d173839dbb314153797312553b43f6a24b0e341cf2e8d473
# FROM cgr.dev/chainguard/wolfi-base:latest@sha256:5dcb7597e50978fc9dea77d96665bcd47ab0600386710c6e8dab35adf1102122
FROM scratch
ARG JETBRAINS_DOWNLOAD_QUALIFIER
ARG JETBRAINS_BACKEND_QUALIFIER
Expand Down
4 changes: 2 additions & 2 deletions components/ide/jetbrains/launcher/leeway.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
# 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:490977f0fd3d8596d173839dbb314153797312553b43f6a24b0e341cf2e8d473 as base_builder
FROM cgr.dev/chainguard/wolfi-base:latest@sha256:5dcb7597e50978fc9dea77d96665bcd47ab0600386710c6e8dab35adf1102122 as base_builder
RUN mkdir /ide-desktop

# for debugging
# FROM cgr.dev/chainguard/wolfi-base:latest@sha256:490977f0fd3d8596d173839dbb314153797312553b43f6a24b0e341cf2e8d473
# FROM cgr.dev/chainguard/wolfi-base:latest@sha256:5dcb7597e50978fc9dea77d96665bcd47ab0600386710c6e8dab35adf1102122
FROM scratch
ARG JETBRAINS_BACKEND_VERSION
# ensures right permissions for /ide-desktop
Expand Down
2 changes: 1 addition & 1 deletion components/image-builder-mk3/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:490977f0fd3d8596d173839dbb314153797312553b43f6a24b0e341cf2e8d473
FROM cgr.dev/chainguard/wolfi-base:latest@sha256:5dcb7597e50978fc9dea77d96665bcd47ab0600386710c6e8dab35adf1102122

# Ensure latest packages are present, like security updates.
RUN apk upgrade --no-cache \
Expand Down
2 changes: 1 addition & 1 deletion components/installation-telemetry/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:490977f0fd3d8596d173839dbb314153797312553b43f6a24b0e341cf2e8d473
FROM cgr.dev/chainguard/wolfi-base:latest@sha256:5dcb7597e50978fc9dea77d96665bcd47ab0600386710c6e8dab35adf1102122
COPY components-installation-telemetry--app/installation-telemetry /app/installation-telemetry
ENTRYPOINT [ "/app/installation-telemetry" ]
CMD [ "help" ]
2 changes: 1 addition & 1 deletion components/leeway.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
# 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:490977f0fd3d8596d173839dbb314153797312553b43f6a24b0e341cf2e8d473
FROM cgr.dev/chainguard/wolfi-base:latest@sha256:5dcb7597e50978fc9dea77d96665bcd47ab0600386710c6e8dab35adf1102122
COPY components--all-docker/versions.yaml components--all-docker/provenance-bundle.jsonl /
2 changes: 1 addition & 1 deletion components/local-app/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:490977f0fd3d8596d173839dbb314153797312553b43f6a24b0e341cf2e8d473
FROM cgr.dev/chainguard/wolfi-base:latest@sha256:5dcb7597e50978fc9dea77d96665bcd47ab0600386710c6e8dab35adf1102122

WORKDIR /app
COPY components-local-app--app/components-local-app--app-linux-amd64/local-app local-app-linux
Expand Down
2 changes: 1 addition & 1 deletion components/node-labeler/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:490977f0fd3d8596d173839dbb314153797312553b43f6a24b0e341cf2e8d473
FROM cgr.dev/chainguard/wolfi-base:latest@sha256:5dcb7597e50978fc9dea77d96665bcd47ab0600386710c6e8dab35adf1102122

COPY components-node-labeler--app/node-labeler /app/node-labeler

Expand Down
2 changes: 1 addition & 1 deletion components/openvsx-proxy/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:490977f0fd3d8596d173839dbb314153797312553b43f6a24b0e341cf2e8d473
FROM cgr.dev/chainguard/wolfi-base:latest@sha256:5dcb7597e50978fc9dea77d96665bcd47ab0600386710c6e8dab35adf1102122

# Ensure latest packages are present, like security updates.
RUN apk upgrade --no-cache \
Expand Down
2 changes: 1 addition & 1 deletion components/proxy/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ RUN xcaddy build v2.6.3 \
--with github.com/gitpod-io/gitpod/proxy/plugins/sshtunnel=/plugins/sshtunnel \
--with github.com/gitpod-io/gitpod/proxy/plugins/frontend_dev=/plugins/frontend_dev

FROM cgr.dev/chainguard/wolfi-base:latest@sha256:490977f0fd3d8596d173839dbb314153797312553b43f6a24b0e341cf2e8d473
FROM cgr.dev/chainguard/wolfi-base:latest@sha256:5dcb7597e50978fc9dea77d96665bcd47ab0600386710c6e8dab35adf1102122

# Ensure latest packages are present, like security updates.
RUN apk upgrade --no-cache \
Expand Down
7 changes: 7 additions & 0 deletions components/proxy/conf/Caddyfile
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,13 @@
}
}

# Internal configcat endpoint
:9547 {
handle /configcat* {
gitpod.configcat
}
}

# public-api
api.{$GITPOD_DOMAIN} {
log {
Expand Down
2 changes: 1 addition & 1 deletion components/public-api-server/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:490977f0fd3d8596d173839dbb314153797312553b43f6a24b0e341cf2e8d473
FROM cgr.dev/chainguard/wolfi-base:latest@sha256:5dcb7597e50978fc9dea77d96665bcd47ab0600386710c6e8dab35adf1102122

# Ensure latest packages are present, like security updates.
RUN apk upgrade --no-cache \
Expand Down
2 changes: 1 addition & 1 deletion components/registry-facade/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:490977f0fd3d8596d173839dbb314153797312553b43f6a24b0e341cf2e8d473
FROM cgr.dev/chainguard/wolfi-base:latest@sha256:5dcb7597e50978fc9dea77d96665bcd47ab0600386710c6e8dab35adf1102122

# Ensure latest packages are present, like security updates.
RUN apk upgrade --no-cache \
Expand Down
7 changes: 3 additions & 4 deletions components/server/src/auth/auth-provider-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ export class AuthProviderService {
}
const oauth: AuthProviderEntry["oauth"] = {
...urls,
callBackUrl: this.callbackUrl(host),
callBackUrl: this.callbackUrl(),
clientId: clientId!,
clientSecret: clientSecret!,
};
Expand Down Expand Up @@ -239,9 +239,8 @@ export class AuthProviderService {
}
}

protected callbackUrl = (host: string) => {
const safeHost = host.replace(":", "_");
const pathname = `/auth/${safeHost}/callback`;
protected callbackUrl = () => {
const pathname = `/auth/callback`;
return this.config.hostUrl.with({ pathname }).toString();
};

Expand Down
Loading

0 comments on commit 7ecc449

Please sign in to comment.