-
Notifications
You must be signed in to change notification settings - Fork 24
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: besu network update #111
Open
a7351220
wants to merge
6
commits into
cathayddt:3.1.0
Choose a base branch
from
a7351220:feat/besuNetwork-update
base: 3.1.0
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
60fa4e4
feat: rename the quorum file to eth
cheng-chun-yuan b24bcab
fix: change the commandDir from quorum to eth, and rename test/quorum…
cheng-chun-yuan 15acd92
feat: create config file to store genesisfile, dockerComposed of memb…
cheng-chun-yuan a35f528
feat: add network type support to replace Quorum-specific logic
57a57d3
feat: add Kubernetes configuration files for Besu
9d27416
fix: Add network type support and refactor network operations
a7351220 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 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 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 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 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 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 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 |
---|---|---|
|
@@ -4,23 +4,33 @@ import Backup from '../../service/backup' | |
import { onCancel, ParamsError } from '../../../util/error' | ||
import prompts from 'prompts' | ||
import ora from 'ora' | ||
import { getNetworkTypeChoices } from '../../config/network.type' | ||
|
||
export const command = 'import' | ||
|
||
export const desc = '匯入現有的 Quorum Network' | ||
export const desc = '匯入現有的 Eth Network' | ||
|
||
interface OptType { | ||
interactive: boolean | ||
} | ||
|
||
export const builder = (yargs: Argv<OptType>) => { | ||
return yargs | ||
.example('bdk quorum backup import --interactive', 'Cathay BDK 互動式問答') | ||
.example('bdk eth backup import --interactive', 'Cathay BDK 互動式問答') | ||
.option('interactive', { type: 'boolean', description: '是否使用 Cathay BDK 互動式問答', alias: 'i' }) | ||
} | ||
|
||
export const handler = async (argv: Arguments<OptType>) => { | ||
const backup = new Backup(config) | ||
const { networkType } = await prompts([ | ||
{ | ||
type: 'select', | ||
name: 'networkType', | ||
message: 'What is your network?', | ||
choices: getNetworkTypeChoices(), | ||
}, | ||
]) | ||
const networkTypeWithBigFirstLetter = networkType.charAt(0).toUpperCase() + networkType.slice(1) | ||
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. 這行就可以刪掉了 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. 已完成討論,此部分無修改。 |
||
const backup = new Backup(config, networkType) | ||
|
||
const archive: string = await (async () => { | ||
const archiveList = backup.getBackupItems() | ||
|
@@ -35,7 +45,7 @@ export const handler = async (argv: Arguments<OptType>) => { | |
throw new ParamsError('Invalid params: Required parameter missing') | ||
} | ||
})() | ||
const spinner = ora('Quorum Network Import ...').start() | ||
const spinner = ora(`${networkTypeWithBigFirstLetter} Network Import ...`).start() | ||
await backup.import(archive) | ||
spinner.succeed('Quorum Network Import Successfully!') | ||
spinner.succeed(`${networkTypeWithBigFirstLetter} Network Import Successfully!`) | ||
} |
This file contains 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 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 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,53 @@ | ||
import { Argv } from 'yargs' | ||
import config from '../../config' | ||
import Cluster from '../../service/cluster' | ||
import { onCancel } from '../../../util/error' | ||
import prompts from 'prompts' | ||
import ora from 'ora' | ||
import { getNetworkTypeChoices, NetworkType } from '../../config/network.type' | ||
|
||
export const command = 'delete' | ||
|
||
export const desc = '刪除現有的 Eth Network Cluster 網路' | ||
|
||
interface OptType { | ||
interactive: boolean | ||
} | ||
|
||
export const builder = (yargs: Argv<OptType>) => { | ||
return yargs | ||
.example('bdk eth network cluster delete', 'Cathay BDK 互動式問答') | ||
} | ||
|
||
export const handler = async () => { | ||
const { networkType } = await prompts([{ | ||
type: 'select', | ||
name: 'networkType', | ||
message: 'What is your network?', | ||
choices: getNetworkTypeChoices(), | ||
}]) as { networkType: NetworkType } | ||
|
||
const networkTypeWithBigFirstLetter = networkType.charAt(0).toUpperCase() + networkType.slice(1) | ||
const cluster = new Cluster(config, networkType) | ||
const confirm: boolean = await (async () => { | ||
const fileList = cluster.getHelmChartFiles() | ||
if (fileList.length !== 0) { | ||
const confirmDelete = (await prompts({ | ||
type: 'confirm', | ||
name: 'value', | ||
message: `⚠️ Detecting ${networkTypeWithBigFirstLetter} cluster already exists. The following processes will remove all existing files. Continue?`, | ||
initial: false, | ||
}, { onCancel })).value | ||
return confirmDelete | ||
} else { | ||
return true | ||
} | ||
})() | ||
|
||
if (confirm) { | ||
const spinner = ora(`${networkTypeWithBigFirstLetter} Cluster Delete ...`).start() | ||
await cluster.delete(networkType) | ||
cluster.removeHelmChartFiles() | ||
spinner.succeed(`${networkTypeWithBigFirstLetter} Cluster Delete Successfully!`) | ||
} | ||
} |
This file contains 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 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
Oops, something went wrong.
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.
這邊改成這樣,就不需要再轉換大小寫一次了
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.
已完成討論,此部分無修改。