From d9e9f225049dd32de624b5897a267224c99e0faf Mon Sep 17 00:00:00 2001 From: Matej Vasek Date: Tue, 21 Mar 2023 23:41:52 +0100 Subject: [PATCH] fix: s2i build on Windows (#1644) Make all files executable on Windows s2i build. Signed-off-by: Matej Vasek --- s2i/builder.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/s2i/builder.go b/s2i/builder.go index b8196e4056..e2cad68020 100644 --- a/s2i/builder.go +++ b/s2i/builder.go @@ -10,6 +10,7 @@ import ( "net/url" "os" "path/filepath" + "runtime" "strings" "github.com/docker/docker/api/types" @@ -243,6 +244,11 @@ func (b *Builder) Build(ctx context.Context, f fn.Function) (err error) { } hdr.Name = filepath.ToSlash(p) + if runtime.GOOS == "windows" { + // Windows does not have execute permission, we assume that all files are executable. + hdr.Mode |= 0111 + } + err = tw.WriteHeader(hdr) if err != nil { return fmt.Errorf("cannot write header to thar stream: %w", err)