-
Notifications
You must be signed in to change notification settings - Fork 279
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
Warns if user is using untrusted builder #720
Conversation
@@ -192,7 +192,11 @@ func (c *Client) Build(ctx context.Context, opts BuildOptions) error { | |||
} | |||
} | |||
|
|||
return c.lifecycle.Execute(ctx, lifecycleOpts) | |||
if err := c.lifecycle.Execute(ctx, lifecycleOpts); err != nil { |
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 put the error here, rather than on lifecycle.Analyze
or lifecycle.Export
, because that would be easiest to test (by substituting a failing lifecycle).
internal/commands/build.go
Outdated
if trustBuilder { | ||
logger.Debugf("Builder %s is trusted", style.Symbol(flags.Builder)) | ||
} else { | ||
logger.Warnf("Builder %s is untrusted", style.Symbol(flags.Builder)) |
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.
Should this be changed to a Debugf
?
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.
👍
Yeah, I think so. I don't think this should be something alarming since we do all the right things to make it none concerning. It's really just something we want them to know (in debug).
Also, might be worth adding a few more sentences about the side effects. eg. "executing sensitive phases separate containers." and/or "using a known lifecycle image to execute sensitive phases."
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.
Added, let me know what you think.
@@ -81,3 +81,19 @@ func getMirrors(config config.Config) map[string][]string { | |||
} | |||
return mirrors | |||
} | |||
|
|||
func isTrustedBuilder(cfg config.Config, builder string) bool { |
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.
This pattern is followed a number of times in the commands
, and should be refactored out in all cases. If that shouldn't be part of this refactor, I'm happy to undo this change and leave it for another PR.
Codecov Report
@@ Coverage Diff @@
## main #720 +/- ##
==========================================
+ Coverage 73.60% 73.66% +0.06%
==========================================
Files 71 71
Lines 5003 5014 +11
==========================================
+ Hits 3682 3693 +11
Misses 1004 1004
Partials 317 317
|
2a4fd20
to
7c2cacc
Compare
* Adds error message attributing lifecycle failure in untrusted case to untrusted builder Signed-off-by: David Freilich <dfreilich@vmware.com>
* Add more clarification around untrusted vs trusted builder Signed-off-by: David Freilich <dfreilich@vmware.com>
aa7a1d6
to
9ef2932
Compare
Signed-off-by: David Freilich dfreilich@vmware.com
Summary
This adds a warning if building with an untrusted builder, so the user understands that there may be some issues with it. This also adds an error if lifecycle execute fails, clarifying that it may be because the builder is untrusted.
Output
Before
After
Untrusted Builder:
With
--trust-builder
:Documentation
Related
Resolves #711