Skip to content

Commit

Permalink
fix(contrib): fix clairctl contrib (#3349)
Browse files Browse the repository at this point in the history
Signed-off-by: Benjamin Coenen <benjamin.coenen@corp.ovh.com>
  • Loading branch information
bnjjj authored and yesnault committed Sep 24, 2018
1 parent 9d826c3 commit 7a2d29a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
7 changes: 3 additions & 4 deletions contrib/grpcplugins/action/clair/clairctl/clair/layering.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func (layers *layering) pushAll() error {
}

lUID := xstrings.Substr(digest, 0, 12)
fmt.Printf("Pushing Layer %d/%d [%v]", index+1, layerCount, lUID)
fmt.Printf("Pushing Layer %d/%d [%v]\n", index+1, layerCount, lUID)
domain := reference.Domain(layers.image)
insertRegistryMapping(digest, domain)
u, _ := dockerdist.GetPushURL(domain)
Expand All @@ -88,7 +88,7 @@ func (layers *layering) pushAll() error {
}

if err := pushLayer(payload); err != nil {
fmt.Printf("adding layer %d/%d [%v]: %v", index+1, layerCount, lUID, err)
fmt.Printf("adding layer %d/%d [%v]: %v\n", index+1, layerCount, lUID, err)
if err != ErrUnanalizedLayer {
return err
}
Expand All @@ -114,10 +114,9 @@ func (layers *layering) analyzeAll() (ImageAnalysis, error) {
if a, err := analyzeLayer(digest); err != nil {
return ImageAnalysis{}, fmt.Errorf("analysing layer [%v] %d/%d: %v", lShort, index+1, layerCount, err)
} else {
fmt.Printf("analysing layer [%v] %d/%d", lShort, index+1, layerCount)
fmt.Printf("analysing layer [%v] %d/%d\n", lShort, index+1, layerCount)
res = append(res, a)
}
return ImageAnalysis{}, nil
}
return ImageAnalysis{
Registry: xstrings.TrimPrefixSuffix(reference.Domain(layers.image), "http://", "/v2"),
Expand Down
7 changes: 3 additions & 4 deletions contrib/grpcplugins/action/clair/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,16 @@ func (actPlugin *clairActionPlugin) Run(ctx context.Context, q *actionplugin.Act

dockerImage := q.GetOptions()["image"]

fmt.Printf("Pushing image %s into clair", dockerImage)
fmt.Printf("Pushing image %s into clair\n", dockerImage)
image, manifest, err := pushImage(dockerImage)
if err != nil {
return fail("Unable to push image on Clair: %s", err)
}

fmt.Printf("Running analysis")
fmt.Printf("Running analysis\n")
analysis, err := clair.Analyze(image, manifest)
if err != nil {
return fail("Error on running analys with Clair: %v", err)
return fail("Error on running analysis with Clair: %v", err)
}

fmt.Printf("Creating report")
Expand All @@ -85,7 +85,6 @@ func (actPlugin *clairActionPlugin) Run(ctx context.Context, q *actionplugin.Act

count := summary[v.Severity]
summary[v.Severity] = count + 1

}
}
}
Expand Down

0 comments on commit 7a2d29a

Please sign in to comment.