-
Notifications
You must be signed in to change notification settings - Fork 98
feat: dfx deploy command #1007
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
Merged
Merged
feat: dfx deploy command #1007
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
57db120
feat: dfx deploy command
122cb47
refactor canisters_to_deploy() to eliminate awkward "
5b691e1
Use DfxError::InvalidConfiguration rather than DfxError::Unknown
61a0ca0
cargo fmt
97a80cb
Update src/dfx/src/lib/message.rs
c361f29
Merge remote-tracking branch 'origin/master' into ericswanson-967-dfx…
4e90254
user message wording
b7c9401
working for config command
e160408
Merge branch 'master' into ericswanson-967-dfx-deploy
mergify[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| actor { | ||
| public func greet(name : Text) : async Text { | ||
| return "Bună, " # name # "!"; | ||
| }; | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| actor { | ||
| public func greet(name : Text) : async Text { | ||
| return "Ciao, " # name # "!"; | ||
| }; | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| actor { | ||
| public func greet(name : Text) : async Text { | ||
| return "Olá, " # name # "!"; | ||
| }; | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| #!/usr/bin/env bats | ||
|
|
||
| load utils/_ | ||
|
|
||
| setup() { | ||
| # We want to work from a temporary directory, different for every test. | ||
| cd $(mktemp -d -t dfx-e2e-XXXXXXXX) | ||
| export RUST_BACKTRACE=1 | ||
|
|
||
| dfx_new hello | ||
| dfx_start | ||
| } | ||
|
|
||
| teardown() { | ||
| dfx_stop | ||
| } | ||
|
|
||
| @test "deploy from a fresh project" { | ||
| install_asset greet | ||
| assert_command dfx deploy | ||
|
|
||
| assert_command dfx canister call hello greet '("Banzai")' | ||
| assert_eq '("Hello, Banzai!")' | ||
| } | ||
|
|
||
| @test "deploy a canister without dependencies" { | ||
| install_asset greet | ||
| assert_command dfx deploy hello | ||
| assert_match 'Deploying: hello' | ||
| assert_not_match 'hello_assets' | ||
| } | ||
|
|
||
| @test "deploy a canister with dependencies" { | ||
| install_asset greet | ||
| assert_command dfx deploy hello_assets | ||
| assert_match 'Deploying: hello hello_assets' | ||
| } | ||
|
|
||
| @test "deploy a canister with non-circular shared dependencies" { | ||
| install_asset transitive_deps_canisters | ||
| assert_command dfx deploy canister_f | ||
| assert_match 'Deploying: canister_a canister_f canister_g canister_h' | ||
| } | ||
|
|
||
| @test "report an error on attempt to deploy a canister with circular dependencies" { | ||
| install_asset transitive_deps_canisters | ||
| assert_command_fail dfx deploy canister_d | ||
| assert_match 'canister_d -> canister_e -> canister_d' | ||
| } | ||
|
|
||
| @test "if already registered, try to upgrade then install" { | ||
| install_asset greet | ||
| assert_command dfx canister create --all | ||
|
|
||
| assert_command dfx deploy | ||
| assert_match 'attempting install' | ||
| } | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| use crate::lib::environment::Environment; | ||
| use crate::lib::error::DfxResult; | ||
| use crate::lib::message::UserMessage; | ||
| use crate::lib::operations::canister::deploy_canisters; | ||
| use crate::lib::provider::create_agent_environment; | ||
| use clap::{App, Arg, ArgMatches, SubCommand}; | ||
|
|
||
| pub fn construct() -> App<'static, 'static> { | ||
| SubCommand::with_name("deploy") | ||
| .about(UserMessage::DeployCanister.to_str()) | ||
| .arg( | ||
| Arg::with_name("canister_name") | ||
| .takes_value(true) | ||
| .help(UserMessage::DeployCanisterName.to_str()) | ||
| .required(false), | ||
| ) | ||
| .arg( | ||
| Arg::with_name("network") | ||
| .help(UserMessage::CanisterComputeNetwork.to_str()) | ||
| .long("network") | ||
| .takes_value(true), | ||
| ) | ||
| } | ||
|
|
||
| pub fn exec(env: &dyn Environment, args: &ArgMatches<'_>) -> DfxResult { | ||
| let env = create_agent_environment(env, args)?; | ||
|
|
||
| let canister = args.value_of("canister_name"); | ||
|
|
||
| deploy_canisters(&env, canister) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -98,7 +98,11 @@ user_message!( | |
| ConfigureOptions => "Configures project options for your currently-selected project.", | ||
| OptionName => "Specifies the name of the configuration option to set or read. Use the period delineated path to specify the option to set or read. If this is not mentioned, outputs the whole configuration.", | ||
| OptionValue => "Specifies the new value to set. If you don't specify a value, the command displays the current value of the option from the configuration file.", | ||
| OptionFormat => "Specifies the format of the output. By default, it uses JSON.", | ||
| OptionFormat => "Specifies the format of the output. By default, the output format is JSON.", | ||
|
|
||
| // dfx deploy | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @lsgunnlsgunn could you review these messages please? |
||
| DeployCanister => "Deploys all or a specific canister from the code in your project. By default, all canisters are deployed.", | ||
| DeployCanisterName => "Specifies the name of the canister you want to deploy. If you don’t specify a canister name, all canisters defined in the dfx.json file are deployed.", | ||
|
|
||
| // dfx identity mod | ||
| ManageIdentity => "Manages identities used to communicate with the Internet Computer network. Setting an identity enables you to test user-based access controls.", | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
<3