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: add build check to ManagedEnvironment::{push,push_new} #832

Merged
merged 10 commits into from
Jan 25, 2024

Conversation

ysndr
Copy link
Contributor

@ysndr ysndr commented Jan 23, 2024

implements #825

@ysndr ysndr self-assigned this Jan 23, 2024
@@ -1198,6 +1199,11 @@ impl Push {
To rename your environment: 'flox edit --name <new name>'
To pull and manually re-apply your changes: 'flox delete && flox pull -r {owner}/{name}'
"}.into(),
ManagedEnvironmentError::Build(_) => formatdoc! {"
❌ Unable to push environment with compatibility errors on your system ({system}).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nonblocking product nit @ghudgins @jennymahmoudi: I don't think I would know as a user what compatibility errors means. And because we're suppressing the underlying error, I don't actually know what to do next. I can't start with flox edit; I'd actually have to flox activate to see the error, and then do flox activate && flox edit && flox push.

Also compatibility errors makes it sound like it's a system specific issue, but this is the same error I get if I do:

flox init
# edit the manifest and misspell a package name
flox push

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with the concerns reg. "compatibility".
The way its implemented now its ensuring that the environment can build on the current system.
I don't know if it becomes much clearer with the error present

(-v will show it FYI)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the AC calls to show both errors

And When the env fails to build
Then I see the failure from the build
And I see a message about push

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok to add the error in a somewhat raw form now (and later/soon use the prettyfied version)?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes - we'll redo the error in a future ticket #602

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also compatibility errors makes it sound like it's a system specific issue, but this is the same error I get if I do:

 flox init 
# edit the manifest and misspell a package name
flox push

Is this still a valid concern?
Can we have separate error messages for flox push due to system compatibility issues vs misspelled package names?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah it's still a concern. At the moment I don't think it would be very easy to have a different message, but we could come back to that when we re-work our errors. Until then I think it would be simplest to say Unable to push environment that doesn't build or whatever word we're currently using for build

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok I think it's fine to continue to use build since that's already being propagated through in the other error message.

Unable to push environment with build errors.

ManagedEnvironmentError::Build(_) => formatdoc! {"
❌ Unable to push environment with compatibility errors on your system ({system}).

{err}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The actual error still isn't getting printed:

ERROR: ❌  Unable to push environment with compatibility errors on your system (aarch64-darwin).

    could not build environment

    Use 'flox edit' to resolve errors, test with 'flox activate', and 'flox push' again.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well it is just not the helpful bits...
Fixing this tomorrow
Just wondering if we should display the entire chain or not just the root cause (esp. for these pkgdb ones).
Leaning towards the latter

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I bet we'll come back and change it anyways when we rework errors, so either's probably fine for now

ysndr and others added 2 commits January 24, 2024 12:19
Update cli/flox-rust-sdk/src/models/environment/managed_environment.rs

Co-authored-by: Matthew Kenigsberg <matthew@floxdev.com>
@ysndr ysndr force-pushed the feat/push/prevent-non-building branch from 10e2681 to 151c705 Compare January 24, 2024 11:19
@ysndr
Copy link
Contributor Author

ysndr commented Jan 24, 2024

@ysndr ysndr force-pushed the feat/push/prevent-non-building branch from 151c705 to 3dad968 Compare January 24, 2024 14:47
@ghudgins
Copy link
Contributor

looks good from my end. I see it now building

image

@ghudgins
Copy link
Contributor

the string isn't matching up yet

@mkenigs
Copy link
Contributor

mkenigs commented Jan 24, 2024

look like regressions form then upgrade to nixpkgs 23.11

I think it's actually a regression from this PR. Prior to this PR, the first time the environment was built was at the line:

  _PKGDB_GA_REGISTRY_REF_OR_REV="${PKGDB_NIXPKGS_REV_OLD?}" \
    "$FLOX_BIN" install hello

where _PKGDB_GA_REGISTRY_REF_OR_REV was set explicitly. Now that the environment is built during a push, the environment is built during the make_empty_remote_env call, at which point _PKGDB_GA_REGISTRY_REF_OR_REV is set to whatever it is throughout the test suite. I think something like:

 _PKGDB_GA_REGISTRY_REF_OR_REV="${PKGDB_NIXPKGS_REV_OLD?}" \
  make_empty_remote_env

should fix it.

Or you can invert all the OLD and NEW in the test since the suite-wide setting of _PKGDB_GA_REGISTRY_REF_OR_REV is to NEW

@ysndr
Copy link
Contributor Author

ysndr commented Jan 24, 2024

thanks, yes that makes sense, added the _PKGDB_GA_REGISTRY_REF_OR_REV="${PKGDB_NIXPKGS_REV_OLD?}" \ bit

@ysndr
Copy link
Contributor Author

ysndr commented Jan 24, 2024

@ghudgins moved the build error to the top (i guess that's what you were referring to?

@ysndr ysndr requested a review from mkenigs January 24, 2024 16:12
@ghudgins
Copy link
Contributor

when I ran it, it didn't match the AC. I would want to see the error from the build and then an error underneath about the push with this text.

 <<Build error goes here>>
 
 ERROR: ❌  Unable to push environment with compatibility errors on your system (aarch64-darwin). 
 
 Use `flox edit` to resolve errors, test with 'flox activate', and 'flox push' again.

@ysndr
Copy link
Contributor Author

ysndr commented Jan 24, 2024

I thought we had decided on "Unable to push environment with build errors."?

the build error is now above the other stuff

there is some formatting/indentation weirdness but that's going to be fixed with the bigger logging/error polish

@jennymahmoudi
Copy link
Contributor

@ysndr you're right. i just updated the AC on #825

@mkenigs mkenigs added this pull request to the merge queue Jan 25, 2024
Copy link
Contributor

@aakropotkin aakropotkin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Merged via the queue into main with commit 3d046ad Jan 25, 2024
15 checks passed
@mkenigs mkenigs deleted the feat/push/prevent-non-building branch January 25, 2024 15:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants