Repository navigation
fix(provider): keep local provider binaries on checksum mismatch #1804
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
Closed
Closed
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
221043f
fix(provider): keep local provider binaries on checksum mismatch
skevetter 1a5dbcc
fix(provider): recognize missing absolute manifest paths
skevetter 98a0da5
fix(provider): preserve startup error handling
skevetter 109222b
fix(provider): preserve source and process error semantics
skevetter 3525b9e
fix(provider): retain relative manifest resolution
skevetter 6f5c5f1
fix(provider): distinguish explicit manifest paths
skevetter a121cfa
fix(provider): report manifest filesystem errors
skevetter 1a7a274
fix(provider): protect local sources and agent secrets
skevetter e0f5a2b
fix(secrets): preserve structured logs during redaction
skevetter 815956e
fix(secrets): protect numeric values in multiline credentials
skevetter 0d7204f
fix(secrets): mask numeric strings in streamed logs
skevetter 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| package cmd | ||
|
|
||
| import ( | ||
| "fmt" | ||
| "io" | ||
| "os" | ||
| "testing" | ||
|
|
||
| "github.com/devsy-org/devsy/pkg/clierr" | ||
| "github.com/stretchr/testify/suite" | ||
| "golang.org/x/crypto/ssh" | ||
| ) | ||
|
|
||
| type ( | ||
| providerDiagnosticSuite struct{ suite.Suite } | ||
| diagnosticExit struct{ err error } | ||
| ) | ||
|
|
||
| func (e diagnosticExit) Error() string { return fmt.Sprintf("provider diagnostic: %v", e.err) } | ||
| func (e diagnosticExit) Unwrap() error { return e.err } | ||
| func (e diagnosticExit) AgentDiagnostic() string { return e.Error() } | ||
|
|
||
| func TestProviderDiagnosticSuite(t *testing.T) { suite.Run(t, new(providerDiagnosticSuite)) } | ||
|
|
||
| func (s *providerDiagnosticSuite) TestExitPreservesStatusAndDiagnostic() { | ||
| for _, machine := range []bool{false, true} { | ||
| s.Run(fmt.Sprintf("machine=%t", machine), func() { | ||
| reader, writer, err := os.Pipe() | ||
| s.Require().NoError(err) | ||
| old := os.Stderr | ||
| os.Stderr = writer | ||
| exit := &ssh.ExitError{} | ||
| code, ok := passthroughExitCode(diagnosticExit{err: exit}, machine) | ||
| os.Stderr = old | ||
| s.Require().NoError(writer.Close()) | ||
| output, err := io.ReadAll(reader) | ||
| s.Require().NoError(err) | ||
| s.Require().NoError(reader.Close()) | ||
| s.True(ok) | ||
| s.Equal(exit.ExitStatus(), code) | ||
| s.Contains(string(output), "provider diagnostic") | ||
| }) | ||
| } | ||
| } | ||
|
|
||
| func (s *providerDiagnosticSuite) TestExitCodeRetainsDiagnosticForClassifiedText() { | ||
| reader, writer, err := os.Pipe() | ||
| s.Require().NoError(err) | ||
| old := os.Stderr | ||
| os.Stderr = writer | ||
| exit := &ssh.ExitError{} | ||
| wrapped := diagnosticExit{err: fmt.Errorf("Cannot connect to the Docker daemon: %w", exit)} | ||
| code := exitCodeForError(wrapped, true) | ||
| os.Stderr = old | ||
| s.Require().NoError(writer.Close()) | ||
| output, err := io.ReadAll(reader) | ||
| s.Require().NoError(err) | ||
| s.Require().NoError(reader.Close()) | ||
| s.Equal(exit.ExitStatus(), code) | ||
| s.Contains(string(output), "Cannot connect to the Docker daemon") | ||
| } | ||
|
|
||
| func (s *providerDiagnosticSuite) TestClassifiedWrapperRetainsAgentDiagnostic() { | ||
| reader, writer, err := os.Pipe() | ||
| s.Require().NoError(err) | ||
| old := os.Stderr | ||
| os.Stderr = writer | ||
| exit := &ssh.ExitError{} | ||
| wrapped := clierr.WithContext( | ||
| diagnosticExit{err: fmt.Errorf("Cannot connect to the Docker daemon: %w", exit)}, | ||
| map[string]string{"run": "test"}, | ||
| ) | ||
| code := exitCodeForError(wrapped, true) | ||
| os.Stderr = old | ||
| s.Require().NoError(writer.Close()) | ||
| output, err := io.ReadAll(reader) | ||
| s.Require().NoError(err) | ||
| s.Require().NoError(reader.Close()) | ||
| s.Equal(exit.ExitStatus(), code) | ||
| s.Contains(string(output), "Cannot connect to the Docker daemon") | ||
| } |
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,27 @@ | ||
| package up | ||
|
|
||
| import ( | ||
| "testing" | ||
|
|
||
| "github.com/devsy-org/devsy/pkg/provider" | ||
| "github.com/stretchr/testify/suite" | ||
| ) | ||
|
|
||
| type agentSecretRedactionSuite struct{ suite.Suite } | ||
|
|
||
| func TestAgentSecretRedactionSuite(t *testing.T) { suite.Run(t, new(agentSecretRedactionSuite)) } | ||
| func (s *agentSecretRedactionSuite) TestResolvedSecretsAreRedacted() { | ||
| cmd := &UpCmd{CLIOptions: provider.CLIOptions{ | ||
| SecretsEnv: []string{"ENV=private-env-value"}, | ||
| SecretsMount: []string{"MOUNT=private-mount-value"}, | ||
| BuildSecrets: []string{"BUILD=private-build-value"}, | ||
| GitToken: &provider.GitToken{Token: "private-git-value"}, | ||
| }} | ||
| redactor := workspaceSecretRedactor(cmd) | ||
| values := []string{ | ||
| "private-env-value", "private-mount-value", "private-build-value", "private-git-value", | ||
| } | ||
| for _, value := range values { | ||
| s.Run(value, func() { s.NotContains(redactor.Redact("agent: "+value), value) }) | ||
| } | ||
| } |
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,29 @@ | ||
| package devcontainer | ||
|
|
||
| import ( | ||
| "testing" | ||
|
|
||
| "github.com/devsy-org/devsy/pkg/provider" | ||
| "github.com/stretchr/testify/suite" | ||
| ) | ||
|
|
||
| type setupSecretRedactionSuite struct{ suite.Suite } | ||
|
|
||
| func TestSetupSecretRedactionSuite(t *testing.T) { suite.Run(t, new(setupSecretRedactionSuite)) } | ||
| func (s *setupSecretRedactionSuite) TestResolvedSecretsAreRedacted() { | ||
| options := provider.CLIOptions{ | ||
| BuildSecrets: []string{"BUILD=private-build-value"}, | ||
| GitToken: &provider.GitToken{Token: "private-git-value"}, | ||
| } | ||
| redactor := setupSecretRedactor( | ||
| []string{"ENV=private-env-value"}, | ||
| []string{"MOUNT=private-mount-value"}, | ||
| options, | ||
| ) | ||
| values := []string{ | ||
| "private-env-value", "private-mount-value", "private-build-value", "private-git-value", | ||
| } | ||
| for _, value := range values { | ||
| s.Run(value, func() { s.NotContains(redactor.Redact("agent: "+value), value) }) | ||
| } | ||
| } |
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.
Script executed:
Repository: devsy-org/devsy
Length of output: 8020
Script executed:
Repository: devsy-org/devsy
Length of output: 19332
Script executed:
Repository: devsy-org/devsy
Length of output: 41125
Script executed:
Repository: devsy-org/devsy
Length of output: 10265
Script executed:
Repository: devsy-org/devsy
Length of output: 12008
Script executed:
Repository: devsy-org/devsy
Length of output: 1815
Script executed:
Repository: devsy-org/devsy
Length of output: 1497
Preserve error context when rendering agent diagnostics.
When workspace startup returns an SSH agent diagnostic, the new
CLIErrordrops the retained run ID and any hint. Both text and JSON output lose those fields. Preserve the classified error’s context and hint while retaining the diagnostic and SSH exit status.