-
Notifications
You must be signed in to change notification settings - Fork 2
Support mirage boot building from sources #114
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
Conversation
This reverts commit 602b4c0.
…y variable is not set or empty
| keep_volumes: no | ||
| tags: admin | ||
| when: node_type is defined and node_type == "mirage" | ||
| when: node_type == "mirage_boot" |
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.
should it be when: node_type == "mirage" here?
| LANG: en_US.utf-8 | ||
| LC_ALL: en_US.utf-8 | ||
| when: node_type is defined and node_type == "mirage" | ||
| - name: Compose register command |
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.
this approach looks more readable and simpler:
- name: Register node
command:
cmd: "{{ node_commands[node_type] | format(inventory_hostname, hostvars[inventory_hostname].ansible_host, inventory_hostname, base_domain_name) }}"
vars:
node_commands:
mirage_boot: "mirage boot register -n {0} --ip {1} -p 10000 -d {2}.{3}"
mirage: "mirage node register --ip {1} -p 10000 -d {2}.{3}"
skale: "skale node register -n {0} --ip {1} -p 10000 -d {2}.{3}"
environment:
LANG: en_US.utf-8
LC_ALL: en_US.utf-8
when: node_type in node_commandsThere 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.
done
| set_fact: | ||
| cli_full_command: "{{ node_type }} boot init {{ base_path }}/init-env" | ||
| when: node_type is defined and node_type == "mirage" | ||
| _command_action_prefix: >- |
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.
vars approach can be used here to simplify the code:
- name: Build and execute init command
command:
cmd: "{{ command_prefix }} init {{ base_path }}/init-env{{ sync_flags }}"
vars:
command_prefixes:
mirage_boot: "mirage boot"
mirage: "mirage node"
skale: "{{ 'skale sync-node' if (sync_node | default(false) | bool) else 'skale node' }}"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.
done
| debug: | ||
| msg: "{{ validator_id }}" | ||
|
|
||
| - name: Determine wallet info command |
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.
suggested change:
- name: Get wallet info
command: "{{ wallet_commands[node_type] | default(wallet_commands.default) }}"
vars:
wallet_commands:
mirage_boot: "sudo mirage wallet info -f json"
mirage: "sudo mirage wallet info -f json"
default: "sudo skale wallet info -f json"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.
done
| sudo {{ node_type }} boot signature {{ validator_id }} | ||
| {% else %} | ||
| sudo {{ node_type }} node signature {{ validator_id }} | ||
| {% if node_type == "mirage_boot" %} |
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.
use vars
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.
done
…m:skalenetwork/node-provisioning into support-mirage-boot-building-from-sources
This pull request introduces significant updates to the
skale-nodesAnsible playbooks and roles, focusing on improving node type handling, refining environment variable management, and enhancing the logic for building and deploying binaries. The changes streamline conditional checks, replace hardcoded values with dynamic ones, and improve code readability and flexibility. Below is a summary of the most important changes grouped by theme.Node Type Handling Improvements:
node_type == "skale",node_type == "mirage_boot", etc.), replacing ambiguous or undefined conditions. This ensures more precise handling of node-specific logic.Environment Variable Refinements:
manager_contractsvariable withhostvars['localhost']['sm_address']in several roles to ensure consistency and proper variable resolution.CONTAINER_CONFIGS_DIRbased on thebuild_typevariable in the configuration tasks.Binary Build and Deployment Enhancements:
node_typeandsync_node. Added failure conditions for undefined build targets or executable paths.skale_cliandmirage_cli, ensuring proper handling for bothgitandsourcebuild types.Command Composition Improvements:
node_type, replacing hardcoded commands. Added failure checks for undefined commands.Cleanup and Simplification:
env == "dev", and streamlined logic for tasks like synchronization and cleanup.