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

feat: Separate network upgrade and freeze from node update/add/delete command #628

Conversation

Ivo-Yankov
Copy link
Contributor

@Ivo-Yankov Ivo-Yankov commented Sep 26, 2024

Description

Adds the following new commands:

  • solo node prepare-upgrade
  • solo node freeze-upgrade
  • solo node download-generated-files

Adds an initial code structure for a refactor of node.mjs. The logic related to all node commands will be structured like this:

commands/
    node/
        index.mjs
        flags.mjs
        tasks.mjs
        configs.mjs
        handlers.mjs

When the refactor is completed node.mjs will be deleted. All initializations and command definitions will be moved to commands/node/index.mjs. This PR proposes the definition of a single command to be structured like this, using the new YargsCommand class:

  getCommandDefinition () {
    const nodeCmd = this
    return {
      command: 'node',
      desc: 'Manage Hedera platform node in solo network',
      builder: yargs => {
        return yargs
          ...
   
          .command(new YargsCommand({
            command: 'prepare-upgrade',
            description: 'Prepare the network for a Freeze Upgrade operation',
            commandDef: nodeCmd,
            handler: 'prepareUpgrade'
          }, NodeFlags.UPGRADE_FLAGS))
          
          ...
      }
    }
  }
  • All handler functions should be moved to commands/node/handlers.mjs (this is not present in the PR). Handlers combine separate task methods from tasks.mjs.
  • configs.mjs is responsible for building the config objects. The configBuilder functions are called during the initialization step of every command.
  • The flags will be separated into 3 types: requiredFlags - Those flags have to be defined when calling the command. requiredFlagsWithDisabledPrompt - those are required to be present, but can be omitted when calling the command, in which case the value will be populated from cache. If no value is found an error will be thrown. optionalFlags - value is not required. See commands/node/flags.mjs for the proposed structure.

Related Issues

Signed-off-by: Ivo Yankov <[email protected]>
Signed-off-by: Ivo Yankov <[email protected]>
Copy link
Contributor

github-actions bot commented Sep 26, 2024

Unit Test Results - Linux

  1 files  ±0   19 suites  ±0   28s ⏱️ -1s
119 tests ±0  119 ✅ ±0  0 💤 ±0  0 ❌ ±0 
145 runs  ±0  145 ✅ ±0  0 💤 ±0  0 ❌ ±0 

Results for commit b5303d3. ± Comparison against base commit 5b9d19d.

This pull request removes 1 and adds 1 tests. Note that renamed tests count towards both.
InitCommand static command definition should return a valid command def ‑ InitCommand static command definition should return a valid command def
InitCommand methods command definition should return a valid command def ‑ InitCommand methods command definition should return a valid command def

♻️ This comment has been updated with latest results.

@Ivo-Yankov Ivo-Yankov self-assigned this Sep 27, 2024
Signed-off-by: Ivo Yankov <[email protected]>
Signed-off-by: Ivo Yankov <[email protected]>
Signed-off-by: Ivo Yankov <[email protected]>
Signed-off-by: Ivo Yankov <[email protected]>
Signed-off-by: Ivo Yankov <[email protected]>
Signed-off-by: Ivo Yankov <[email protected]>
Signed-off-by: Ivo Yankov <[email protected]>
Signed-off-by: Ivo Yankov <[email protected]>
Signed-off-by: Ivo Yankov <[email protected]>
Copy link
Contributor

github-actions bot commented Sep 30, 2024

Unit Test Results - Windows

  1 files  ±0   19 suites  ±0   54s ⏱️ -2s
119 tests ±0  119 ✅ ±0  0 💤 ±0  0 ❌ ±0 
145 runs  ±0  145 ✅ ±0  0 💤 ±0  0 ❌ ±0 

Results for commit b5303d3. ± Comparison against base commit 5b9d19d.

This pull request removes 1 and adds 1 tests. Note that renamed tests count towards both.
InitCommand static command definition should return a valid command def ‑ InitCommand static command definition should return a valid command def
InitCommand methods command definition should return a valid command def ‑ InitCommand methods command definition should return a valid command def

♻️ This comment has been updated with latest results.

Signed-off-by: Ivo Yankov <[email protected]>
Copy link

codecov bot commented Sep 30, 2024

Codecov Report

Attention: Patch coverage is 71.54150% with 72 lines in your changes missing coverage. Please review.

Project coverage is 79.65%. Comparing base (5b9d19d) to head (b5303d3).
Report is 7 commits behind head on main.

Files with missing lines Patch % Lines
src/core/yargs_command.mjs 0.00% 27 Missing ⚠️
src/commands/node.mjs 39.39% 20 Missing ⚠️
src/commands/node/tasks.mjs 91.33% 13 Missing ⚠️
src/commands/account.mjs 0.00% 2 Missing ⚠️
src/commands/cluster.mjs 0.00% 2 Missing ⚠️
src/commands/mirror_node.mjs 0.00% 2 Missing ⚠️
src/commands/network.mjs 0.00% 2 Missing ⚠️
src/commands/relay.mjs 0.00% 2 Missing ⚠️
src/core/helpers.mjs 84.61% 2 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #628      +/-   ##
==========================================
- Coverage   80.25%   79.65%   -0.60%     
==========================================
  Files          37       42       +5     
  Lines        5009     5068      +59     
  Branches      767      705      -62     
==========================================
+ Hits         4020     4037      +17     
- Misses        988     1030      +42     
  Partials        1        1              
Files with missing lines Coverage Δ
src/commands/index.mjs 0.00% <ø> (ø)
src/commands/init.mjs 80.35% <100.00%> (+1.40%) ⬆️
src/commands/node/configs.mjs 100.00% <100.00%> (ø)
src/commands/node/flags.mjs 100.00% <100.00%> (ø)
src/core/task.mjs 100.00% <100.00%> (ø)
test/e2e/e2e_node_util.js 86.95% <100.00%> (ø)
test/test_add.mjs 100.00% <ø> (ø)
test/test_util.js 87.26% <ø> (ø)
src/commands/account.mjs 68.62% <0.00%> (+0.33%) ⬆️
src/commands/cluster.mjs 58.46% <0.00%> (+0.44%) ⬆️
... and 7 more

Impacted file tree graph

Copy link

codacy-production bot commented Sep 30, 2024

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
-0.54% (target: -1.00%) 72.94%
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (5b9d19d) 4168 3351 80.40%
Head commit (b5303d3) 4236 (+68) 3383 (+32) 79.86% (-0.54%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#628) 218 159 72.94%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

Codacy stopped sending the deprecated coverage status on June 5th, 2024. Learn more

Signed-off-by: Ivo Yankov <[email protected]>
…om-node-updateadddelete-command

# Conflicts:
#	src/commands/node.mjs
#	src/core/helpers.mjs
Signed-off-by: Ivo Yankov <[email protected]>
Signed-off-by: Ivo Yankov <[email protected]>
Signed-off-by: Ivo Yankov <[email protected]>
Signed-off-by: Ivo Yankov <[email protected]>
…om-node-updateadddelete-command

# Conflicts:
#	.github/workflows/flow-build-application.yaml
#	.github/workflows/flow-pull-request-checks.yaml
#	.github/workflows/templates/config.yaml
#	.github/workflows/zxc-code-analysis.yaml
#	.github/workflows/zxc-env-vars.yaml
#	package.json
#	src/commands/node.mjs
#	src/core/helpers.mjs
Signed-off-by: Ivo Yankov <[email protected]>
Copy link
Contributor

github-actions bot commented Oct 1, 2024

E2E Test Report

0 tests  ±0   0 ✅ ±0   0s ⏱️ ±0s
0 suites ±0   0 💤 ±0 
0 files   ±0   0 ❌ ±0 

Results for commit 891c475. ± Comparison against base commit b251276.

Copy link
Contributor

github-actions bot commented Oct 1, 2024

E2E Test Report

0 tests  ±0   0 ✅ ±0   0s ⏱️ ±0s
0 suites ±0   0 💤 ±0 
0 files   ±0   0 ❌ ±0 

Results for commit b5303d3. ± Comparison against base commit 5b9d19d.

♻️ This comment has been updated with latest results.

@Ivo-Yankov Ivo-Yankov marked this pull request as ready for review October 1, 2024 13:38
@Ivo-Yankov Ivo-Yankov requested review from a team and leninmehedy as code owners October 1, 2024 13:38
…d-freeze-from-node-updateadddelete-command

# Conflicts:
#	src/commands/node.mjs
jeromy-cannon
jeromy-cannon previously approved these changes Oct 2, 2024
…om-node-updateadddelete-command

# Conflicts:
#	src/commands/node.mjs
#	test/e2e/e2e_node_util.js
Signed-off-by: Ivo Yankov <[email protected]>
Signed-off-by: Ivo Yankov <[email protected]>
@jeromy-cannon jeromy-cannon merged commit 9b17937 into main Oct 3, 2024
34 of 37 checks passed
@jeromy-cannon jeromy-cannon deleted the 00559-separate-network-upgrade-and-freeze-from-node-updateadddelete-command branch October 3, 2024 11:28
swirlds-automation added a commit that referenced this pull request Oct 4, 2024
## [0.31.0](v0.30.1...v0.31.0) (2024-10-04)

### Features

* Add '--mirror-node-version' flag to override default mirror node version ([#616](#616)) ([e4932c4](e4932c4))
* add quiet flag ([#621](#621)) ([b068c8f](b068c8f))
* convert hugo docs workflow calls to use Taskfile task ([#642](#642)) ([ae8d8bb](ae8d8bb))
* ensured user-provided values file takes precedence over solo-generated values ([#615](#615)) ([1b0ffc9](1b0ffc9))
* **logging:** Add the new custom process output class and inject it into the default list renderer options ([#622](#622)) ([efa1783](efa1783))
* separate commands for solo node delete ([#597](#597)) ([b251276](b251276))
* Separate network upgrade and freeze from node update/add/delete command ([#628](#628)) ([9b17937](9b17937))

### Bug Fixes

* Direct calling of node stop and start commands ([#636](#636)) ([7749b04](7749b04))
* **docs:** resolve issues due to npx in taskfile for the custom-network-config example ([038e6df](038e6df))
* jsdoc failed but ci job not failed ([#608](#608)) ([3f838f6](3f838f6))
* specify jvm env variables explicitly for local profile ([#405](#405)) ([3db7e08](3db7e08))
* **tests:** start Kind cluster on demand if not having a kube config errors ([#624](#624)) ([538e40d](538e40d))
* upgrade eslint config away from abandoned plugin ([#643](#643)) ([84d3dc5](84d3dc5))
@swirlds-automation
Copy link
Contributor

🎉 This PR is included in version 0.31.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Separate network upgrade and freeze from node update/add/delete command
3 participants