-
Notifications
You must be signed in to change notification settings - Fork 12
✨ Stage-aware Hub token revocation, sandbox /tmp fix, and skill commit hygiene (#74) #86
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
savitharaghunathan
merged 7 commits into
konveyor:main
from
savitharaghunathan:token_revoc
Aug 4, 2026
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
6cbb67e
:sparkles: Stage-aware Hub token revocation in harness (#74)
savitharaghunathan 8f45db4
Fix /tmp volume, test scripts, and skill commit hygiene
savitharaghunathan 9df46f1
Add changelog fragments for #91 and #92
savitharaghunathan 28e6b7a
Extract tmpVolumeName constant to fix goconst lint
savitharaghunathan f7363a3
Address CodeRabbit review feedback
savitharaghunathan 0a68f0c
Address review feedback from djzager
savitharaghunathan faa6dd9
Clean up minor review findings
savitharaghunathan 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| kind: enhancement | ||
| description: > | ||
| Harness revokes its Hub API token on exit for standalone AgentRuns and | ||
| the last stage of an AgentWorkflowRun. Intermediate workflow stages | ||
| skip revocation so subsequent stages can reuse the shared token. Requires | ||
| Hub to inject HUB_TOKEN_ID alongside HUB_TOKEN in the run Secret. |
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,5 @@ | ||
| kind: bugfix | ||
| description: > | ||
| Mount an EmptyDir volume at /tmp in sandbox pods so tools can write | ||
| temp files at runtime. Removed stale chmod from Containerfile since | ||
| containerd overlay FS does not preserve image-layer permissions. |
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,5 @@ | ||
| kind: bugfix | ||
| description: > | ||
| Updated plan, execute, and verify skills to use targeted git add | ||
| instead of git add -A, preventing gitignored artifacts like | ||
| graphify-out/ from being committed to migration PRs. |
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
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 |
|---|---|---|
|
|
@@ -4,6 +4,8 @@ import ( | |
| "os" | ||
| "path/filepath" | ||
| "testing" | ||
|
|
||
| "github.com/konveyor/migration-harness/internal/config" | ||
| ) | ||
|
|
||
| func TestDiscoverSkills_NoSkills(t *testing.T) { | ||
|
|
@@ -69,3 +71,127 @@ func TestDiscoverSkills_EmptySkillFile(t *testing.T) { | |
| t.Errorf("expected 1 path (skill is mounted), got: %v", paths) | ||
| } | ||
| } | ||
|
|
||
| func TestShouldRevokeToken(t *testing.T) { | ||
| tests := []struct { | ||
| name string | ||
| hubTokenID string | ||
| workflowStage string | ||
| workflowStageCount string | ||
| want bool | ||
| }{ | ||
| { | ||
| name: "no token ID — skip revocation", | ||
| want: false, | ||
| }, | ||
| { | ||
| name: "standalone run — revoke", | ||
| hubTokenID: "1", | ||
| want: true, | ||
| }, | ||
| { | ||
| name: "last workflow stage — revoke", | ||
| hubTokenID: "1", | ||
| workflowStage: "3", | ||
| workflowStageCount: "3", | ||
| want: true, | ||
| }, | ||
| { | ||
| name: "intermediate workflow stage — skip", | ||
| hubTokenID: "1", | ||
| workflowStage: "1", | ||
| workflowStageCount: "3", | ||
| want: false, | ||
| }, | ||
| { | ||
| name: "first of two stages — skip", | ||
| hubTokenID: "1", | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: This test case is named "second of two stages" but sets |
||
| workflowStage: "1", | ||
| workflowStageCount: "2", | ||
| want: false, | ||
| }, | ||
| { | ||
| name: "single-stage workflow — revoke", | ||
| hubTokenID: "1", | ||
| workflowStage: "1", | ||
| workflowStageCount: "1", | ||
| want: true, | ||
| }, | ||
| { | ||
| name: "stage set but count missing — skip", | ||
| hubTokenID: "1", | ||
| workflowStage: "1", | ||
| workflowStageCount: "", | ||
| want: false, | ||
| }, | ||
| { | ||
| name: "count set but stage missing — skip", | ||
| hubTokenID: "1", | ||
| workflowStage: "", | ||
| workflowStageCount: "3", | ||
| want: false, | ||
| }, | ||
| { | ||
| name: "stage exceeds count — skip", | ||
| hubTokenID: "1", | ||
| workflowStage: "5", | ||
| workflowStageCount: "3", | ||
| want: false, | ||
| }, | ||
| { | ||
| name: "non-numeric stage — skip", | ||
| hubTokenID: "1", | ||
| workflowStage: "abc", | ||
| workflowStageCount: "3", | ||
| want: false, | ||
| }, | ||
| { | ||
| name: "non-numeric count — skip", | ||
| hubTokenID: "1", | ||
| workflowStage: "1", | ||
| workflowStageCount: "xyz", | ||
| want: false, | ||
| }, | ||
| { | ||
| name: "stage zero — skip", | ||
| hubTokenID: "1", | ||
| workflowStage: "0", | ||
| workflowStageCount: "3", | ||
| want: false, | ||
| }, | ||
| { | ||
| name: "equal non-numeric values — skip", | ||
| hubTokenID: "1", | ||
| workflowStage: "abc", | ||
| workflowStageCount: "abc", | ||
| want: false, | ||
| }, | ||
| { | ||
| name: "equal zero values — skip", | ||
| hubTokenID: "1", | ||
| workflowStage: "0", | ||
| workflowStageCount: "0", | ||
| want: false, | ||
| }, | ||
| { | ||
| name: "non-numeric token ID — skip", | ||
| hubTokenID: "abc", | ||
| workflowStage: "", | ||
| workflowStageCount: "", | ||
| want: false, | ||
| }, | ||
| } | ||
| for _, tt := range tests { | ||
| t.Run(tt.name, func(t *testing.T) { | ||
| cfg := &config.Config{ | ||
| HubTokenID: tt.hubTokenID, | ||
| WorkflowStage: tt.workflowStage, | ||
| WorkflowStageCount: tt.workflowStageCount, | ||
| } | ||
| _, got := shouldRevokeToken(cfg) | ||
| if got != tt.want { | ||
| t.Errorf("shouldRevokeToken() = %v, want %v", got, tt.want) | ||
| } | ||
| }) | ||
| } | ||
| } | ||
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.
Nit:
HubTokenIDis parsed inshouldRevokeTokenfor validation, then parsed again here with the error discarded. SinceshouldRevokeTokengates entry, this is safe, but you could avoid the double-parse by havingshouldRevokeTokenreturn the parsedtokenID(e.g.,shouldRevokeToken(cfg) (uint64, bool)).