Skip to content
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

Devnet wiz: one command for devnet + subnet flow #1205

Merged
merged 44 commits into from
Nov 22, 2023
Merged
Show file tree
Hide file tree
Changes from 42 commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
6dde00b
add source code repo prompts to custom vm create
felipemadero Nov 9, 2023
33b5597
fix e2e
felipemadero Nov 9, 2023
90031f4
Merge branch 'main' into add-source-code-prompts-to-custom-vm-create
felipemadero Nov 9, 2023
8d34d6a
partial work
felipemadero Nov 9, 2023
29796f3
add skel
felipemadero Nov 14, 2023
dd481bb
add create node to wiz
felipemadero Nov 14, 2023
a341d08
trying to add deploy
felipemadero Nov 14, 2023
e931d03
create devnet + subnet deploy working
felipemadero Nov 15, 2023
f754643
add check for subnet status
felipemadero Nov 15, 2023
5f99236
add list of nodes to health check
felipemadero Nov 15, 2023
887d34d
deploy + sync + validate working
felipemadero Nov 15, 2023
a09e92e
nit
felipemadero Nov 15, 2023
08510ac
add create to the flow
felipemadero Nov 15, 2023
3118149
fix cli compilation point
felipemadero Nov 15, 2023
3bf91db
Merge branch 'main' into add-source-code-prompts-to-custom-vm-create
felipemadero Nov 15, 2023
f44af24
address PR comments
felipemadero Nov 15, 2023
1b5a3b2
Merge branch 'add-source-code-prompts-to-custom-vm-create' into devne…
felipemadero Nov 15, 2023
ce81555
added subnet create
felipemadero Nov 15, 2023
1ceacca
add subnet create + configure
felipemadero Nov 15, 2023
407cd8d
wip
arturrez Nov 15, 2023
4a68a42
wip
arturrez Nov 15, 2023
814231c
ready for testing
arturrez Nov 16, 2023
8204c7c
fix lint
arturrez Nov 16, 2023
360416b
fix typo
arturrez Nov 16, 2023
e5afddb
rm unused ansible files
arturrez Nov 16, 2023
858b417
fix timeouts
arturrez Nov 16, 2023
56dadfd
bug fixes and better error display
arturrez Nov 16, 2023
b27d363
make sure we are connected
arturrez Nov 17, 2023
b7cb19a
reuse connection if it's exists when host connects
arturrez Nov 17, 2023
6f0fcbf
lint
arturrez Nov 17, 2023
2eb98ba
fix script issue, cleanup
arturrez Nov 17, 2023
b726439
Merge branch 'main' into devnet-wiz
felipemadero Nov 17, 2023
96f6b95
GetErroHostMap -> GetErrorHostMap
arturrez Nov 17, 2023
45a139f
fix subnet-evm branch
felipemadero Nov 17, 2023
f311b25
Merge branch 'ansible_ssh_number_2' into devnet-wiz-ssh
felipemadero Nov 17, 2023
8131588
merge ssh pr into this one
felipemadero Nov 17, 2023
8528ada
fix branch
felipemadero Nov 17, 2023
a472e2a
fix
felipemadero Nov 17, 2023
d72c6d6
fix remaining issues
felipemadero Nov 17, 2023
7f7f213
Merge branch 'main' into devnet-wiz
felipemadero Nov 17, 2023
7331756
nits
felipemadero Nov 17, 2023
2084b42
Merge branch 'main' into devnet-wiz
felipemadero Nov 18, 2023
0a5ed4a
Merge branch 'main' into devnet-wiz
felipemadero Nov 22, 2023
34ccf23
nit
felipemadero Nov 22, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions cmd/nodecmd/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,13 @@ func createNodes(_ *cobra.Command, args []string) error {
if err != nil {
return err
}
if numNodes <= 0 {
var err error
numNodes, err = app.Prompt.CaptureInt("How many nodes do you want to set up?")
if err != nil {
return err
}
}
usr, err := user.Current()
if err != nil {
return err
Expand Down
7 changes: 0 additions & 7 deletions cmd/nodecmd/create_aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,13 +166,6 @@ func createEC2Instances(rootBody *hclwrite.Body,
if err := terraformaws.SetCloudCredentials(rootBody, awsProfile, region); err != nil {
return nil, nil, "", "", err
}
if numNodes <= 0 {
var err error
numNodes, err = app.Prompt.CaptureInt("How many nodes do you want to set up on AWS?")
if err != nil {
return nil, nil, "", "", err
}
}
ux.Logger.PrintToUser("Creating new EC2 instance(s) on AWS...")
var useExistingKeyPair bool
keyPairExists, err := awsAPI.CheckKeyPairExists(ec2Svc, keyPairName)
Expand Down
6 changes: 0 additions & 6 deletions cmd/nodecmd/create_gcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,6 @@ func createGCEInstances(rootBody *hclwrite.Body,
if err := terraformgcp.SetCloudCredentials(rootBody, zone, credentialsPath, projectName); err != nil {
return nil, nil, "", "", err
}
if numNodes <= 0 {
numNodes, err = app.Prompt.CaptureInt("How many nodes do you want to set up on GCP?")
if err != nil {
return nil, nil, "", "", err
}
}
ux.Logger.PrintToUser("Creating new VM instance(s) on Google Compute Engine...")
certInSSHDir, err := app.CheckCertInSSHDir(fmt.Sprintf("%s-keypair.pub", cliDefaultName))
if err != nil {
Expand Down
2 changes: 2 additions & 0 deletions cmd/nodecmd/devnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,7 @@ You can check the updated status by calling avalanche node status <clusterName>`
}
// node devnet deploy
cmd.AddCommand(newDeployCmd())
// node devnet wiz
cmd.AddCommand(newWizCmd())
return cmd
}
13 changes: 13 additions & 0 deletions cmd/nodecmd/stop.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,3 +194,16 @@ func getClusterNodes(clusterName string) ([]string, error) {
}
return clusterNodes, nil
}

func clusterExists(clusterName string) (bool, error) {
clustersConfig := models.ClustersConfig{}
if app.ClustersConfigExists() {
var err error
clustersConfig, err = app.LoadClustersConfig()
if err != nil {
return false, err
}
}
_, ok := clustersConfig.Clusters[clusterName]
return ok, nil
}
33 changes: 0 additions & 33 deletions cmd/nodecmd/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,35 +162,6 @@ func syncSubnet(_ *cobra.Command, args []string) error {
}
return fmt.Errorf("the Avalanche Go version of node(s) %s is incompatible with VM RPC version of %s", incompatibleNodes, subnetName)
}
hosts, err := ansible.GetInventoryFromAnsibleInventoryFile(app.GetAnsibleInventoryDirPath(clusterName))
if err != nil {
return err
}
wg := sync.WaitGroup{}
wgResults := models.NodeResults{}
for _, host := range hosts {
wg.Add(1)
go func(nodeResults *models.NodeResults, host models.Host) {
defer wg.Done()
if err := host.Connect(constants.SSHScriptTimeout); err != nil {
nodeResults.AddResult(host.NodeID, nil, err)
return
}
defer func() {
if err := host.Disconnect(); err != nil {
nodeResults.AddResult(host.NodeID, nil, err)
}
}()
if err := ssh.RunSSHSetupBuildEnv(host); err != nil {
nodeResults.AddResult(host.NodeID, nil, err)
return
}
}(&wgResults, host)
}
wg.Wait()
if wgResults.HasErrors() {
return fmt.Errorf("failed to get setup build env for node(s) %s", wgResults.GetErrorHostMap())
}
clustersConfig, err := app.LoadClustersConfig()
if err != nil {
return err
Expand Down Expand Up @@ -334,10 +305,6 @@ func trackSubnet(clusterName, subnetName string, network models.Network) ([]stri
nodeResults.AddResult(host.NodeID, nil, err)
}
}()
if err := ssh.RunSSHSetupCLIFromSource(host, constants.SetupCLIFromSourceBranch); err != nil {
nodeResults.AddResult(host.NodeID, nil, err)
return
}
subnetExportPath := filepath.Join("/tmp", filepath.Base(subnetPath))
if err := ssh.RunSSHExportSubnet(host, subnetPath, subnetExportPath); err != nil {
nodeResults.AddResult(host.NodeID, nil, err)
Expand Down
30 changes: 0 additions & 30 deletions cmd/nodecmd/updateSubnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,36 +69,6 @@ func updateSubnet(_ *cobra.Command, args []string) error {
}
return fmt.Errorf("the Avalanche Go version of node(s) %s is incompatible with VM RPC version of %s", incompatibleNodes, subnetName)
}

hosts, err := ansible.GetInventoryFromAnsibleInventoryFile(app.GetAnsibleInventoryDirPath(clusterName))
if err != nil {
return err
}
wg := sync.WaitGroup{}
wgResults := models.NodeResults{}
for _, host := range hosts {
wg.Add(1)
go func(nodeResults *models.NodeResults, host models.Host) {
defer wg.Done()
if err := host.Connect(constants.SSHScriptTimeout); err != nil {
nodeResults.AddResult(host.NodeID, nil, err)
return
}
defer func() {
if err := host.Disconnect(); err != nil {
nodeResults.AddResult(host.NodeID, nil, err)
}
}()
if err := ssh.RunSSHSetupBuildEnv(host); err != nil {
nodeResults.AddResult(host.NodeID, nil, err)
return
}
}(&wgResults, host)
}
wg.Wait()
if wgResults.HasErrors() {
return fmt.Errorf("failed to get setup build env for node(s) %s", wgResults.GetErrorHostMap())
}
nonUpdatedNodes, err := doUpdateSubnet(clusterName, subnetName, models.FujiNetwork)
if err != nil {
return err
Expand Down
Loading
Loading