-
Notifications
You must be signed in to change notification settings - Fork 174
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
Enforce restrictions on dependency relationships between packages #8284
Open
zjs
wants to merge
8
commits into
vmware:master
Choose a base branch
from
zjs:topic/deps
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Address warnings from shellcheck (e.g., properly quoting expressions and combining conditionals) to better follow bash best practices. Additionally, introduce our standard set line to catch errors earlier and conditionally provide debugging output.
Introduce a script to enforce rules about dependency relationships between packages in the project. This script leverages the existing go-deps.sh script, including its caching logic (enabled by setting VIC_CACHE_DEPS).
hickeng
reviewed
Sep 20, 2018
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.
I've reviewed the mechanism and changes - I've not reviewed all of the deps files. I assume they are both sufficient and minimal at this time and I do not want to get distracted trying to track down why some of the odd dependencies exist in this PR.
Define an initial set of dependency enforcement rules based on the current state of the codebase. Some problematic relationships were identified and annotated.
Add dependency relationship enforcement to the checks stage of the build process so that it runs as a part of CI.
Add TODOs to track bad dependencies
hickeng
approved these changes
Dec 11, 2018
renmaosheng
approved these changes
Jan 2, 2019
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Enforce whitelist-based restrictions on the dependency relationship between packages. This allows us to ensure that undesirable dependency relationships are not introduced.
The enforcement works by enumerating the go packages, finding the applicable
.godeps_rules
file (looking first in the package's directory, then looking recursively in parent directories, and finally falling back to/dev/null
— essentially "default deny"). Each rules file is a list of regular expressions to be evaluated bygrep
(with support for full-line#
-prefixed comments).The enforcement script leverages the existing
go-deps.sh
script, including its caching logic (enabled by settingVIC_CACHE_DEPS
, purged viamake cleandeps
).Careful review of PRs that introduce or modify rule files will be necessary for this enforcement to be as effective as possible.
Fixes #8203
I've created #8294 to track resolution of existing undesirable dependency relationships.
Please review both the enforcement script itself and the initial dependency rules, which are written by hand based on my understanding of the codebase and may have errors as a result.