-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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: Allow install, list and use from commit #2659
feat: Allow install, list and use from commit #2659
Conversation
@Arrowana is attempting to deploy a commit to the coral-xyz Team on Vercel. A member of the Team first needs to authorize it. |
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.
Full commit or shorter? I think full commit is fine to avoid having to do even more guessing in the cli
Don't have strong opinions but would be nice to also support shorter commit hashes.
Once installed
anchor --version
gives the last release for the commit, well i don't think we can fix this without pulling the repo and changing Cargo.toml
I think it's fine as long as the commit can be viewed from avm
.
avm/src/main.rs
Outdated
/// Anchor version or commit | ||
version: String, | ||
#[clap(short, long, required = false)] | ||
is_commit: bool, |
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.
Single arg trying ver then commit, less clunky than the extra flag
I'm guessing this is not implemented yet. Don't think is_commit
flag is necessary, can just decide whether it's a version or a commit based on the input.
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.
Forgot to push, pushed and back to single arg
Trying to install an incorrect commit
target/debug/avm install dcafb789e1635b8f90e8fd3badd0f9a015d204d42ds2`
error: invalid value 'dcafb789e1635b8f90e8fd3badd0f9a015d204d42ds2' for '<VERSION_OR_COMMIT>': Not a valid version or commit: unexpected character 'd' while parsing major version number, Error checking commit dcafb789e1635b8f90e8fd3badd0f9a015d204d42ds2: {"message":"No commit found for SHA: dcafb789e1635b8f90e8fd3badd0f9a015d204d42ds2","documentation_url":"https://docs.github.com/rest/commits/commits#get-a-commit"}
We can also provide a shortened commit sha with
518b390
}) | ||
}) | ||
} | ||
|
||
pub fn entry(opts: Cli) -> Result<()> { | ||
match opts.command { | ||
Commands::Use { version } => avm::use_version(version), |
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've tried it and confirm it works as expected but one area that might need improvement is avm use
command as it requires putting the full version-hash avm use 0.28.0-6cf200493a307c01487c7b492b4893e0d6f6cb23
and doesn't work with avm use 6cf200
.
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'd be great to make it work with #2649. Specifying:
[toolchain]
anchor_version = "0.28.0-6cf200493a307c01487c7b492b4893e0d6f6cb23"
only works if that version is already installed because avm install 0.28.0-6cf200493a307c01487c7b492b4893e0d6f6cb23
doesn't work.
Can implement this in another PR so I'm merging this as is, thanks!
Since we install from the commit alone should it be?
Because if you think about it if we allow |
That's what I thought at first but later realized
We could validate the version for the commit is correct here but I don't think it's necessary because even if someone puts an incorrect version for the commit [toolchain]
anchor_version = "0.27.0-6cf200493a307c01487c7b492b4893e0d6f6cb23" running an
so it's pretty clear what's wrong here. |
avm list
Questions:
I introduce the is_commit flag, because otherwise we don't know if it is a version or a commit that want to be installed. We could parse the version, if it isn't one we query the commit for the string if none of those 2 Ok we returnSingle arg trying ver then commit, less clunky than the extra flagNot a valid version or commit
. What do you think?anchor --version
gives the last release for the commit, well i don't think we can fix this without pulling the repo and changing Cargo.toml