-
Notifications
You must be signed in to change notification settings - Fork 98
feat: dfx sns deploy #2571
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 sns deploy #2571
Changes from 7 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
80de9b7
++
bitdivine 869b7f6
Clippy and fmt
bitdivine 72ffd04
++
bitdivine c9ceb0a
++
bitdivine abf50a1
Fix test
bitdivine 5922706
fmt
bitdivine e24de5d
Merge remote-tracking branch 'origin/master' into sns-deploy
bitdivine 4976d80
Add documentation
bitdivine 171ea3f
Add CHANGELOG
bitdivine 7698556
Revert accidental commit
bitdivine 72a5491
Use the asset import function in tests
bitdivine db53998
typo
bitdivine 4689065
consistency
bitdivine fe5cda1
Merge remote-tracking branch 'origin/master' into sns-deploy
bitdivine f1ce6cb
Bump canister id
bitdivine 11ed147
Merge branch 'master' into sns-deploy
bitdivine 3210fdd
Update test error message
bitdivine 2c6238e
Merge branch 'sns-deploy' of github.com:dfinity/sdk into sns-deploy
bitdivine ed7f306
Merge branch 'master' into sns-deploy
bitdivine 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
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
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,24 @@ | ||
| //! Code for the command line `dfx sns deploy`. | ||
| use crate::lib::error::DfxResult; | ||
| use crate::Environment; | ||
|
|
||
| use crate::lib::sns; | ||
| use crate::lib::sns::deploy::deploy_sns; | ||
| use clap::Parser; | ||
|
|
||
| /// Creates an SNS on a network. | ||
| /// | ||
| /// # Arguments | ||
| /// - `env` - The execution environment, including the network to deploy to and connection credentials. | ||
| /// - `opts` - Deployment options. | ||
| #[derive(Parser)] | ||
| pub struct DeployOpts {} | ||
|
|
||
| /// Executes the command line `dfx sns deploy`. | ||
| pub fn exec(env: &dyn Environment, _opts: DeployOpts) -> DfxResult { | ||
| let config = env.get_config_or_anyhow()?; | ||
| let path = config.get_project_root().join(sns::CONFIG_FILE_NAME); | ||
|
|
||
| deploy_sns(env, &path)?; | ||
| Ok(()) | ||
| } |
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 |
|---|---|---|
| @@ -1 +1,3 @@ | ||
| //! Code for managing the network nervous system. | ||
| #![warn(clippy::missing_docs_in_private_items)] | ||
| pub mod install_nns; |
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,19 @@ | ||
| //! Code for creating an SNS. | ||
| use fn_error_context::context; | ||
| use std::ffi::OsString; | ||
| use std::path::Path; | ||
|
|
||
| use crate::lib::error::DfxResult; | ||
| use crate::lib::sns::sns_cli::call_sns_cli; | ||
| use crate::Environment; | ||
|
|
||
| /// Creates an SNS. This requires funds but no proposal. | ||
| #[context("Failed to deploy SNS with config: {}", path.display())] | ||
| pub fn deploy_sns(env: &dyn Environment, path: &Path) -> DfxResult<String> { | ||
| let args = vec![ | ||
| OsString::from("deploy"), | ||
| OsString::from("--init-config-file"), | ||
| OsString::from(path), | ||
| ]; | ||
| call_sns_cli(env, &args).map(|stdout| format!("Deployed SNS: {}\n{}", path.display(), stdout)) | ||
| } |
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 |
|---|---|---|
| @@ -1,5 +1,9 @@ | ||
| //! Code for decentralizing dapps | ||
| #![warn(clippy::missing_docs_in_private_items)] | ||
| pub mod create_config; | ||
| pub mod deploy; | ||
| pub mod sns_cli; | ||
| pub mod validate_config; | ||
|
|
||
| /// The default location of an SNS configuration file. | ||
| pub const CONFIG_FILE_NAME: &str = "sns.yml"; |
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
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.
The
install_assetfunction can help here. I'd recommend something likeand move these files to
e2e/assets/sns/valid/sns.ymlande2e/assets/sns/logo/logo.svgUh oh!
There was an error while loading. Please reload this page.
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.
Can I put these assets in a single directory, as they will normally be needed together? Then the call would be
install_asset sns/valid? I'll do that but we can change it if needed.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.
Yes!