Skip to content

Commit

Permalink
fix: direct upload ppc64le, x390x (knative#1958)
Browse files Browse the repository at this point in the history
Signed-off-by: Matej Vasek <mvasek@redhat.com>
  • Loading branch information
matejvasek committed Sep 27, 2023
1 parent f3196e1 commit 0669afb
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pkg/k8s/persistent_volumes.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ var TarImage = "quay.io/boson/alpine-socat:1.7.4.3-r1-non-root"

// UploadToVolume uploads files (passed in form of tar stream) into volume.
func UploadToVolume(ctx context.Context, content io.Reader, claimName, namespace string) error {
return runWithVolumeMounted(ctx, TarImage, []string{"tar", "-xmf", "-"}, content, claimName, namespace)
return runWithVolumeMounted(ctx, TarImage, []string{"sh", "-c", "umask 0000 && exec tar -xmf -"}, content, claimName, namespace)
}

// Runs a pod with given image, command and stdin
Expand Down
18 changes: 17 additions & 1 deletion pkg/pipelines/tekton/pipelines_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,10 +252,26 @@ func sourcesAsTarStream(f fn.Function) *io.PipeReader {

pr, pw := io.Pipe()

const nobodyID = 65534

const up = ".." + string(os.PathSeparator)
go func() {
tw := tar.NewWriter(pw)
err := filepath.Walk(f.Root, func(p string, fi fs.FileInfo, err error) error {

err := tw.WriteHeader(&tar.Header{
Typeflag: tar.TypeDir,
Name: "source/",
Mode: 0777,
Uid: nobodyID,
Gid: nobodyID,
Uname: "nobody",
Gname: "nobody",
})
if err != nil {
_ = pw.CloseWithError(fmt.Errorf("error while creating tar stream from sources: %w", err))
}

err = filepath.Walk(f.Root, func(p string, fi fs.FileInfo, err error) error {
if err != nil {
return fmt.Errorf("error traversing function directory: %w", err)
}
Expand Down

0 comments on commit 0669afb

Please sign in to comment.