-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #63 from phillipsj/feature/windows-changes
Fixes various Windows specific bugs discovered during test.
- Loading branch information
Showing
11 changed files
with
99 additions
and
23 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
//go:build !windows | ||
// +build !windows | ||
|
||
package applyinator | ||
|
||
import ( | ||
"os" | ||
|
||
"github.com/sirupsen/logrus" | ||
) | ||
|
||
// reconcileFilePermissions abstracts out the file permissions checks that only works on Linux. | ||
func reconcileFilePermissions(path string, uid int, gid int, perm os.FileMode) error { | ||
logrus.Debugf("reconciling file permissions for %s to %d:%d %d", path, uid, gid, perm) | ||
if err := os.Chmod(path, perm); err != nil { | ||
return err | ||
} | ||
return os.Chown(path, uid, gid) | ||
} |
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,16 @@ | ||
//go:build windows | ||
// +build windows | ||
|
||
package applyinator | ||
|
||
import ( | ||
"os" | ||
|
||
"github.com/sirupsen/logrus" | ||
) | ||
|
||
// reconcileFilePermissions abstracts out the file permissions checks and are a no op on Windows | ||
func reconcileFilePermissions(path string, uid int, gid int, perm os.FileMode) error { | ||
logrus.Debugf("windows file permissions for %s will not be reconciled to %d:%d %d", path, uid, gid, perm) | ||
return nil | ||
} |
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,14 @@ | ||
//go:build !windows | ||
// +build !windows | ||
|
||
package image | ||
|
||
import ( | ||
v1 "github.com/google/go-containerregistry/pkg/v1" | ||
"github.com/rancher/wharfie/pkg/extract" | ||
) | ||
|
||
// extractFiles was extracted as method to assist with differences in Windows. | ||
func extractFiles(img v1.Image, dir string) error { | ||
return extract.Extract(img, dir) | ||
} |
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,18 @@ | ||
//go:build windows | ||
// +build windows | ||
|
||
package image | ||
|
||
import ( | ||
v1 "github.com/google/go-containerregistry/pkg/v1" | ||
"github.com/rancher/wharfie/pkg/extract" | ||
) | ||
|
||
// extractFiles was abstracted because Windows containers don't have a concept of a scratch container. | ||
// So files need to be placed in a subdirectory. | ||
func extractFiles(img v1.Image, dir string) error { | ||
extractPaths := map[string]string{ | ||
"/Files/bin": dir, | ||
} | ||
return extract.ExtractDirs(img, extractPaths) | ||
} |