-
Notifications
You must be signed in to change notification settings - Fork 135
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* fix: reuse cloud connection for all operations in Toolkit * chore: isolate Init Process constants from state implementation * fix: error message for `secret()` function * chore: clean up dependencies to reduce binary size * feat(TKC-2844): add support for the `credential` function in expressions * feat(TKC-2844): add execution ID to credential request * feat(TKC-2844): handle fetching the credentials * feat(TKC-2844): allow any size of credentials * fix(TKC-2844): pass execution ID for the credentials request * feat(TKC-2844): obfuscate credentials in Test Workflows * chore: rename agent/client imports to agentclient
- Loading branch information
Showing
47 changed files
with
794 additions
and
355 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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,7 @@ | ||
package constants | ||
|
||
const ( | ||
CodeAborted uint8 = 137 | ||
CodeInputError uint8 = 155 | ||
CodeInternal uint8 = 190 | ||
) |
This file contains 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 @@ | ||
package constants | ||
|
||
const ( | ||
InitStepName = "tktw-init" | ||
) |
This file contains 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,15 @@ | ||
package constants | ||
|
||
import "path/filepath" | ||
|
||
const ( | ||
InternalPath = "/.tktw" | ||
TerminationLogPath = "/dev/termination-log" | ||
) | ||
|
||
var ( | ||
InternalBinPath = filepath.Join(InternalPath, "bin") | ||
InitPath = filepath.Join(InternalPath, "init") | ||
ToolkitPath = filepath.Join(InternalPath, "toolkit") | ||
StatePath = filepath.Join(InternalPath, "state") | ||
) |
This file contains 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 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,39 @@ | ||
package data | ||
|
||
import ( | ||
"context" | ||
"sync" | ||
|
||
"github.com/kubeshop/testkube/cmd/testworkflow-init/constants" | ||
"github.com/kubeshop/testkube/cmd/testworkflow-init/output" | ||
agentclient "github.com/kubeshop/testkube/pkg/agent/client" | ||
"github.com/kubeshop/testkube/pkg/cloud" | ||
"github.com/kubeshop/testkube/pkg/credentials" | ||
"github.com/kubeshop/testkube/pkg/log" | ||
) | ||
|
||
var ( | ||
cloudMu sync.Mutex | ||
cloudClient cloud.TestKubeCloudAPIClient | ||
) | ||
|
||
func CloudClient() cloud.TestKubeCloudAPIClient { | ||
cloudMu.Lock() | ||
defer cloudMu.Unlock() | ||
|
||
if cloudClient == nil { | ||
cfg := GetState().InternalConfig.Worker.Connection | ||
logger := log.NewSilent() | ||
grpcConn, err := agentclient.NewGRPCConnection(context.Background(), cfg.TlsInsecure, cfg.SkipVerify, cfg.Url, "", "", "", logger) | ||
if err != nil { | ||
output.ExitErrorf(constants.CodeInternal, "failed to connect with the Control Plane: %s", err.Error()) | ||
} | ||
cloudClient = cloud.NewTestKubeCloudAPIClient(grpcConn) | ||
} | ||
return cloudClient | ||
} | ||
|
||
func Credentials() credentials.CredentialRepository { | ||
cfg := GetState().InternalConfig | ||
return credentials.NewCredentialRepository(CloudClient(), cfg.Worker.Connection.ApiKey, cfg.Execution.Id) | ||
} |
This file contains 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 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 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.