Skip to content
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

Merged
merged 8 commits into from
Dec 11, 2018
Merged

Registry Auth #43

merged 8 commits into from
Dec 11, 2018

Conversation

ekcasey
Copy link
Member

@ekcasey ekcasey commented Nov 30, 2018

introduces PACK_REGISTRY_AUTH env var which allow platform to provide lifecycle with registry authorization

@ekcasey ekcasey force-pushed the registry-auth branch 6 times, most recently from c16d7b7 to 127108a Compare December 6, 2018 20:59
@ekcasey ekcasey changed the title WIP; Registry auth [do not merge] Registry Auth Dec 6, 2018
@ekcasey
Copy link
Member Author

ekcasey commented Dec 6, 2018

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).

Copy link
Member

@sclevine sclevine left a 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()

Copy link
Member

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 {
Copy link
Member

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") {
Copy link
Member

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": [
Copy link
Member

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)
})
//
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove stray //

if metadataPath != "" {
bMetadata, err := ioutil.ReadFile(metadataPath)
var err error
var imageNotAPackageYo image.Image
Copy link
Member

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

Copy link
Member Author

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

ekcasey and others added 8 commits December 7, 2018 17:02
* 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>
@ekcasey ekcasey merged commit 59ac786 into master Dec 11, 2018
@ekcasey ekcasey deleted the registry-auth branch December 13, 2018 14:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants