-
Notifications
You must be signed in to change notification settings - Fork 107
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
Registry Auth #43
Registry Auth #43
Conversation
c16d7b7
to
127108a
Compare
This PR improves performance of lifecycle when writing to and writing from a docker daemon. Exporter and Analyzer can now always run inside a container. We removed flags that supported other workflows (used by pack). |
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.
A few comments, not complete
analyzer.go
Outdated
func (a *Analyzer) Analyze(launchDir string, config AppImageMetadata) error { | ||
func (a *Analyzer) Analyze(image image.Image, launchDir string) error { | ||
found, err := image.Found() | ||
|
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.
Remove newline
analyzer.go
Outdated
return err | ||
} | ||
|
||
if found { |
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.
Use structure:
if !found {
// unhappy, skip analyze
}
// happy, get metadata
Sort of like: https://github.com/golang/go/wiki/CodeReviewComments#indent-error-flow
analyzer.go
Outdated
return "", cmd.FailErr(err, "image configfile", repoName) | ||
func (a *Analyzer) getMetadata(image image.Image) (*AppImageMetadata, error) { | ||
label, err := image.Label(MetadataLabel) | ||
if err != nil && strings.Contains(err.Error(), "does not exist") { |
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.
Is there a sentinel error we can match on here? If not, this is fine.
analyzer_test.go
Outdated
it.Before(func() { | ||
image.EXPECT().Found().Return(true, nil) | ||
image.EXPECT().Label("io.buildpacks.lifecycle.metadata").Return(` | ||
{"buildpacks": [ |
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.
Clean up JSON.
analyzer_test.go
Outdated
} | ||
]}`, 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.
Remove stray //
cmd/analyzer/main.go
Outdated
if metadataPath != "" { | ||
bMetadata, err := ioutil.ReadFile(metadataPath) | ||
var err error | ||
var imageNotAPackageYo image.Image |
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.
Don't use silly names
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.
oops lol, we meant to change that
* This allows the platform to provide authorization to analyzer/exporter running in a container without the proper credentials Signed-off-by: Emily Casey <ecasey@pivotal.io>
* Daemon implementation is more performant than go-containerregistry for our use case * Moved from pack Signed-off-by: Jacques Chester <jchester@pivotal.io> Signed-off-by: Emily Casey <ecasey@pivotal.io>
Signed-off-by: Emily Casey <ecasey@pivotal.io> Signed-off-by: Jacques Chester <jchester@pivotal.io>
Signed-off-by: Matthew McNew <mmcnew@pivotal.io> Signed-off-by: Andrew Meyer <ameyer@pivotal.io>
Signed-off-by: Matthew McNew <mmcnew@pivotal.io> Signed-off-by: Emily Casey <ecasey@pivotal.io>
Signed-off-by: Matthew McNew <mmcnew@pivotal.io> Signed-off-by: Emily Casey <ecasey@pivotal.io>
* analyzer and exporter can be run on build or builder image Signed-off-by: Emily Casey <ecasey@pivotal.io> Signed-off-by: Matthew McNew <mmcnew@pivotal.io>
Signed-off-by: Emily Casey <ecasey@pivotal.io> Signed-off-by: Matthew McNew <mmcnew@pivotal.io>
0d5d18f
to
59ac786
Compare
introduces
PACK_REGISTRY_AUTH
env var which allow platform to provide lifecycle with registry authorization