Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: direct upload OCP ppc64le, s390x #1958

Merged
merged 1 commit into from
Sep 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -245,10 +245,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
Loading