-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[docker-up] Auto-login dockerd if GITPOD_IMAGE_AUTH is set #20586
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
Changes from 5 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
60af6e5
[docker-up] Minor fixes and add tests
geropl 79f70a5
[image-builder-bob] Tests&fixes from an experimental PR
geropl 765c348
[supervisor, ws-manager] Write docker credentials into client config …
geropl e67be3f
[server] Introduce project.settings.enableDockerdAuthentication and e…
geropl 95b33e8
[dashboard] Add "Docker registry authentication" toggle under project…
geropl f885c5e
[server] Guard project.settings.enableDockerdAuthentication by org wr…
geropl ed278f9
review comments with cleanup + small fixes
geropl File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
83 changes: 83 additions & 0 deletions
83
components/dashboard/src/repositories/detail/variables/EnableDockerdAuthentication.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,83 @@ | ||
| /** | ||
| * Copyright (c) 2025 Gitpod GmbH. All rights reserved. | ||
| * Licensed under the GNU Affero General Public License (AGPL). | ||
| * See License.AGPL.txt in the project root for license information. | ||
| */ | ||
|
|
||
| import { SwitchInputField } from "@podkit/switch/Switch"; | ||
| import { Heading3, Subheading } from "@podkit/typography/Headings"; | ||
| import { FC, useCallback } from "react"; | ||
| import { InputField } from "../../../components/forms/InputField"; | ||
| import { useToast } from "../../../components/toasts/Toasts"; | ||
| import { useId } from "../../../hooks/useId"; | ||
| import { ConfigurationSettingsField } from "../ConfigurationSettingsField"; | ||
| import { Configuration } from "@gitpod/public-api/lib/gitpod/v1/configuration_pb"; | ||
| import { SquareArrowOutUpRight } from "lucide-react"; | ||
| import { useConfiguration, useConfigurationMutation } from "../../../data/configurations/configuration-queries"; | ||
| import Alert from "../../../components/Alert"; | ||
|
|
||
| type Props = { | ||
| configuration: Configuration; | ||
| }; | ||
| export const EnableDockerdAuthentication: FC<Props> = ({ configuration }) => { | ||
| const { data } = useConfiguration(configuration.id); | ||
| const configurationMutation = useConfigurationMutation(); | ||
| const { toast } = useToast(); | ||
|
|
||
| const updateEnableDockerdAuthentication = useCallback( | ||
| async (enable: boolean) => { | ||
| await configurationMutation.mutateAsync( | ||
| { | ||
| configurationId: configuration.id, | ||
| workspaceSettings: { | ||
| enableDockerdAuthentication: enable, | ||
| }, | ||
| }, | ||
| { | ||
| onError: (error) => { | ||
| toast(`Failed to update dockerd authentication: ${error.message}`); | ||
| }, | ||
| }, | ||
| ); | ||
| }, | ||
| [configurationMutation, configuration.id, toast], | ||
| ); | ||
|
|
||
| const inputId = useId({ prefix: "enable-dockerd-authentication" }); | ||
| const isEnabled = data?.workspaceSettings?.enableDockerdAuthentication; | ||
|
|
||
| return ( | ||
| <ConfigurationSettingsField> | ||
| <Heading3 className="flex flex-row items-center gap-2">Docker registry authentication</Heading3> | ||
| <Subheading className="max-w-lg flex flex-col gap-2"> | ||
| <span className="flex-1 text-left"> | ||
| Enable authentication with Docker registries inside of workspaces based on the{" "} | ||
| <code>GITPOD_IMAGE_AUTH</code> environment variable. | ||
| </span> | ||
|
|
||
| <Alert type={"warning"} closable={false} showIcon={true} className="flex rounded p-2 w-2/3 mb-2 w-full"> | ||
| By enabling this, credentials specified in <code>GITPOD_IMAGE_AUTH</code> will be visible inside all | ||
| workspaces on this project. | ||
| </Alert> | ||
| <a | ||
| className="gp-link flex flex-row items-center gap-1" | ||
| href="https://www.gitpod.io/docs/configure/repositories/environment-variables#docker-registry-authentication" | ||
| target="_blank" | ||
| rel="noreferrer" | ||
| > | ||
| Learn about using private Docker images with Gitpod | ||
| <SquareArrowOutUpRight size={12} /> | ||
| </a> | ||
| </Subheading> | ||
| <InputField id={inputId}> | ||
| <SwitchInputField | ||
| id={inputId} | ||
| checked={isEnabled} | ||
| disabled={configurationMutation.isLoading} | ||
| onCheckedChange={updateEnableDockerdAuthentication} | ||
| label={isEnabled ? "Auto-login enabled" : "Auto-login disabled"} | ||
| /> | ||
| </InputField> | ||
| </ConfigurationSettingsField> | ||
| ); | ||
| }; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.