Initial push

This commit is contained in:
2026-08-11 09:00:01 +02:00
commit fe8b354adc
54 changed files with 12640 additions and 0 deletions
+33
View File
@@ -0,0 +1,33 @@
//go:build e2e
package e2e
import (
"archive/tar"
"errors"
"io"
"strings"
)
// firstFileInTar returns the contents of the first regular file in an archive
// produced by the Docker archive API.
func firstFileInTar(r io.Reader) (string, error) {
tr := tar.NewReader(r)
for {
hdr, err := tr.Next()
if errors.Is(err, io.EOF) {
return "", errors.New("archive contains no regular file")
}
if err != nil {
return "", err
}
if hdr.Typeflag != tar.TypeReg {
continue
}
var b strings.Builder
if _, err := io.Copy(&b, tr); err != nil {
return "", err
}
return b.String(), nil
}
}