Skip to content
This repository was archived by the owner on May 4, 2024. It is now read-only.

Conversation

@ea-open-source
Copy link
Contributor

@ea-open-source ea-open-source commented Jun 27, 2022

Motivation

Add move movey-upload command to upload move package to Movey, modify move build command 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:

  • your package must be on Github
  • the remote must be named “origin”
  • file $HOME/.move/movey_credential.toml must exist, and the content should be like(you can get the token on Movey):
[registry]
token = "example-token"

Note: you could use the move login command 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-upload

Have 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

@ea-open-source ea-open-source force-pushed the features/upload-command branch 3 times, most recently from 45658b8 to b650483 Compare July 7, 2022 12:53
@ea-open-source
Copy link
Contributor Author

wrwg, awelc, damirka
Would you guys help us with rerunning Actions and review? We have already contacted Sam and Todd.

Copy link
Member

@sblackshear sblackshear left a 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.

@ea-open-source ea-open-source force-pushed the features/upload-command branch from 10e9d1d to aeef732 Compare July 13, 2022 16:09
@ea-open-source
Copy link
Contributor Author

@sblackshear All issues were resolved, please check again.

Copy link
Member

@sblackshear sblackshear left a 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

@ea-open-source ea-open-source changed the title Add command to upload metadata to Movey [Movey] Add command to upload metadata to Movey Jul 18, 2022
@ea-open-source ea-open-source force-pushed the features/upload-command branch from be77239 to 629ef80 Compare July 28, 2022 02:08
@ea-open-source ea-open-source force-pushed the features/upload-command branch from 570cd26 to 62f645c Compare August 2, 2022 10:57
@ea-open-source
Copy link
Contributor Author

Hi Sam, we have updated all 3 of our PRs(#226, #227, #318). Please give them another round of review.

@awelc awelc self-assigned this Aug 3, 2022
@awelc
Copy link
Collaborator

awelc commented Aug 3, 2022

Hi Sam, we have updated all 3 of our PRs(#226, #227, #318). Please give them another round of review.

I reassigned these to myself and will re-review shortly.

use std::fs;
use toml_edit::easy::Value;

pub const MOVEY_CREDENTIAL_PATH: &str = "/movey_credential.toml";
Copy link
Collaborator

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).

Copy link
Contributor Author

@ea-open-source ea-open-source Aug 5, 2022

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.

Copy link
Collaborator

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).

Copy link
Contributor Author

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.

Copy link
Collaborator

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

Copy link
Contributor Author

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.

Copy link
Collaborator

@awelc awelc Aug 5, 2022

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...

Copy link
Contributor Author

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.

Copy link
Collaborator

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!

Copy link
Contributor Author

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";
Copy link
Collaborator

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

@awelc
Copy link
Collaborator

awelc commented Aug 8, 2022

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:
#	language/tools/move-cli/tests/cli_tests.rs
# Conflicts:
#	language/tools/move-package/Cargo.toml
#	language/tools/move-package/src/resolution/resolution_graph.rs
@ea-open-source ea-open-source force-pushed the features/upload-command branch from 9ed5de5 to 190f3a2 Compare August 10, 2022 02:35
- 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`
Copy link
Collaborator

@awelc awelc left a 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";
Copy link
Collaborator

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);
Copy link
Collaborator

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.

Copy link
Collaborator

@awelc awelc left a 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!

@awelc awelc merged commit 165e1d3 into move-language:main Aug 12, 2022
brson pushed a commit to brson/move that referenced this pull request Jul 12, 2023
brson pushed a commit to brson/move that referenced this pull request Jul 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants