Skip to content
This repository was archived by the owner on Feb 23, 2026. It is now read-only.

Add pull specific solana-release version#3

Merged
gregcusack merged 6 commits intoanza-xyz:mainfrom
gregcusack:setup-tar-deploy
Apr 3, 2024
Merged

Add pull specific solana-release version#3
gregcusack merged 6 commits intoanza-xyz:mainfrom
gregcusack:setup-tar-deploy

Conversation

@gregcusack
Copy link
Copy Markdown
Contributor

@gregcusack gregcusack commented Mar 27, 2024

Summary of Changes

  1. Add in download specific release version e.g. v1.17.28

3rd PR in a series of PRs that will build out the mongon testing framework for deploying validator clusters on Kubernetes
Previous PRs:

  1. PR: add PROGRESS.md and connect to k8s endpoint to check namespace exists #1
  2. PR: Add in ability to build solana binary from local repo on host #2

Download specific release version from release.solana.com. pass in a release-channel via --release-channel <release-version: e.g. v1.17.28>. will download into this repo

Copy link
Copy Markdown

@joncinque joncinque 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 for the most part! We might be able to do something to simplify the CLI args, but otherwise just nits

Comment thread src/lib.rs Outdated
let mut file = File::open(path)?;
let mut contents = String::new();
file.read_to_string(&mut contents)?;
info!("version.yml:\n{}", contents);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

nit: how about printing the filename?

Suggested change
info!("version.yml:\n{}", contents);
info!("{}:\n{}", path.file_name(), contents);

Comment thread src/main.rs
Comment on lines +49 to +55
.arg(
Arg::with_name("release_channel")
.long("release-channel")
.takes_value(true)
.required_if("deploy_method", "tar") // Require if deploy_method is "tar"
.help("release version. e.g. v1.17.2. Required if '--deploy-method tar'"),
)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

From my comment on the last review, it might make more sense to change it so that --local-path and --release-channel conflict with each other, then you don't need --deploy-method

And in fact, the DeployMethod enum could look something like:

enum DeployMethod {
    Local(String),
    ReleaseChannel(String),
    Skip,
}

Comment thread src/lib.rs Outdated
Comment on lines +127 to +129
if tmp_extract_dir.exists() {
let _ = fs::remove_dir_all(&tmp_extract_dir);
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

When would this be used? if extract_dir is actually a path dir, then tmp-extract should never exist

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

ya you're right. will fix

Comment thread src/release.rs Outdated
let file_name = "solana-release";
match self.setup_tar_deploy(file_name).await {
Ok(tar_directory) => {
info!("Sucessfuly setup tar file");
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

nit typo

Suggested change
info!("Sucessfuly setup tar file");
info!("Successfully setup tar file");

Comment thread src/release.rs Outdated
}

async fn setup_tar_deploy(&self, file_name: &str) -> Result<PathBuf, Box<dyn Error>> {
let tar_file = format!("{}{}", file_name, ".tar.bz2");
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

nit: you could simplify this to

Suggested change
let tar_file = format!("{}{}", file_name, ".tar.bz2");
let tar_file = format!("{file_name}.tar.bz2");

Comment thread src/main.rs Outdated
Comment on lines 127 to 128
matches.is_present("skip_build"),
matches.is_present("debug_build"),
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Separately, you could also have an enum for BuildType, something like:

enum Build {
    Skip,
    Debug,
    Release,
}

And then you could avoid a situation where someone incorrectly specifies "skip" and "debug"

Comment thread src/release.rs Outdated
match self.deploy_method {
DeployMethod::Tar => {
return Err(boxed_error!("Tar deploy method not implemented yet."));
let file_name = "solana-release";
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

nit: Will this always be hardcoded? If so, it might be simpler to just hardcode it in setup_tar_deploy

Comment thread src/release.rs Outdated

async fn download_release_from_channel(&self, file_name: &str) -> Result<(), Box<dyn Error>> {
info!("Downloading release from channel: {}", self.release_channel);
let tar_file = format!("{}{}", file_name, ".tar.bz2");
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

nit: Rather than reconstructing the tar filename, how about passing it in directly as tar_filename instead of file_name?

Comment thread src/lib.rs Outdated
};

#[macro_export]
macro_rules! boxed_error {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

nit: Sorry, I didn't comment on this in the other PR, but rather than using a boxed_error macro and creating an std::io::Error, you can just cast a string as a dyn Error.

There are some examples of that in the token-cli, ie https://github.com/solana-labs/solana-program-library/blob/ce8e4d565edcbd26e75d00d0e34e9d5f9786a646/token/cli/src/command.rs#L1346

Copy link
Copy Markdown

@joncinque joncinque left a comment

Choose a reason for hiding this comment

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

Just two more tiny ones, but nothing that should stop this from going in. Looks great, and thanks for applying the feedback!

Comment thread src/main.rs
Comment on lines +45 to +48
.group(
ArgGroup::new("required_group")
.args(&["local_path", "release_channel"])
.required(true),
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Since you have the group, I think you can remove the conflicts_with bit actually

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

oh good point. will update in next PR

Comment thread src/main.rs
Comment on lines +82 to +84
let build_type: BuildType = matches
.value_of_t("build_type")
.unwrap_or_else(|e| e.exit());
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

micro-nit: you should be able to just unwrap() here since it has a default value

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yep cool call will update in next PR. thank you!

@gregcusack gregcusack removed the request for review from yihau April 2, 2024 23:49
@gregcusack gregcusack merged commit 50cbde2 into anza-xyz:main Apr 3, 2024
@gregcusack gregcusack deleted the setup-tar-deploy branch April 3, 2024 16:14
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.

2 participants