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

HLD for migrating sonic-gnmi to Bazel #1901

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

rlucus
Copy link
Contributor

@rlucus rlucus commented Jan 22, 2025

No description provided.

@mssonicbld
Copy link
Collaborator

/azp run

Copy link

No pipelines are associated with this pull request.

@mssonicbld
Copy link
Collaborator

/azp run

Copy link

No pipelines are associated with this pull request.


The primary Make file in each repository will be modified to point to new Bazel build targets and a build file added to each package.

Gazelle is used to keep build files and dependencies up to date with commands like `gazelle fix` and `gazelle update-repos`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Who runs these commands? Are the dependencies updated automatically during build?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can be added to the script for building, but I favor an approach of saying "If you update any dependencies, please also run these commands." Because the output should be confirmed for correctness.

- Local builds went from 20 minutes to 5 minutes on average.

- Consistency
- We found less issues when setting up new workstations for developers.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you elaborate? Are you talking about building locally on the developer workstation? If yes, please add an appendix section listing the best practices to setup this new build system.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes about locally building on workstation. I added a statement to the high level section above about documenting such things.

@mssonicbld
Copy link
Collaborator

/azp run

Copy link

No pipelines are associated with this pull request.

@hdwhdw hdwhdw self-requested a review February 25, 2025 18:44
Copy link

@hdwhdw hdwhdw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for proposing this. This should make development a lot more streamline and structural.


As part of this migration we will also provide a number of documents for setting up a developer environment and basic tasks with Bazel such as adding new components, maintaining dependencies, or debugging build issues.

#### Improvements
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider also elaborate on dev workflows, such as:

  1. bazel test //:foo_test as opposed to the bulk make check_gotest
  2. reproducibility

rm $(DESTDIR)/usr/sbin/gnoi_client
rm $(DESTDIR)/usr/sbin/gnmi_cli
```

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have an estimate on the amount of additional system resource require? I think bazel creates a sandbox-ed environment so it might takes some additional disk/memory. Not that it matters but just curious.

go mod tidy && gazelle fix && bazel run :gazelle-update-repos
```

#### Change to Makefile
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently this Makefile only work for sonic-gnmi located in the structure of buildimage https://github.com/hdwhdw/sonic-gnmi/blob/master/Makefile#L10

Do we need any hack to handle this dependencies from sonic-mgmt-common with bazel?

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

Successfully merging this pull request may close these issues.

4 participants