forked from GoogleCloudPlatform/scion
-
Notifications
You must be signed in to change notification settings - Fork 0
fix(antigravity): capture token from gnome-keyring when file path not written by AGY #288
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
Open
ptone
wants to merge
36
commits into
main
Choose a base branch
from
scion/antigravity-capture-keyring
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
fe4e5e8
Fix import progress streaming and pass names on single-template impor…
ptone 62d6274
Warn when server binary is built without web assets (#445)
ptone 9e59488
Sync built image reference back to Hub after scion build (#444)
ptone cc7645a
Tighten web channel default to actual web clients only (#448)
ptone 71749c1
fix(image-build): use default builder for local docker builds (#442)
subspacecoms c54f541
build(deps): bump astro from 6.3.2 to 6.4.8 in /docs-site (#438)
dependabot[bot] 0a50cd1
build(deps): bump dompurify from 3.4.9 to 3.4.11 in /web (#439)
dependabot[bot] f742260
build(deps): bump js-yaml from 4.1.1 to 4.2.0 in /docs-site (#440)
dependabot[bot] cf14257
build(deps): bump github.com/rclone/rclone from 1.73.5 to 1.74.3 (#441)
dependabot[bot] 3fa3291
Scion/harness journey p1 (#447)
ptone 6d52d6a
fix: pass Hub-hydrated harness-config path to harness.Resolve (#450)
ptone 4bea964
feat(web): harness-config detail delete, image section, and agent log…
ptone c7a6728
fix(hub): make skill version publish idempotent for draft versions (#…
ptone f46e291
feat(antigravity): use official install script for CLI installation (…
ptone 8456274
feat(config): add name field to harness-config config.yaml (#456)
ptone 1761f4c
fix(antigravity): use TARGETARCH build arg for multi-platform support…
ptone c0a1094
Scion/skill create ux p1 (#455)
ptone 8188237
Metrics dashboard improvements (#458)
ptone a1c6a1e
feat(web): add Capture Auth button to agent detail page (#459)
ptone 81c90c1
feat(antigravity): remove gnome-keyring, switch to file-based OAuth a…
ptone a6b4cbf
feat(antigravity): restore gnome-keyring to provision flow (#461)
ptone b62cef1
harness: skills: hand tune team-builder skill
ptone ac96d57
fix(antigravity): patch gcp settings block for oauth-token agents wit…
ptone 6b412ef
fix(build): use config.yaml image field to determine output image nam…
ptone 773e922
fix(build): use config.yaml image field to determine output image nam…
ptone aa8bbf5
fix(antigravity): read AGY_TOKEN from bind-mounted target path (#465)
ptone f2709db
Demonstration of agent-registry with lifecycle hooks
ptone d286d4c
fix(build): use config.yaml image field to determine output image nam…
ptone e90707e
fix(antigravity): read AGY_TOKEN from bind-mounted target path (#469)
ptone 7a3a24b
fix(antigravity): accept nested AGY token format with auth_method env…
ptone 4ce9921
skill-bank M5: address Gemini code review findings (#470)
ptone 0b470ab
fix(antigravity): capture token from gnome-keyring when file not writ…
ptone 1c3671a
Use backend instead of signed URLs for skill upload (#474)
ptone 55d739e
fix(antigravity): deduplicate capture-auth entries and treat "already…
ptone 225b036
fixes to metrics reporting
ptone 90d7e3f
fix(capture-auth): treat 'already exists' as successful capture
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
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
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,197 @@ | ||
| // Copyright 2026 Google LLC | ||
| // | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
|
|
||
| package cmd | ||
|
|
||
| import ( | ||
| "context" | ||
| "fmt" | ||
| "time" | ||
|
|
||
| "github.com/GoogleCloudPlatform/scion/pkg/config" | ||
| "github.com/GoogleCloudPlatform/scion/pkg/hubclient" | ||
| "github.com/spf13/cobra" | ||
| ) | ||
|
|
||
| var harnessConfigUpdateCmd = &cobra.Command{ | ||
| Use: "update [name]", | ||
| Short: "Re-import a harness-config from its source URL", | ||
| Long: `Re-imports a harness-config from its stored source URL, pulling the latest | ||
| version from the remote source. | ||
|
|
||
| If --url is provided, it overrides (and updates) the stored source URL. | ||
| Use --all to re-import all harness-configs that have a stored source URL. | ||
|
|
||
| Examples: | ||
| scion harness-config update my-claude | ||
| scion harness-config update my-claude --url https://github.com/org/repo/tree/main/harness-configs/claude | ||
| scion harness-config update --all`, | ||
| Args: cobra.MaximumNArgs(1), | ||
| RunE: runHarnessConfigUpdate, | ||
| } | ||
|
|
||
| func runHarnessConfigUpdate(cmd *cobra.Command, args []string) error { | ||
| urlOverride, _ := cmd.Flags().GetString("url") | ||
| all, _ := cmd.Flags().GetBool("all") | ||
|
|
||
| if len(args) == 0 && !all { | ||
| return fmt.Errorf("specify a harness-config name or use --all") | ||
| } | ||
| if all && urlOverride != "" { | ||
| return fmt.Errorf("--all and --url cannot be used together") | ||
| } | ||
|
|
||
| var gp string | ||
| if projectPath != "" { | ||
| resolved, err := config.GetResolvedProjectDir(projectPath) | ||
| if err != nil { | ||
| return fmt.Errorf("failed to resolve project path %q: %w", projectPath, err) | ||
| } | ||
| gp = resolved | ||
| } else if projectDir, err := config.GetResolvedProjectDir(""); err == nil { | ||
| gp = projectDir | ||
| } | ||
|
|
||
| hubCtx, err := CheckHubAvailabilityWithOptions(gp, true) | ||
| if err != nil { | ||
| return err | ||
| } | ||
| if hubCtx == nil { | ||
| return fmt.Errorf("Hub is not available. The update command requires a Hub connection.") | ||
| } | ||
|
|
||
| PrintUsingHub(hubCtx.Endpoint) | ||
|
|
||
| ctx, cancel := context.WithTimeout(cmd.Context(), 120*time.Second) | ||
| defer cancel() | ||
|
|
||
| if all { | ||
| return updateAllHarnessConfigs(ctx, hubCtx) | ||
| } | ||
|
|
||
| name := args[0] | ||
| return updateSingleHarnessConfig(ctx, hubCtx, name, urlOverride) | ||
| } | ||
|
|
||
| func updateSingleHarnessConfig(ctx context.Context, hubCtx *HubContext, name, urlOverride string) error { | ||
| resp, err := hubCtx.Client.HarnessConfigs().List(ctx, &hubclient.ListHarnessConfigsOptions{ | ||
| Name: name, | ||
| Status: "active", | ||
| }) | ||
| if err != nil { | ||
| return fmt.Errorf("failed to search Hub: %w", err) | ||
| } | ||
| if resp == nil { | ||
| return fmt.Errorf("harness-config %q not found on Hub", name) | ||
| } | ||
|
|
||
| var match *hubclient.HarnessConfig | ||
| for i := range resp.HarnessConfigs { | ||
| if resp.HarnessConfigs[i].Name == name || resp.HarnessConfigs[i].Slug == name { | ||
| match = &resp.HarnessConfigs[i] | ||
| break | ||
| } | ||
| } | ||
| if match == nil { | ||
| return fmt.Errorf("harness-config %q not found on Hub", name) | ||
| } | ||
|
|
||
| sourceURL := urlOverride | ||
| if sourceURL == "" { | ||
| sourceURL = match.SourceURL | ||
| } | ||
| if sourceURL == "" { | ||
| return fmt.Errorf("harness-config %q has no stored source URL. Use --url to specify one.", name) | ||
| } | ||
|
|
||
| if !isJSONOutput() { | ||
| fmt.Printf("Updating %q from %s...\n", name, sourceURL) | ||
| } | ||
|
|
||
| result, err := hubCtx.Client.HarnessConfigs().Reimport(ctx, match.ID, urlOverride) | ||
| if err != nil { | ||
| return fmt.Errorf("reimport failed: %w", err) | ||
| } | ||
| if result == nil { | ||
| return fmt.Errorf("reimport returned no result for %q", name) | ||
| } | ||
|
|
||
| if isJSONOutput() { | ||
| return outputJSON(ActionResult{ | ||
| Status: "success", | ||
| Command: "harness-config update", | ||
| Message: fmt.Sprintf("Updated %d harness-config(s)", result.Count), | ||
| Details: map[string]interface{}{ | ||
| "name": name, | ||
| "imported": result.HarnessConfigs, | ||
| "count": result.Count, | ||
| }, | ||
| }) | ||
| } | ||
|
|
||
| fmt.Printf("Updated %d harness-config(s): %v\n", result.Count, result.HarnessConfigs) | ||
| return nil | ||
| } | ||
|
|
||
| func updateAllHarnessConfigs(ctx context.Context, hubCtx *HubContext) error { | ||
| resp, err := hubCtx.Client.HarnessConfigs().List(ctx, &hubclient.ListHarnessConfigsOptions{ | ||
| Status: "active", | ||
| }) | ||
| if err != nil { | ||
| return fmt.Errorf("failed to list harness-configs: %w", err) | ||
| } | ||
| if resp == nil { | ||
| return fmt.Errorf("no harness-configs found") | ||
| } | ||
|
|
||
| var updated, skipped, failed int | ||
| jsonOut := isJSONOutput() | ||
| for _, hc := range resp.HarnessConfigs { | ||
| if hc.SourceURL == "" { | ||
| skipped++ | ||
| continue | ||
| } | ||
| if !jsonOut { | ||
| fmt.Printf("Updating %q from %s...\n", hc.Name, hc.SourceURL) | ||
| } | ||
| _, err := hubCtx.Client.HarnessConfigs().Reimport(ctx, hc.ID, "") | ||
| if err != nil { | ||
| if !jsonOut { | ||
| fmt.Printf(" Failed: %s\n", err) | ||
| } | ||
| failed++ | ||
| continue | ||
| } | ||
| if !jsonOut { | ||
| fmt.Printf(" Done.\n") | ||
| } | ||
| updated++ | ||
| } | ||
|
|
||
| if jsonOut { | ||
| return outputJSON(ActionResult{ | ||
| Status: "success", | ||
| Command: "harness-config update --all", | ||
| Message: fmt.Sprintf("Updated %d, skipped %d (no source URL), failed %d", updated, skipped, failed), | ||
| }) | ||
| } | ||
|
|
||
| fmt.Printf("\nUpdated %d, skipped %d (no source URL), failed %d\n", updated, skipped, failed) | ||
| return nil | ||
| } | ||
|
|
||
| func init() { | ||
| harnessConfigUpdateCmd.Flags().String("url", "", "Override the stored source URL") | ||
| harnessConfigUpdateCmd.Flags().Bool("all", false, "Update all harness-configs that have a stored source URL") | ||
| } | ||
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the image name contains a registry port but no tag (e.g.,
localhost:5001/my-image),strings.LastIndex(name, ":")will match the port's colon instead of a tag separator. This results in the image name being incorrectly truncated to just the registry host (e.g.,localhost).To prevent this, ensure that the matched colon appears after the last slash
/in the image path.