-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
oci runtime: preserve file ownership (#7790)
Fixes the issue mentioned here: https://buildbuddy-corp.slack.com/archives/C05GZM1EGM8/p1729695120908659?thread_ts=1727895825.533649&cid=C05GZM1EGM8
- Loading branch information
Showing
7 changed files
with
132 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
load("@io_bazel_rules_go//go:def.bzl", "go_library") | ||
|
||
go_library( | ||
name = "testtar", | ||
testonly = 1, | ||
srcs = ["testtar.go"], | ||
importpath = "github.com/buildbuddy-io/buildbuddy/server/testutil/testtar", | ||
visibility = ["//visibility:public"], | ||
deps = [ | ||
"@com_github_stretchr_testify//require", | ||
], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package testtar | ||
|
||
import ( | ||
"archive/tar" | ||
"bytes" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
// Entry returns a tar archive entry as bytes. | ||
// | ||
// Because tar archives are just a sequence of entries, the returned bytes | ||
// represent a valid tar file. To create a tar archive with multiple entries, | ||
// simply concatenate the bytes (e.g. using slices.Concat). | ||
func EntryBytes(t *testing.T, header *tar.Header, b []byte) []byte { | ||
var buf bytes.Buffer | ||
w := tar.NewWriter(&buf) | ||
err := w.WriteHeader(header) | ||
require.NoError(t, err) | ||
_, err = w.Write(b) | ||
require.NoError(t, err) | ||
err = w.Close() | ||
require.NoError(t, err) | ||
return buf.Bytes() | ||
} |