Skip to content

Commit

Permalink
cli: Add support for passing arguments to solana program deploy (#2709
Browse files Browse the repository at this point in the history
)
  • Loading branch information
acheroncrypto authored Nov 22, 2023
1 parent d91781f commit beb15cd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ The minor version will be incremented upon a breaking change and the patch versi

- cli: Allow force `init` and `new` ([#2698](https://github.com/coral-xyz/anchor/pull/2698)).
- cli: Add verifiable option when `deploy` ([#2705](https://github.com/coral-xyz/anchor/pull/2705)).
- cli: Add support for passing arguments to the underlying `solana program deploy` command with `anchor deploy` ([#2709](https://github.com/coral-xyz/anchor/pull/2709)).

### Fixes

Expand Down
9 changes: 8 additions & 1 deletion cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,9 @@ pub enum Command {
/// If true, deploy from path target/verifiable
#[clap(short, long)]
verifiable: bool,
/// Arguments to pass to the underlying `solana program deploy` command.
#[clap(required = false, last = true)]
solana_args: Vec<String>,
},
/// Runs the deploy migration script.
Migrate,
Expand Down Expand Up @@ -695,11 +698,13 @@ fn process_command(opts: Opts) -> Result<()> {
program_name,
program_keypair,
verifiable,
solana_args,
} => deploy(
&opts.cfg_override,
program_name,
program_keypair,
verifiable,
solana_args,
),
Command::Expand {
program_name,
Expand Down Expand Up @@ -3051,7 +3056,7 @@ fn test(
// In either case, skip the deploy if the user specifies.
let is_localnet = cfg.provider.cluster == Cluster::Localnet;
if (!is_localnet || skip_local_validator) && !skip_deploy {
deploy(cfg_override, None, None, false)?;
deploy(cfg_override, None, None, false, vec![])?;
}
let mut is_first_suite = true;
if cfg.scripts.get("test").is_some() {
Expand Down Expand Up @@ -3585,6 +3590,7 @@ fn deploy(
program_name: Option<String>,
program_keypair: Option<String>,
verifiable: bool,
solana_args: Vec<String>,
) -> Result<()> {
// Execute the code within the workspace
with_workspace(cfg_override, |cfg| {
Expand Down Expand Up @@ -3625,6 +3631,7 @@ fn deploy(
.arg("--program-id")
.arg(strip_workspace_prefix(program_keypair_filepath))
.arg(strip_workspace_prefix(binary_path))
.args(&solana_args)
.stdout(Stdio::inherit())
.stderr(Stdio::inherit())
.output()
Expand Down

1 comment on commit beb15cd

@vercel
Copy link

@vercel vercel bot commented on beb15cd Nov 22, 2023

Choose a reason for hiding this comment

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

Successfully deployed to the following URLs:

anchor-docs – ./

anchor-docs-git-master-200ms.vercel.app
anchor-docs-200ms.vercel.app
www.anchor-lang.com
anchor-lang.com

Please sign in to comment.