feat: Add new go build tag no_openziti to reduce build size #795
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
closes #789
The usage of OpenZiti packages to support zero trust feature significantly increases the build size. For example, core-metadata increases from 14MB to 21MB, core-command increases from 9.8MB to 17MB, device-virtual increases from 18MB to 31MB, and app-service-configurable increases from 22Mb to 34MB. As many edge user scenarios require to deploy EdgeX services on resource-constrained devices without security, allowing that the services can be built without OpenZiti packages and ZeroTrust features can be helpful to user cases which don't need zero trust feature.
This commit refactors the codes importing openziti packages with
//go:build !no_openziti
directive and creates para codes that don't use openziti packages with//go:build no_openziti
directive, so users can simply build services by specifyingno_openziti
tag to build out services without openziti zero trust feature.If your build fails due to your commit message not passing the build checks, please review the guidelines here: https://github.com/edgexfoundry/go-mod-bootstrap/blob/main/.github/Contributing.md
PR Checklist
Please check if your PR fulfills the following requirements:
BREAKING CHANGE:
describing the break)Testing Instructions
To test the new no_openziti build tag, please clone my forked edgex-go repository and checkout issue-789 branch:
The issue-789 branch has updated go.mod to replace go-mod-bootstrap with github.com/judehung/go-mod-bootstrap/v4 v4.0.0-20241109084700-c362e7cd73ed, which contains the changes of this PR:
The issue-789 branch also updates Makefile to include a new target
build-noziti
, and you can build the edgex-go services without openziti packages with following make command:This will build out core services and you can observe their binary executable size shrinks back to the same level as v3.1.
New Dependency Instructions (If applicable)
N/A