mirror of
https://github.com/openfaas/faasd.git
synced 2025-06-23 07:13:23 +00:00
Migrate to containerd v1.7.0 and update dependencies
* Updates containerd to v1.7.0 and new binary for 32-bit Arm OSes. * Updates Go dependencies - openfaas and external Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
This commit is contained in:
committed by
Alex Ellis
parent
9efd019e86
commit
c41c2cd9fc
43
vendor/github.com/Microsoft/hcsshim/pkg/ociwclayer/export.go
generated
vendored
43
vendor/github.com/Microsoft/hcsshim/pkg/ociwclayer/export.go
generated
vendored
@ -1,5 +1,5 @@
|
||||
// Package ociwclayer provides functions for importing and exporting Windows
|
||||
// container layers from and to their OCI tar representation.
|
||||
//go:build windows
|
||||
|
||||
package ociwclayer
|
||||
|
||||
import (
|
||||
@ -9,11 +9,9 @@ import (
|
||||
"path/filepath"
|
||||
|
||||
"github.com/Microsoft/go-winio/backuptar"
|
||||
"github.com/Microsoft/hcsshim"
|
||||
"github.com/Microsoft/hcsshim/internal/wclayer"
|
||||
)
|
||||
|
||||
var driverInfo = hcsshim.DriverInfo{}
|
||||
|
||||
// ExportLayerToTar writes an OCI layer tar stream from the provided on-disk layer.
|
||||
// The caller must specify the parent layers, if any, ordered from lowest to
|
||||
// highest layer.
|
||||
@ -21,25 +19,25 @@ var driverInfo = hcsshim.DriverInfo{}
|
||||
// The layer will be mounted for this process, so the caller should ensure that
|
||||
// it is not currently mounted.
|
||||
func ExportLayerToTar(ctx context.Context, w io.Writer, path string, parentLayerPaths []string) error {
|
||||
err := hcsshim.ActivateLayer(driverInfo, path)
|
||||
err := wclayer.ActivateLayer(ctx, path)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer func() {
|
||||
_ = hcsshim.DeactivateLayer(driverInfo, path)
|
||||
_ = wclayer.DeactivateLayer(ctx, path)
|
||||
}()
|
||||
|
||||
// Prepare and unprepare the layer to ensure that it has been initialized.
|
||||
err = hcsshim.PrepareLayer(driverInfo, path, parentLayerPaths)
|
||||
err = wclayer.PrepareLayer(ctx, path, parentLayerPaths)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = hcsshim.UnprepareLayer(driverInfo, path)
|
||||
err = wclayer.UnprepareLayer(ctx, path)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
r, err := hcsshim.NewLayerReader(driverInfo, path, parentLayerPaths)
|
||||
r, err := wclayer.NewLayerReader(ctx, path, parentLayerPaths)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -52,7 +50,9 @@ func ExportLayerToTar(ctx context.Context, w io.Writer, path string, parentLayer
|
||||
return cerr
|
||||
}
|
||||
|
||||
func writeTarFromLayer(ctx context.Context, r hcsshim.LayerReader, w io.Writer) error {
|
||||
func writeTarFromLayer(ctx context.Context, r wclayer.LayerReader, w io.Writer) error {
|
||||
linkRecords := make(map[[16]byte]string)
|
||||
|
||||
t := tar.NewWriter(w)
|
||||
for {
|
||||
select {
|
||||
@ -78,6 +78,27 @@ func writeTarFromLayer(ctx context.Context, r hcsshim.LayerReader, w io.Writer)
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
numberOfLinks, fileIDInfo, err := r.LinkInfo()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if numberOfLinks > 1 {
|
||||
if linkName, ok := linkRecords[fileIDInfo.FileID]; ok {
|
||||
// We've seen this file before, by another name, so put a hardlink in the tar stream.
|
||||
hdr := backuptar.BasicInfoHeader(name, 0, fileInfo)
|
||||
hdr.Mode = 0644
|
||||
hdr.Typeflag = tar.TypeLink
|
||||
hdr.Linkname = linkName
|
||||
if err := t.WriteHeader(hdr); err != nil {
|
||||
return err
|
||||
}
|
||||
continue
|
||||
}
|
||||
|
||||
// All subsequent names for this file will be hard-linked to this name
|
||||
linkRecords[fileIDInfo.FileID] = filepath.ToSlash(name)
|
||||
}
|
||||
|
||||
err = backuptar.WriteTarFileFromBackupStream(t, r, name, size, fileInfo)
|
||||
if err != nil {
|
||||
return err
|
||||
|
Reference in New Issue
Block a user