Skip to content

Commit

Permalink
fix: s2i build on Windows (#1644)
Browse files Browse the repository at this point in the history
Make all files executable on Windows s2i build.

Signed-off-by: Matej Vasek <mvasek@redhat.com>
  • Loading branch information
matejvasek committed Mar 21, 2023
1 parent 1dd4eb6 commit d9e9f22
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions s2i/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"net/url"
"os"
"path/filepath"
"runtime"
"strings"

"github.com/docker/docker/api/types"
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit d9e9f22

Please sign in to comment.