[Technical Design][Draft] Bazel for Provisioning #192
MuhammedIrfan
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Introduction
Bazel is an open-source build and test tool that scalably supports multi-language and multi-platform projects. it speeds up tests and builds by rebuilding only necessary parts, it is also scalable and can be extended with additional features to suit different needs. At present icon bridge primarily rely on bash scripts to perform task automation such as building and deploying smart contracts, It is unreliable and difficult to manage.
Terminology
Considerations
Though Bazel is used primarily for build and testing, Its dependency mapping, modularity, and hermetic nature makes it a good candidate to be used for provision, The NEAR integration in hugobyte/feature/bazel branch utilizes Bazel for provisioning
Design
Project Structure
bridge
: Contains rules that basically create a bridge between given two chains, It primarily contains a macro that will expand to the provided rules of the chain.chain_repositories
: Here we would define where to find local repositoriescmd/iconbridge
: This contains rules for building iconbridge and container image.cmd/iconvalidators
: This contains rules for building iconvalidators.javascore/icon
: This is being declared as a workspace so that we will be able to access rules in this folder using@icon
notation, contains rules for local icon node as well as provides certain rules for bridge configuration.javascore/icon/cli
: The rules performs the utilities of a cli ie deploying smart contracts, adding links and services etc.javascore/icon/cli/configs
: To Add private keys and key secrets, and is ignored from vcs.patches
: Some patches that will be applied while building the packages.rust/near
: This is being declared as a workspace so that we will be able to access rules in this folder using@near
notation, contains rules for local near node as well as provides certain rules for bridge configuration.rust/neat/cli
: The rules performs the utilities of a cli ie deploying smart contracts, adding links and services etc.rust/near/cli/configs
: To Add private keys and key secrets, and is ignored from vcs.utils
: Utility scripts such as wait until, to check open port etc.Pre requisites
Usage
Bridge can be deployed using the following commands.
bazel run @btp//cmd/iconbridge:iconbridge_image --incompatible_enable_cc_toolchain_resolution --extra_toolchains @zig_sdk//:linux_amd64_gnu.2.19_toolchain
bazel run @btp//bridge:icon_to_near --define near_network=testnet --define icon_network=lisbon
bazel run @btp//bridge:near_to_icon --define near_network=testnet --define icon_network=lisbon
The above rules will build, deploy, and setup the bridge.
Conclusion
With Bazel,
1 This is a workaround done due to the limitation of the optimizedJar grade plugin, We need to migrate that to use bazel to build natively in bazel avoiding the gradle
Beta Was this translation helpful? Give feedback.
All reactions