Skip to content
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!: impl dependency list flag #2543

Merged
merged 33 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
aba722a
start dependency list
tedim52 Aug 23, 2024
507ef13
add images and package dependencies to plan yaml
tedim52 Aug 30, 2024
546c1c9
hook up to cli
tedim52 Aug 30, 2024
8df95e7
add get starlark plan yaml to api
tedim52 Aug 30, 2024
d0bba73
update tests
tedim52 Aug 30, 2024
3831674
make imgs unique and sort
tedim52 Aug 30, 2024
725cf84
Merge branch 'main' into tedi/dependencylist
tedim52 Aug 30, 2024
65da4ab
refactor plan yaml
tedim52 Aug 30, 2024
b712fe8
only add module prefix and dont add parent package
tedim52 Aug 30, 2024
c1cd1fc
maybe parse yaml
tedim52 Aug 30, 2024
554b754
pull dependencies locally
tedim52 Sep 11, 2024
18c2591
fix cloning pkgs
tedim52 Sep 12, 2024
7e56e5b
replace magic vlues
tedim52 Sep 12, 2024
24bbebb
exhaust struct
tedim52 Sep 12, 2024
09e90ee
Merge branch 'main' into tedi/dependencylist
tedim52 Oct 17, 2024
070fa60
Merge branch 'main' into tedi/dependencylist
tedim52 Nov 14, 2024
f5d4014
start addressing comments
tedim52 Nov 14, 2024
db66969
remove dependencies only flag
tedim52 Nov 15, 2024
ec6e9af
rename test file
tedim52 Nov 20, 2024
5121860
typo
tedim52 Nov 20, 2024
294c325
remove add images
tedim52 Nov 20, 2024
6b489ca
clarify get module prefix
tedim52 Nov 20, 2024
807de9b
finish addressing comments
tedim52 Nov 20, 2024
0a0c10b
account for official imgs
tedim52 Nov 20, 2024
f7e5d9d
regen proto to remove dependencies only
tedim52 Nov 20, 2024
3de186f
change location of err handle
tedim52 Nov 20, 2024
a938a40
use work dir for kurt yml check
tedim52 Nov 20, 2024
57ab266
remove extra colon
tedim52 Nov 20, 2024
c2ce7f4
lint
tedim52 Nov 20, 2024
dcb43e1
change docker auth err to warn logs
tedim52 Nov 20, 2024
8f763bd
Merge branch 'main' into tedi/dependencylist
tedim52 Nov 20, 2024
18de25e
pull local package
tedim52 Nov 25, 2024
9820014
undo breaking change
tedim52 Nov 25, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
clarify get module prefix
  • Loading branch information
tedim52 committed Nov 20, 2024
commit 6b489ca26c0bcc779b990a770166aead63787bf1
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"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/api_container/server/startosis_engine/startosis_packages"
"github.com/kurtosis-tech/kurtosis/core/server/api_container/server/startosis_engine/startosis_packages/git_package_content_provider"
"github.com/sirupsen/logrus"
"go.starlark.net/resolve"
"go.starlark.net/starlark"
Expand Down Expand Up @@ -392,13 +393,13 @@ func (interpreter *StartosisInterpreter) buildBindings(
}

const (
moduleIdSeperator = "/"
numModuleIdSeparators = 4
prefixNum = 3
numModIdSeparators = 3
)

// gets the prefix of a module id
// eg. "github.com/kurtosis-tech/postgres-package/main.star" returns "github.com/kurtosis-tech/postgres-package"
func getModulePrefix(moduleId string) string {
tedim52 marked this conversation as resolved.
Show resolved Hide resolved
return strings.Join(strings.SplitN(moduleId, moduleIdSeperator, numModuleIdSeparators)[:prefixNum], moduleIdSeperator)
return strings.Join(strings.SplitN(moduleId, git_package_content_provider.OsPathSeparatorString, numModIdSeparators+1)[:numModIdSeparators], git_package_content_provider.OsPathSeparatorString)
}

func findFirstEqualInstructionPastIndex(currentEnclaveInstructionsList []*enclave_plan_persistence.EnclavePlanInstruction, naiveInstructionsList []*instructions_plan.ScheduledInstruction, minIndex int) int {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const (
filePathToKurtosisOrComposeYamlNotFound = ""
replaceCountPackageDirWithGithubConstant = 1

osPathSeparatorString = string(os.PathSeparator)
OsPathSeparatorString = string(os.PathSeparator)

onlyOneReplace = 1

Expand Down Expand Up @@ -549,8 +549,8 @@ func validatePackageNameMatchesKurtosisYamlLocation(kurtosisYaml *yaml_parser.Ku
packageNameFromAbsPackagePath := strings.Replace(absPathToKurtosisYmlInThePackage, packageDir, shared_utils.GithubDomainPrefix, replaceCountPackageDirWithGithubConstant)
packageName := kurtosisYaml.GetPackageName()

if strings.HasSuffix(packageName, osPathSeparatorString) {
return startosis_errors.NewInterpretationError("Kurtosis package name cannot have trailing %q; package name: %v and kurtosis.yml is found at: %v", osPathSeparatorString, packageName, packageNameFromAbsPackagePath)
if strings.HasSuffix(packageName, OsPathSeparatorString) {
return startosis_errors.NewInterpretationError("Kurtosis package name cannot have trailing %q; package name: %v and kurtosis.yml is found at: %v", OsPathSeparatorString, packageName, packageNameFromAbsPackagePath)
}

// re-using ParseGitURL with packageName found from kurtosis.yml as it already does some validations
Expand Down Expand Up @@ -592,8 +592,8 @@ func getKurtosisOrComposeYamlPathForFileUrlInternal(absPathToFile string, packag
return filePathToKurtosisOrComposeYamlNotFound, startosis_errors.NewInterpretationError("Absolute path to file: %v must start with following prefix %v", absPathToFile, packagesDir)
}

removeTrailingPathSeparator := strings.Trim(beginSearchForKurtosisYamlFromRepo, osPathSeparatorString)
dirs := strings.Split(removeTrailingPathSeparator, osPathSeparatorString)
removeTrailingPathSeparator := strings.Trim(beginSearchForKurtosisYamlFromRepo, OsPathSeparatorString)
dirs := strings.Split(removeTrailingPathSeparator, OsPathSeparatorString)
logrus.Debugf("Found directories: %v", dirs)

var validYamlFilenames []string
Expand All @@ -619,7 +619,7 @@ func getKurtosisOrComposeYamlPathForFileUrlInternal(absPathToFile string, packag
}

func isLocalDependencyReplace(replace string) bool {
if strings.HasPrefix(replace, osPathSeparatorString) || strings.HasPrefix(replace, dotRelativePathIndicatorString) {
if strings.HasPrefix(replace, OsPathSeparatorString) || strings.HasPrefix(replace, dotRelativePathIndicatorString) {
return true
}
return false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const (
)

func isLocalLocator(locator string) bool {
if strings.HasPrefix(locator, osPathSeparatorString) || strings.HasPrefix(locator, dotRelativePathIndicatorString) {
if strings.HasPrefix(locator, OsPathSeparatorString) || strings.HasPrefix(locator, dotRelativePathIndicatorString) {
return true
}
return false
Expand Down