Skip to content

Commit

Permalink
refactor: move user constants to container-engine-lib (#1665)
Browse files Browse the repository at this point in the history
## Description:
move user constants to container-engine-lib to make it accessible to the
other modules like the `apic server`

## Is this change user facing?
NO

## References (if applicable):
<!-- Add relevant Github Issues, Discord threads, or other helpful
information. -->
  • Loading branch information
leoporoli authored Oct 31, 2023
1 parent fdcd3d9 commit cbf1b6b
Show file tree
Hide file tree
Showing 15 changed files with 20 additions and 18 deletions.
2 changes: 1 addition & 1 deletion cli/cli/commands/analytics/analytics.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"github.com/kurtosis-tech/kurtosis/cli/cli/kurtosis_config"
"github.com/kurtosis-tech/kurtosis/cli/cli/kurtosis_config/resolved_config"
"github.com/kurtosis-tech/kurtosis/cli/cli/out"
"github.com/kurtosis-tech/kurtosis/cli/cli/user_support_constants"
"github.com/kurtosis-tech/kurtosis/container-engine-lib/lib/user_support_constants"
"github.com/kurtosis-tech/stacktrace"
"github.com/sirupsen/logrus"
)
Expand Down
2 changes: 1 addition & 1 deletion cli/cli/commands/discord/discord.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/kurtosis-tech/kurtosis/cli/cli/command_framework/lowlevel/flags"
"github.com/kurtosis-tech/kurtosis/cli/cli/command_str_consts"
"github.com/kurtosis-tech/kurtosis/cli/cli/helpers/multi_os_command_executor"
"github.com/kurtosis-tech/kurtosis/cli/cli/user_support_constants"
"github.com/kurtosis-tech/kurtosis/container-engine-lib/lib/user_support_constants"
"github.com/kurtosis-tech/stacktrace"
)

Expand Down
2 changes: 1 addition & 1 deletion cli/cli/commands/docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/kurtosis-tech/kurtosis/cli/cli/command_framework/lowlevel/args"
"github.com/kurtosis-tech/kurtosis/cli/cli/command_framework/lowlevel/flags"
"github.com/kurtosis-tech/kurtosis/cli/cli/command_str_consts"
"github.com/kurtosis-tech/kurtosis/cli/cli/user_support_constants"
"github.com/kurtosis-tech/kurtosis/container-engine-lib/lib/user_support_constants"
"github.com/kurtosis-tech/stacktrace"
"os/exec"
"runtime"
Expand Down
2 changes: 1 addition & 1 deletion cli/cli/commands/feedback/feedback.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/kurtosis-tech/kurtosis/cli/cli/command_framework/lowlevel/flags"
"github.com/kurtosis-tech/kurtosis/cli/cli/command_str_consts"
"github.com/kurtosis-tech/kurtosis/cli/cli/helpers/multi_os_command_executor"
"github.com/kurtosis-tech/kurtosis/cli/cli/user_support_constants"
"github.com/kurtosis-tech/kurtosis/container-engine-lib/lib/user_support_constants"
"github.com/kurtosis-tech/kurtosis/kurtosis_version"
"github.com/kurtosis-tech/stacktrace"
"net/url"
Expand Down
2 changes: 1 addition & 1 deletion cli/cli/commands/package/init_cmd/init_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/kurtosis-tech/kurtosis/cli/cli/command_framework/lowlevel/flags"
"github.com/kurtosis-tech/kurtosis/cli/cli/command_str_consts"
"github.com/kurtosis-tech/kurtosis/cli/cli/kurtosis_package"
"github.com/kurtosis-tech/kurtosis/cli/cli/user_support_constants"
"github.com/kurtosis-tech/kurtosis/container-engine-lib/lib/user_support_constants"
"github.com/kurtosis-tech/stacktrace"
"os"
)
Expand Down
2 changes: 1 addition & 1 deletion cli/cli/commands/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import (
"github.com/kurtosis-tech/kurtosis/cli/cli/helpers/logrus_log_levels"
"github.com/kurtosis-tech/kurtosis/cli/cli/helpers/user_send_metrics_election"
"github.com/kurtosis-tech/kurtosis/cli/cli/out"
"github.com/kurtosis-tech/kurtosis/cli/cli/user_support_constants"
"github.com/kurtosis-tech/kurtosis/container-engine-lib/lib/user_support_constants"
"github.com/kurtosis-tech/kurtosis/kurtosis_version"
"github.com/kurtosis-tech/stacktrace"
"github.com/sirupsen/logrus"
Expand Down
2 changes: 1 addition & 1 deletion cli/cli/commands/run/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"encoding/json"
"fmt"
"github.com/kurtosis-tech/kurtosis/container-engine-lib/lib/user_support_constants"
"io"
"net/http"
"net/url"
Expand Down Expand Up @@ -31,7 +32,6 @@ import (
"github.com/kurtosis-tech/kurtosis/cli/cli/commands/enclave/inspect"
"github.com/kurtosis-tech/kurtosis/cli/cli/helpers/output_printers"
"github.com/kurtosis-tech/kurtosis/cli/cli/helpers/portal_manager"
"github.com/kurtosis-tech/kurtosis/cli/cli/user_support_constants"
"github.com/kurtosis-tech/kurtosis/container-engine-lib/lib/backend_interface"
"github.com/kurtosis-tech/kurtosis/contexts-config-store/store"
metrics_client "github.com/kurtosis-tech/metrics-library/golang/lib/client"
Expand Down
2 changes: 1 addition & 1 deletion cli/cli/commands/service/logs/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import (
"github.com/kurtosis-tech/kurtosis/cli/cli/command_framework/lowlevel/flags"
"github.com/kurtosis-tech/kurtosis/cli/cli/command_str_consts"
"github.com/kurtosis-tech/kurtosis/cli/cli/out"
"github.com/kurtosis-tech/kurtosis/cli/cli/user_support_constants"
"github.com/kurtosis-tech/kurtosis/container-engine-lib/lib/backend_interface"
"github.com/kurtosis-tech/kurtosis/container-engine-lib/lib/user_support_constants"
metrics_client "github.com/kurtosis-tech/metrics-library/golang/lib/client"
"github.com/kurtosis-tech/stacktrace"
"github.com/sirupsen/logrus"
Expand Down
2 changes: 1 addition & 1 deletion cli/cli/commands/twitter/twitter.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/kurtosis-tech/kurtosis/cli/cli/command_framework/lowlevel/flags"
"github.com/kurtosis-tech/kurtosis/cli/cli/command_str_consts"
"github.com/kurtosis-tech/kurtosis/cli/cli/helpers/multi_os_command_executor"
"github.com/kurtosis-tech/kurtosis/cli/cli/user_support_constants"
"github.com/kurtosis-tech/kurtosis/container-engine-lib/lib/user_support_constants"
"github.com/kurtosis-tech/stacktrace"
)

Expand Down
2 changes: 1 addition & 1 deletion cli/cli/commands/web/web.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/kurtosis-tech/kurtosis/cli/cli/command_framework/lowlevel/flags"
"github.com/kurtosis-tech/kurtosis/cli/cli/command_str_consts"
"github.com/kurtosis-tech/kurtosis/cli/cli/helpers/multi_os_command_executor"
"github.com/kurtosis-tech/kurtosis/cli/cli/user_support_constants"
"github.com/kurtosis-tech/kurtosis/container-engine-lib/lib/user_support_constants"
"github.com/kurtosis-tech/kurtosis/contexts-config-store/store"
"github.com/kurtosis-tech/stacktrace"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
"github.com/kurtosis-tech/kurtosis/cli/cli/command_str_consts"
"github.com/kurtosis-tech/kurtosis/cli/cli/helpers/metrics_user_id_store"
"github.com/kurtosis-tech/kurtosis/cli/cli/kurtosis_config/resolved_config"
"github.com/kurtosis-tech/kurtosis/cli/cli/user_support_constants"
"github.com/kurtosis-tech/kurtosis/container-engine-lib/lib/backend_interface"
"github.com/kurtosis-tech/kurtosis/container-engine-lib/lib/user_support_constants"
"github.com/kurtosis-tech/kurtosis/engine/launcher/engine_server_launcher"
"github.com/kurtosis-tech/kurtosis/kurtosis_version"
"github.com/kurtosis-tech/stacktrace"
Expand Down
2 changes: 1 addition & 1 deletion cli/cli/kurtosis_config/kurtosis_config_initializer.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/kurtosis-tech/kurtosis/cli/cli/helpers/user_send_metrics_election"
"github.com/kurtosis-tech/kurtosis/cli/cli/helpers/user_send_metrics_election/user_metrics_election_event_backlog"
"github.com/kurtosis-tech/kurtosis/cli/cli/kurtosis_config/resolved_config"
"github.com/kurtosis-tech/kurtosis/cli/cli/user_support_constants"
"github.com/kurtosis-tech/kurtosis/container-engine-lib/lib/user_support_constants"
"github.com/kurtosis-tech/stacktrace"
"github.com/sirupsen/logrus"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const (
UpgradeCLIInstructionsPage = DocumentationUrl + "/install#upgrading"
MetricsPhilosophyDocs = DocumentationUrl + "/explanations/metrics-philosophy"
HowImportWorksLink = DocumentationUrl + "/explanations/how-do-kurtosis-imports-work"
PackageDocLink = DocumentationUrl + "/concepts-reference/packages"
GoogleRe2SyntaxDocumentation = "https://github.com/google/re2/wiki/Syntax"
KurtosisDiscordUrl = "https://discord.gg/6Jjp9c89z9"
KurtosisOnBoardCalendlyUrl = "https://calendly.com/d/zgt-f2c-66p/kurtosis-onboarding"
Expand Down Expand Up @@ -57,4 +58,5 @@ var urlsToValidateInTest = []string{
HowImportWorksLink,
KurtosisTechTwitterProfileLink,
KurtosisCloudLink,
PackageDocLink,
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"github.com/go-git/go-git/v5/plumbing"
"github.com/kurtosis-tech/kurtosis/api/golang/core/lib/shared_utils"
"github.com/kurtosis-tech/kurtosis/container-engine-lib/lib/database_accessors/enclave_db"
"github.com/kurtosis-tech/kurtosis/container-engine-lib/lib/user_support_constants"
"github.com/kurtosis-tech/kurtosis/core/server/api_container/server/startosis_engine/startosis_constants"
"github.com/kurtosis-tech/kurtosis/core/server/api_container/server/startosis_engine/startosis_errors"
"github.com/kurtosis-tech/kurtosis/core/server/commons/yaml_parser"
Expand Down Expand Up @@ -33,11 +34,10 @@ const (
defaultDepth = 1
// this gets us the entire history - useful for fetching commits on a repo
depthAssumingBranchTagsCommitsAreSpecified = 0
howImportWorksLink = "https://docs.kurtosis.com/explanations/how-do-kurtosis-imports-work"
filePathToKurtosisYamlNotFound = ""
replaceCountPackageDirWithGithubConstant = 1

packageDocLink = "https://docs.kurtosis.com/concepts-reference/packages"
filePathToKurtosisYamlNotFound = ""
replaceCountPackageDirWithGithubConstant = 1

osPathSeparatorString = string(os.PathSeparator)

onlyOneReplace = 1
Expand Down Expand Up @@ -78,7 +78,7 @@ func (provider *GitPackageContentProvider) GetKurtosisYaml(packageAbsolutePathOn
pathToKurtosisYaml := path.Join(packageAbsolutePathOnDisk, startosis_constants.KurtosisYamlName)
if _, err := os.Stat(pathToKurtosisYaml); err != nil {
return nil, startosis_errors.WrapWithInterpretationError(err, "Couldn't find a '%v' in the root of the package: '%v'. Packages are expected to have a '%v' at root; for more information have a look at %v",
startosis_constants.KurtosisYamlName, packageAbsolutePathOnDisk, startosis_constants.KurtosisYamlName, packageDocLink)
startosis_constants.KurtosisYamlName, packageAbsolutePathOnDisk, startosis_constants.KurtosisYamlName, user_support_constants.PackageDocLink)
}

kurtosisYaml, interpretationError := validateAndGetKurtosisYaml(pathToKurtosisYaml, provider.packagesDir)
Expand Down Expand Up @@ -125,7 +125,7 @@ func (provider *GitPackageContentProvider) GetOnDiskAbsoluteFilePath(absoluteFil
}

if maybeKurtosisYamlPath == filePathToKurtosisYamlNotFound {
return "", startosis_errors.NewInterpretationError("%v is not found in the path of '%v'; files can only be accessed from Kurtosis packages. For more information, go to: %v", startosis_constants.KurtosisYamlName, absoluteFileLocator, howImportWorksLink)
return "", startosis_errors.NewInterpretationError("%v is not found in the path of '%v'; files can only be accessed from Kurtosis packages. For more information, go to: %v", startosis_constants.KurtosisYamlName, absoluteFileLocator, user_support_constants.HowImportWorksLink)
}

if _, interpretationError = validateAndGetKurtosisYaml(maybeKurtosisYamlPath, provider.packagesDir); interpretationError != nil {
Expand Down

0 comments on commit cbf1b6b

Please sign in to comment.