-
Notifications
You must be signed in to change notification settings - Fork 58
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
feat: allow custom engine, core, files images #2454
base: main
Are you sure you want to change the base?
Changes from all commits
c635ca7
2fa30d8
423e581
d2406b2
72461af
ac19d7c
b2ed037
b81067b
ccd1d10
51747f5
67c61a6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -20,11 +20,13 @@ import ( | |||||
|
||||||
const ( | ||||||
engineVersionFlagKey = "version" | ||||||
engineAuthorFlagKey = "author" | ||||||
logLevelFlagKey = "log-level" | ||||||
enclavePoolSizeFlagKey = "enclave-pool-size" | ||||||
githubAuthTokenOverrideFlagKey = "github-auth-token" | ||||||
|
||||||
defaultEngineVersion = "" | ||||||
defaultEngineAuthor = "kurtosistech" | ||||||
kurtosisTechEngineImagePrefix = "kurtosistech/engine" | ||||||
imageVersionDelimiter = ":" | ||||||
|
||||||
|
@@ -45,6 +47,13 @@ var StartCmd = &lowlevel.LowlevelKurtosisCommand{ | |||||
Type: flags.FlagType_String, | ||||||
Default: defaultEngineVersion, | ||||||
}, | ||||||
{ | ||||||
Key: engineAuthorFlagKey, | ||||||
Usage: "The author (Docker username) of the Kurtosis engine that should be started (blank will start the kurtosistech version)", | ||||||
Shorthand: "", | ||||||
Type: flags.FlagType_String, | ||||||
Default: defaultEngineAuthor, | ||||||
}, | ||||||
{ | ||||||
Key: logLevelFlagKey, | ||||||
Usage: fmt.Sprintf( | ||||||
|
@@ -138,16 +147,30 @@ func run(_ context.Context, flags *flags.ParsedFlags, _ *args.ParsedArgs) error | |||||
return stacktrace.Propagate(err, "Expected a value for the '%v' flag but failed to get it", restartAPIContainersFlagKey) | ||||||
} | ||||||
|
||||||
engineAuthor, err := flags.GetString(engineAuthorFlagKey) | ||||||
if err != nil { | ||||||
return stacktrace.Propagate(err, "Expected a value for the '%v' flag but failed to get it", engineAuthorFlagKey) | ||||||
} | ||||||
|
||||||
if engineAuthor != defaultEngineAuthor && engineVersion == defaultEngineVersion { | ||||||
return stacktrace.NewError("Expected '%v' to be set as '%v' was set. Need to enter a custom engine veresion if a custom engine author is set", engineVersionFlagKey, engineAuthorFlagKey) | ||||||
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.
Suggested change
|
||||||
} | ||||||
|
||||||
imageForLogging := kurtosisTechEngineImagePrefix | ||||||
if engineAuthor != defaultEngineAuthor { | ||||||
imageForLogging = strings.Replace(imageForLogging, defaultEngineAuthor, engineAuthor, 1) | ||||||
} | ||||||
|
||||||
if engineVersion == defaultEngineVersion && isDebugMode { | ||||||
engineDebugVersion := fmt.Sprintf("%s-%s", kurtosis_version.KurtosisVersion, defaults.DefaultKurtosisContainerDebugImageNameSuffix) | ||||||
logrus.Infof("Starting Kurtosis engine in debug mode from image '%v%v%v'...", kurtosisTechEngineImagePrefix, imageVersionDelimiter, engineDebugVersion) | ||||||
_, engineClientCloseFunc, startEngineErr = engineManager.StartEngineIdempotentlyWithCustomVersion(ctx, engineDebugVersion, logLevel, enclavePoolSize, true, githubAuthTokenOverride, shouldRestartAPIContainers) | ||||||
logrus.Infof("Starting Kurtosis engine in debug mode from image '%v%v%v'...", imageForLogging, imageVersionDelimiter, engineDebugVersion) | ||||||
_, engineClientCloseFunc, startEngineErr = engineManager.StartEngineIdempotentlyWithCustomVersion(ctx, engineDebugVersion, engineAuthor, logLevel, enclavePoolSize, true, githubAuthTokenOverride, shouldRestartAPIContainers) | ||||||
} else if engineVersion == defaultEngineVersion { | ||||||
logrus.Infof("Starting Kurtosis engine from image '%v%v%v'...", kurtosisTechEngineImagePrefix, imageVersionDelimiter, kurtosis_version.KurtosisVersion) | ||||||
logrus.Infof("Starting Kurtosis engine from image '%v%v%v'...", imageForLogging, imageVersionDelimiter, kurtosis_version.KurtosisVersion) | ||||||
_, engineClientCloseFunc, startEngineErr = engineManager.StartEngineIdempotentlyWithDefaultVersion(ctx, logLevel, enclavePoolSize, githubAuthTokenOverride, shouldRestartAPIContainers) | ||||||
} else { | ||||||
logrus.Infof("Starting Kurtosis engine from image '%v%v%v'...", kurtosisTechEngineImagePrefix, imageVersionDelimiter, engineVersion) | ||||||
_, engineClientCloseFunc, startEngineErr = engineManager.StartEngineIdempotentlyWithCustomVersion(ctx, engineVersion, logLevel, enclavePoolSize, defaults.DefaultEnableDebugMode, githubAuthTokenOverride, shouldRestartAPIContainers) | ||||||
logrus.Infof("Starting Kurtosis engine from image '%v%v%v'...", imageForLogging, imageVersionDelimiter, engineVersion) | ||||||
_, engineClientCloseFunc, startEngineErr = engineManager.StartEngineIdempotentlyWithCustomVersion(ctx, engineVersion, engineAuthor, logLevel, enclavePoolSize, defaults.DefaultEnableDebugMode, githubAuthTokenOverride, shouldRestartAPIContainers) | ||||||
} | ||||||
if startEngineErr != nil { | ||||||
return stacktrace.Propagate(startEngineErr, "An error occurred starting the Kurtosis engine") | ||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,7 @@ import ( | |
|
||
const ( | ||
defaultEngineVersion = "" | ||
defaultEngineAuthor = "kurtosistech" | ||
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. can we move this to this package: 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. now I wonder if this value shouldn't be in the launcher and an empty string makes the launcher use the default value. WDYT? |
||
restartEngineOnSameVersionIfAnyRunning = true | ||
) | ||
|
||
|
@@ -71,7 +72,7 @@ func RestartEngineAfterGitHubAuth(ctx context.Context) error { | |
var engineClientCloseFunc func() error | ||
var restartEngineErr error | ||
dontRestartAPIContainers := false | ||
_, engineClientCloseFunc, restartEngineErr = engineManager.RestartEngineIdempotently(ctx, defaults.DefaultEngineLogLevel, defaultEngineVersion, restartEngineOnSameVersionIfAnyRunning, defaults.DefaultEngineEnclavePoolSize, defaults.DefaultEnableDebugMode, defaults.DefaultGitHubAuthTokenOverride, dontRestartAPIContainers) | ||
_, engineClientCloseFunc, restartEngineErr = engineManager.RestartEngineIdempotently(ctx, defaults.DefaultEngineLogLevel, defaultEngineVersion, defaultEngineAuthor, restartEngineOnSameVersionIfAnyRunning, defaults.DefaultEngineEnclavePoolSize, defaults.DefaultEnableDebugMode, defaults.DefaultGitHubAuthTokenOverride, dontRestartAPIContainers) | ||
if restartEngineErr != nil { | ||
return stacktrace.Propagate(restartEngineErr, "An error occurred restarting the Kurtosis engine") | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -151,4 +151,6 @@ var ( | |
testTolerationSeconds = int64(64) | ||
|
||
testFilesToBeMoved = "test.txt" | ||
|
||
testImageAuthor = "kurtosistech" | ||
) |
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.