commit
0ddc2115a5
|
|
@ -0,0 +1,25 @@
|
|||
steps:
|
||||
# First, install make
|
||||
- name: "gcr.io/google-appengine/debian9"
|
||||
args: ["sh", "-c", "apt-get update && apt-get install -y make"]
|
||||
volumes:
|
||||
- name: "make"
|
||||
path: "/usr/bin"
|
||||
- name: "gcr.io/google-appengine/debian9"
|
||||
args: ["sh", "-c", "cp -r . /kaniko/ && mkdir -p /workspace/go/src/github.com/GoogleCloudPlatform/ && cp -r /kaniko/ /workspace/go/src/github.com/GoogleCloudPlatform/"]
|
||||
volumes:
|
||||
- name: "make"
|
||||
path: "/usr/bin"
|
||||
# Then, build the binary
|
||||
- name: "gcr.io/google-appengine/golang"
|
||||
args: ["sh", "-c", "make"]
|
||||
volumes:
|
||||
- name: "make"
|
||||
path: "/usr/bin"
|
||||
dir: go/src/github.com/GoogleCloudPlatform/kaniko
|
||||
env: ["GOPATH=/workspace/go/"]
|
||||
# Then, build kaniko with kaniko
|
||||
- name: "gcr.io/kaniko-project/executor:latest"
|
||||
args: ["--dockerfile=/workspace/deploy/Dockerfile",
|
||||
"--context=/workspace/go/src/github.com/GoogleCloudPlatform/kaniko/",
|
||||
"--destination=gcr.io/kaniko-project/executor:${COMMIT_SHA}"]
|
||||
|
|
@ -29,6 +29,9 @@ const (
|
|||
//KanikoDir is the path to the Kaniko directory
|
||||
KanikoDir = "/kaniko"
|
||||
|
||||
// KanikoExecutor is the path to the kaniko executor
|
||||
KanikoExecutor = "/kaniko/executor"
|
||||
|
||||
WhitelistPath = "/proc/self/mountinfo"
|
||||
|
||||
Author = "kaniko"
|
||||
|
|
|
|||
|
|
@ -81,6 +81,7 @@ func (s *Snapshotter) TakeSnapshotOfFiles(files []string) ([]byte, error) {
|
|||
buf := bytes.NewBuffer([]byte{})
|
||||
w := tar.NewWriter(buf)
|
||||
defer w.Close()
|
||||
filesAdded := false
|
||||
for _, file := range files {
|
||||
info, err := os.Lstat(file)
|
||||
if err != nil {
|
||||
|
|
@ -96,9 +97,13 @@ func (s *Snapshotter) TakeSnapshotOfFiles(files []string) ([]byte, error) {
|
|||
return nil, err
|
||||
}
|
||||
if maybeAdd {
|
||||
filesAdded = true
|
||||
util.AddToTar(file, info, w)
|
||||
}
|
||||
}
|
||||
if !filesAdded {
|
||||
return nil, nil
|
||||
}
|
||||
return ioutil.ReadAll(buf)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -57,6 +57,9 @@ func ExtractFileSystemFromImage(img string) error {
|
|||
|
||||
// PathInWhitelist returns true if the path is whitelisted
|
||||
func PathInWhitelist(path, directory string) bool {
|
||||
if path == constants.KanikoExecutor {
|
||||
return false
|
||||
}
|
||||
for _, d := range whitelist {
|
||||
dirPath := filepath.Join(directory, d)
|
||||
if pkgutil.HasFilepathPrefix(path, dirPath) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue