-
Notifications
You must be signed in to change notification settings - Fork 177
Conversation
Codecov Report
@@ Coverage Diff @@
## master #760 +/- ##
=========================================
+ Coverage 70.07% 71.27% +1.2%
=========================================
Files 64 67 +3
Lines 3519 3837 +318
=========================================
+ Hits 2466 2735 +269
- Misses 727 768 +41
- Partials 326 334 +8
Continue to review full report at Codecov.
|
for _, p := range m { | ||
str, ok := p.(string) | ||
if !ok { | ||
errs = append(errs, fmt.Errorf("invalid volume in service %q", s.service)) |
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 wonder if those checks could be removed, if we validate the compose file first using the json schema.
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.
Once we have schema validation then yeah, sure
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.
LGTM with small nits
Signed-off-by: Djordje Lukic <djordje.lukic@docker.com>
Signed-off-by: Djordje Lukic <djordje.lukic@docker.com>
Signed-off-by: Djordje Lukic <djordje.lukic@docker.com>
Remove the no longer used check for the relative path Signed-off-by: Djordje Lukic <djordje.lukic@docker.com>
Signed-off-by: Djordje Lukic <djordje.lukic@docker.com>
This check is done by the packager now Signed-off-by: Djordje Lukic <djordje.lukic@docker.com>
The map implementation of go iterates a map random;y so we can't know which error has what message. It's ok to remove this here because we have an e2e test (the final errors are sorted alphabetically). Signed-off-by: Djordje Lukic <djordje.lukic@docker.com>
1b17130
to
25bc6b4
Compare
A secret *must* be external, not *should* Signed-off-by: Djordje Lukic <lukic.djordje@gmail.com>
It can have more than one `:` in its definition. Signed-off-by: Djordje Lukic <djordje.lukic@docker.com>
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.
LGTM
- What I did
Created a "framework" to help write validation rules for a compose file, the
Validator
will do the heavy lifting of traversing all the properties in the compose file.The validator works in two phases:
relativepathrule
needs the top levelvolumes
to check if the volume exists.A rule has 3 parts:
The
Collect
method is called in the first phase, rules collect dependent data if needed here.The
Accept
method is used to filter out only thing that a rule needs to validateThe
Validate
method does the actual validation and returns a list of errors for a given value.The PR introduces two rules:
externalsecretrule
to force all secrets to be externalrelativepathrule
to ban relative paths in volumesIn a followup we should:
validate
commandI won't do them here since the changeset is starting to get big.
- How to verify it
Unit and e2e tests were added for the two rules
- A picture of a cute animal (not mandatory)