Skip to content

Commit

Permalink
Write Uncompressed to file
Browse files Browse the repository at this point in the history
  • Loading branch information
nesmabadr committed Jul 10, 2024
1 parent 0dff458 commit 77cf6d9
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions pkg/module/parse/template_to_module.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ import (
"github.com/kyma-project/lifecycle-manager/pkg/log"
"github.com/kyma-project/lifecycle-manager/pkg/module/common"
"github.com/kyma-project/lifecycle-manager/pkg/templatelookup"
"io"

Check failure on line 19 in pkg/module/parse/template_to_module.go

View workflow job for this annotation

GitHub Actions / lint

File is not `gci`-ed with --skip-generated -s standard -s default -s prefix(github.com/kyma-project/lifecycle-manager) -s blank -s dot --custom-order (gci)
machineryruntime "k8s.io/apimachinery/pkg/runtime"
"os"

Check failure on line 21 in pkg/module/parse/template_to_module.go

View workflow job for this annotation

GitHub Actions / lint

File is not `gofumpt`-ed (gofumpt)
"sigs.k8s.io/controller-runtime/pkg/client"
logf "sigs.k8s.io/controller-runtime/pkg/log"
)
Expand Down Expand Up @@ -273,20 +275,22 @@ func ReadAssociatedResourcesField(ctx context.Context, layer img.Layer) ([]strin
return nil, fmt.Errorf("failed to pull associated resources layer, %w", err)
}

blobReadCompressed, err := imgLayer.Compressed()
if err != nil {
return nil, fmt.Errorf("failed fetching blob for layer %s: %w", imageRef, err)
}
logf.FromContext(ctx).V(log.InfoLevel).Info(fmt.Sprintf("Compressed: %v", blobReadCompressed))
defer blobReadCompressed.Close()

blobReadUncompressed, err := imgLayer.Uncompressed()
if err != nil {
return nil, fmt.Errorf("failed fetching blob for layer %s: %w", imageRef, err)
}
logf.FromContext(ctx).V(log.InfoLevel).Info(fmt.Sprintf("Uncompressed====: %v", blobReadUncompressed))
defer blobReadUncompressed.Close()

outFile, err := os.Create("test.yaml")
if err != nil {
return nil, fmt.Errorf("file create failed for layer %s: %w", imageRef, err)
}
if _, err := io.Copy(outFile, blobReadUncompressed); err != nil {
return nil, fmt.Errorf("file copy storage failed for layer %s: %w", imageRef, err)
}
err = io.Closer(outFile).Close()

Check failure on line 292 in pkg/module/parse/template_to_module.go

View workflow job for this annotation

GitHub Actions / lint

ineffectual assignment to err (ineffassign)

// filePath := fmt.Sprintf("%s/%s:%s/%s", associatedResources.Repo, associatedResources.Name, descriptorVersion,
// img.AssociatedResourcesLayer)
// associatedResourcesContent, err := os.ReadFile(filePath)
Expand Down

0 comments on commit 77cf6d9

Please sign in to comment.