Skip to content

Commit

Permalink
fix: Improve and add some debug messages in overlay storage.
Browse files Browse the repository at this point in the history
This seeks to improve some of the existing debug messages and add some
additional debug in the overlay storage.

Signed-off-by: Scott Moser <[email protected]>
  • Loading branch information
smoser committed Oct 10, 2023
1 parent 9795f43 commit fd41a4b
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions pkg/overlay/pack.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,9 @@ func ConvertAndOutput(config types.StackerConfig, tag, name string, layerType ty
return err
}

log.Debugf("new oci layer %s [%s] created from path %s as part of %s:%s",
desc.Digest, layerType, overlayPath(config.RootFSDir, theLayer.Digest), name, tag)

Check warning on line 145 in pkg/overlay/pack.go

View check run for this annotation

Codecov / codecov/patch

pkg/overlay/pack.go#L143-L145

Added lines #L143 - L145 were not covered by tests
// slight hack, but this is much faster than a cp, and the
// layers are the same, just in different formats
err = os.Symlink(overlayPath(config.RootFSDir, theLayer.Digest), overlayPath(config.RootFSDir, desc.Digest))
Expand Down Expand Up @@ -218,7 +221,8 @@ func (o *overlay) initializeBasesInOutput(name string, layerTypes []types.LayerT
return err
}
} else {
log.Debugf("converting between %v and %v", sourceLayerType, layerType)
log.Debugf("creating oci image %s (type=%s) by converting %s (type=%s)",
layerType.LayerName(name), layerType, sourceLayerType.LayerName(name), sourceLayerType)

Check warning on line 225 in pkg/overlay/pack.go

View check run for this annotation

Codecov / codecov/patch

pkg/overlay/pack.go#L224-L225

Added lines #L224 - L225 were not covered by tests
err = ConvertAndOutput(o.config, cacheTag, name, layerType)
if err != nil {
return err
Expand Down Expand Up @@ -433,6 +437,7 @@ func generateLayer(config types.StackerConfig, oci casext.Engine, mutators []*mu
return false, errors.Wrapf(err, "couldn't make new layer overlay dir")
}

log.Debugf("renaming %s -> %s", dir, path.Join(target, "overlay"))

Check warning on line 440 in pkg/overlay/pack.go

View check run for this annotation

Codecov / codecov/patch

pkg/overlay/pack.go#L440

Added line #L440 was not covered by tests
err = os.Rename(dir, path.Join(target, "overlay"))
if err != nil {
if !os.IsExist(err) {
Expand Down Expand Up @@ -463,6 +468,7 @@ func generateLayer(config types.StackerConfig, oci casext.Engine, mutators []*mu
for _, desc := range descs[1:] {
linkPath := overlayPath(config.RootFSDir, desc.Digest)

log.Debugf("link %s -> %s", linkPath, target)

Check warning on line 471 in pkg/overlay/pack.go

View check run for this annotation

Codecov / codecov/patch

pkg/overlay/pack.go#L471

Added line #L471 was not covered by tests
err = os.Symlink(target, linkPath)
if err != nil {
// as above, this symlink may already exist; if it does, we can
Expand Down Expand Up @@ -534,7 +540,7 @@ func repackOverlay(config types.StackerConfig, name string, layerTypes []types.L
mutators = append(mutators, mutator)
}

log.Debugf("Generating overlay_dirs layers")
log.Debugf("Generating overlay_dirs layers for %s", name)

Check warning on line 543 in pkg/overlay/pack.go

View check run for this annotation

Codecov / codecov/patch

pkg/overlay/pack.go#L543

Added line #L543 was not covered by tests
mutated := false
for i, layerType := range layerTypes {
ods, ok := ovl.OverlayDirLayers[layerType]
Expand Down

0 comments on commit fd41a4b

Please sign in to comment.