-
Notifications
You must be signed in to change notification settings - Fork 13
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
Refactored requirement operation and added multi-target/multi-language compatibility #3487
Conversation
…requirement op runbit)
…d, and make ordering consistent
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.
At a high level this looks fine to me. Good job! Some small things to address before merging, though.
@@ -48,6 +48,7 @@ constants: | |||
scripts: | |||
- name: install-deps-dev | |||
language: bash | |||
standalone: true |
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.
I'm curious why this was added, and if this is needed for other activestate.yaml files with custom scripts.
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.
Because I find often while testing that it re-sources my runtime because I invoked it with another state tool version (ie. the one I'm working on vs my installed state tool). And end of the day none of our scripts actually require the runtime, they were always standalone, just never marked as such.
@@ -1145,23 +1083,25 @@ err_exec_recursion: | |||
To allow recursion, set [ACTIONABLE]{{.V1}}=true[/RESET] | |||
package_ingredient_alternatives: | |||
other: | | |||
No results found for search term "[NOTICE]{{.V0}}[/RESET]". Did you mean: | |||
No results found for search term {{.V0}}. Did you mean: |
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.
I think we should keep this quoted.
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.
It's still highlighted, but because it now takes multiple values it happens outside of the locale file:
names = append(names, fmt.Sprintf(`[ACTIONABLE]%s[/RESET]`, r.Requested.Name)) |
I'll mark similar comments as resolved, but if you want to iterate further on this we can do it via this comment (just to keep it simple).
} | ||
|
||
// Start runtime sourcing UI | ||
if !cfg.GetBool(constants.AsyncRuntimeConfig) { |
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.
I think we're handling this conditional inside runtime_runbit.Update()
, so you can remove it here.
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.
This was not intentional on my part, I think I copied this from the old code. But reading through it now I think it makes sense to retain it here. The comment in Update says that we still want the actual solving logic to run so we can raise errors. But that solving logic has already ran in this case when we created the commit. So solving it again in the async use-case wouldn't really give us any benefit.
I'll add a comment explaining as much.
@@ -169,6 +174,18 @@ func (n Namespace) String() string { | |||
return n.value | |||
} | |||
|
|||
func ParseNamespace(ns string) Namespace { |
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.
Nice, I've been hoping for a function like this for a while now.
pkg/platform/model/vcs.go
Outdated
@@ -204,21 +221,24 @@ func NewNamespacePlatform() Namespace { | |||
return Namespace{NamespacePlatform, "platform"} | |||
} | |||
|
|||
const OrgNamespacePrefix = "private/" | |||
|
|||
func NewOrgNamespace(orgName string) Namespace { |
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.
Nit: for consistency we should rename this NewNamespaceOrg()
to match the other functions.
cp = ts.Spawn("install", "djang") | ||
cp.Expect("No results found") | ||
cp.Expect("Did you mean") | ||
cp.Expect("language/python/djang") |
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.
Please double-check you mean to expect "djang" instead of "django".
test/integration/package_int_test.go
Outdated
cp.Expect(fmt.Sprintf("Operating on project %s/python3-pkgtest", user.Username)) | ||
cp.ExpectRe("(?:Package added|being built)", termtest.OptExpectTimeout(30*time.Second)) | ||
cp.Expect("Operating on project ActiveState-CLI/small-python") | ||
cp.Expect("Added: language/python/requests", e2e.RuntimeSourcingTimeoutOpt) |
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.
We have async runtimes enabled, so normally we don't need timeouts like this. Could you add a comment (perhaps top-level) explaining why we're using timeouts here? (Including the functions below.)
Based on the diff, it looks like we're expecting a long "resolving dependencies" window due to the Platform needing to build packages, but you wouldn't know that from looking at this code by itself.
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.
This was addressing solve times, not sourcing times. You're totally right for flagging this though. I've introduced a new RuntimeSolvingTimeoutOpt
.
test/integration/package_int_test.go
Outdated
func (suite *PackageIntegrationTestSuite) TestPackage_UninstallDoesNotExist() { | ||
suite.OnlyRunForTags(tagsuite.Package) | ||
|
||
ts := e2e.New(suite.T(), false) | ||
ts := e2e.New(suite.T(), true) |
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.
Did you mean to leave this change in place?
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.
Nope, great catch!
# Conflicts: # test/integration/package_int_test.go
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.
Looks good, but there are some test failures to address. Then it's good to go!
The only test failure appears to be a sporadic one unrelated to this PR. Gonna move on ahead. |
A lot went into this one. More than I had anticipated, but less than I would've liked.
Overall this focusses on trying to simplify and streamline the logic for installing and uninstalling packages. Similar to Mitchell's original PR this separates the install and uninstall actions. It also separates platform installs/uninstalls from requirement operations altogether, since platforms are not requirements. Finally, I turned this into a top level runner rather than a runbit, because there is no need for command centric runners as all the behaviour is already covered.
Summary of side-effects:
--revision
flag has been dropped.state install
now supports multiple operations. The only way to specify a revision would be to use buildscripts.--expand
flag tostate manifest
which will show requirements by their full namespace.state uninstall
(eg. multiple packages with the same name, but different namespace).