-
Notifications
You must be signed in to change notification settings - Fork 705
[Movey] Add command to upload metadata to Movey #227
Conversation
45658b8 to
b650483
Compare
sblackshear
left a comment
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.
Excited to see this, thanks for adding the CLI integration! Looks good to me overall, but requesting changes for some minor hygiene issues to improve maintainability.
10e9d1d to
aeef732
Compare
|
@sblackshear All issues were resolved, please check again. |
sblackshear
left a comment
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.
Thanks for your patience! Looking better, requesting changes for:
- Removing logic to bump Movey download counter (belongs in a separate PR)
- Refactoring for cleaner separation of test upload logic from "real" upload logic
be77239 to
629ef80
Compare
570cd26 to
62f645c
Compare
| use std::fs; | ||
| use toml_edit::easy::Value; | ||
|
|
||
| pub const MOVEY_CREDENTIAL_PATH: &str = "/movey_credential.toml"; |
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 PR partially overlaps with #226
For example the MOVEY_CREDENTIAL_PATH is already defined there in a different file and manipulating of movey_credential.toml is also at least partially duplicated which makes it difficult to review these side-by-side.
My suggestion is that you either make this PR into a stacked diff on top of #226 to refactor the code shared between the two or we simply land #226 first and you redo this one on top of HEAD. Please let me know what you'd prefer to do (and on my side I will try to act as quickly as I can on the subsequent changes).
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.
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.
Hi awelc, good to see you. Our goal is to get the service going so please merge #226 first and we will refactor #227 and #318 accordingly
I reviewed #226 but it still requires some work - that is why I offered an option of creating a stacked diff for your consideration. In particular, I don't think it will run on Windows which is important as a large portion of Move developers seems to work on Windows as indicated by our internal surveys (and we plan to enable Windows CI builds soon for the core Move repo).
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.
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.
In that case, we will look into #226 and make it Windows compatible, particularly with the location of the credential file. In the meantime, please merge #227 as that's the more important PR.
Both PRs suffer from similar problems (e.g., in terms of concatenating paths that in my opinion will not work on Windows), so neither can be merged right away. I did a review of #277, and we can reverse the order and try to land #277 first (and merge #266 on top of it later, trying to remove existing code duplication), but I will not be able to work on these any more tonight.
Also, I tried upload and tried to upload a package (https://github.com/MystenLabs/sui/tree/main/sui_programmability/examples/move_tutorial) and apparently it was uploaded successfully but I can't find it in Movey...
~/east-login-move/target/debug/move movey-upload
Your package has been successfully uploaded to Movey
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.
Thanks awelc, we will work on these and have them ready within today. It's Friday for us so we won't be able to response to you tomorrow.
About your uploaded package we believed you uploaded to staging instead of production.
It's here https://movey-app-staging.herokuapp.com/packages/MyFirstPackage
since we read from the move.toml file the package name won't be the same as your folder name.
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.
Thanks awelc, we will work on these and have them ready within today. It's Friday for us so we won't be able to response to you tomorrow.
Please make sure that it runs on Windows (I will try to re-test, but it would be good if you did it yourselves).
About your uploaded package we believed you uploaded to staging instead of production. It's here https://movey-app-staging.herokuapp.com/packages/MyFirstPackage since we read from the move.toml file the package name won't be the same as your folder name.
Does it mean that the data hard-coded in the source points to staging and will have to be changed in the future? I was a little worried about all this data being hard-coded and now I am worried even more...
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.
The movey credentials are here https://github.com/move-language/move/blob/62f645c4381848f42c4b03fc3a6d510d8a0263ff/language/move-command-line-common/src/movey_constants.rs
Since you are building under debug mode it defaulted to the staging endpoint. Under prod it will point to Movey.net so I don't think you need to be worried over hardcoded values.
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.
The movey credentials are here https://github.com/move-language/move/blob/62f645c4381848f42c4b03fc3a6d510d8a0263ff/language/move-command-line-common/src/movey_constants.rs Since you are building under debug mode it defaulted to the staging endpoint. Under prod it will point to Movey.net so I don't think you need to be worried over hardcoded values.
Cool, makes perfect sense! Thank you for the explanation!
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.
According to our tests, everything is working and up to date. Both PRs are designed to work independently. We will rebase once either is merged.
| use std::fs; | ||
| use toml_edit::easy::Value; | ||
|
|
||
| pub const MOVEY_CREDENTIAL_PATH: &str = "/movey_credential.toml"; |
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.
In that case, we will look into #226 and make it Windows compatible, particularly with the location of the credential file. In the meantime, please merge #227 as that's the more important PR.
Both PRs suffer from similar problems (e.g., in terms of concatenating paths that in my opinion will not work on Windows), so neither can be merged right away. I did a review of #277, and we can reverse the order and try to land #277 first (and merge #266 on top of it later, trying to remove existing code duplication), but I will not be able to work on these any more tonight.
Also, I tried upload and tried to upload a package (https://github.com/MystenLabs/sui/tree/main/sui_programmability/examples/move_tutorial) and apparently it was uploaded successfully but I can't find it in Movey...
~/east-login-move/target/debug/move movey-upload
Your package has been successfully uploaded to Movey
|
I have merged #226 and, as a result, this branch now has conflicts. While resolving these, please refactor Movey configuration file access routines so that the functionality to create/read the file (for both the login command and for the upload command are in the same place). |
# Conflicts: # Cargo.lock # language/tools/move-cli/Cargo.toml
# Conflicts: # Cargo.lock # language/tools/move-cli/tests/cli_tests.rs
# Conflicts: # Cargo.lock
# Conflicts: # language/tools/move-cli/tests/cli_tests.rs
# Conflicts: # language/tools/move-package/Cargo.toml # language/tools/move-package/src/resolution/resolution_graph.rs
# Conflicts: # language/tools/move-package/src/resolution/resolution_graph.rs
- MoveyUploadRequest: +subdir, -rev - Remove integration test of head commit id
- Add more integration test to Movey upload - Remove unused stub move packages - Upgrade `log` crate version - Add `httpmock` crate
9ed5de5 to
190f3a2
Compare
- change `init_server_mock` to `mock_movey_server_with_response_body_and_status_code` to be more inline with the comment - remove `// Copyright (c) The Diem Core Contributors`
awelc
left a comment
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 can still see code duplicated between movey_upload.rs and movey_login.rs and I don't see a good reason for it. Perhaps you could have both CLI commands use code in movey_credentials.rs (after some additional refactoring).
| use std::fs; | ||
| use toml_edit::easy::Value; | ||
|
|
||
| pub const MOVEY_CREDENTIAL_PATH: &str = "/movey_credential.toml"; |
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 constant is also defined in movey_login.rs.
| } | ||
|
|
||
| pub fn get_api_token(move_home: &str) -> Result<String> { | ||
| let credential_path = format!("{}{}", move_home, MOVEY_CREDENTIAL_PATH); |
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.
The code reading (or attempting to read the credentials file) is very similar to the one in movey_login.rs.
…ding credential file
awelc
left a comment
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! Thank you for your patience!
Motivation
Add
move movey-uploadcommand to upload move package to Movey, modifymove buildcommand to call Movey API to increase download count.How to use it
Before you use the new command to upload metadata to Movey, please make sure:
Note: you could use the
move logincommand from this PR to save your Movey's api token using the CLI.Step 1: Navigate to the folder containing your package.
Step 2: Run the following command:
move movey-uploadHave you read the Contributing Guidelines on pull requests?
Yes
Test Plan
cargo test --package move-cli --test cli_tests upload_package
cargo test --package move-cli --lib get_api_token