Merged master and fixed merge conflicts
This commit is contained in:
		
						commit
						04cca43ce4
					
				|  | @ -85,7 +85,8 @@ func execute() error { | |||
| 	} | ||||
| 
 | ||||
| 	// Initialize source image
 | ||||
| 	if err := image.InitializeSourceImage(baseImage); err != nil { | ||||
| 	sourceImage, err := image.NewSourceImage(baseImage) | ||||
| 	if err != nil { | ||||
| 		return err | ||||
| 	} | ||||
| 
 | ||||
|  | @ -142,5 +143,5 @@ func execute() error { | |||
| 		} | ||||
| 	} | ||||
| 	// Push the image
 | ||||
| 	return image.PushImage(destination) | ||||
| 	return image.PushImage(sourceImage, destination) | ||||
| } | ||||
|  |  | |||
|  | @ -31,7 +31,7 @@ install_dep() { | |||
| } | ||||
| 
 | ||||
| if [ -z "$VALIDATE_UPSTREAM" ]; then | ||||
| 	VALIDATE_REPO='git@github.com:GoogleCloudPlatform/skaffold.git' | ||||
| 	VALIDATE_REPO='git@github.com:GoogleCloudPlatform/k8s-container-builder.git' | ||||
| 	VALIDATE_BRANCH='master' | ||||
| 
 | ||||
| 	VALIDATE_HEAD="$(git rev-parse --verify HEAD)" | ||||
|  |  | |||
|  | @ -4,16 +4,7 @@ | |||
|     "Image2": "gcr.io/kbuild-test/kbuild-test-run:latest", | ||||
|     "DiffType": "File", | ||||
|     "Diff": { | ||||
|       "Adds": [ | ||||
|         { | ||||
|           "Name": "/bin/bzcat", | ||||
|           "Size": 35448 | ||||
|         }, | ||||
|         { | ||||
|           "Name": "/bin/bzip2", | ||||
|           "Size": 35448 | ||||
|         } | ||||
|       ], | ||||
|       "Adds": null, | ||||
|       "Dels": null, | ||||
|       "Mods": [ | ||||
|         { | ||||
|  |  | |||
|  | @ -15,5 +15,5 @@ | |||
| # Builds the static Go image to execute in a Kubernetes job | ||||
| 
 | ||||
| FROM scratch | ||||
| ADD out/executor /work-dir/executor | ||||
| ADD out/executor /kbuild/executor | ||||
| ADD files/ca-certificates.crt /etc/ssl/certs/ | ||||
|  |  | |||
|  | @ -55,7 +55,7 @@ type testyaml struct { | |||
| } | ||||
| 
 | ||||
| var executorImage = "executor-image" | ||||
| var executorCommand = "/work-dir/executor" | ||||
| var executorCommand = "/kbuild/executor" | ||||
| var dockerImage = "gcr.io/cloud-builders/docker" | ||||
| var ubuntuImage = "ubuntu" | ||||
| var testRepo = "gcr.io/kbuild-test/" | ||||
|  |  | |||
|  | @ -1,9 +1,12 @@ | |||
| /* | ||||
| Copyright 2018 Google LLC | ||||
| 
 | ||||
| Licensed under the Apache License, Version 2.0 (the "License"); | ||||
| you may not use this file except in compliance with the License. | ||||
| You may obtain a copy of the License at | ||||
| 
 | ||||
|     http://www.apache.org/licenses/LICENSE-2.0
 | ||||
| 
 | ||||
| Unless required by applicable law or agreed to in writing, software | ||||
| distributed under the License is distributed on an "AS IS" BASIS, | ||||
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
|  |  | |||
|  | @ -1,9 +1,12 @@ | |||
| /* | ||||
| Copyright 2018 Google LLC | ||||
| 
 | ||||
| Licensed under the Apache License, Version 2.0 (the "License"); | ||||
| you may not use this file except in compliance with the License. | ||||
| You may obtain a copy of the License at | ||||
| 
 | ||||
|     http://www.apache.org/licenses/LICENSE-2.0
 | ||||
| 
 | ||||
| Unless required by applicable law or agreed to in writing, software | ||||
| distributed under the License is distributed on an "AS IS" BASIS, | ||||
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
|  |  | |||
|  | @ -27,34 +27,22 @@ import ( | |||
| ) | ||||
| 
 | ||||
| // sourceImage is the image that will be modified by the executor
 | ||||
| var sourceImage img.MutableSource | ||||
| 
 | ||||
| // InitializeSourceImage initializes the source image with the base image
 | ||||
| func InitializeSourceImage(srcImg string) error { | ||||
| func NewSourceImage(srcImg string) (*img.MutableSource, error) { | ||||
| 	logrus.Infof("Initializing source image %s", srcImg) | ||||
| 	ref, err := docker.ParseReference("//" + srcImg) | ||||
| 	if err != nil { | ||||
| 		return err | ||||
| 		return nil, err | ||||
| 	} | ||||
| 	ms, err := img.NewMutableSource(ref) | ||||
| 	if err != nil { | ||||
| 		return err | ||||
| 	} | ||||
| 	sourceImage = *ms | ||||
| 	return nil | ||||
| } | ||||
| 
 | ||||
| // AppendLayer appends a layer onto the base image
 | ||||
| func AppendLayer(contents []byte, author string) error { | ||||
| 	logrus.Info("Appending layer to base image") | ||||
| 	return sourceImage.AppendLayer(contents, author) | ||||
| 	return img.NewMutableSource(ref) | ||||
| } | ||||
| 
 | ||||
| // PushImage pushes the final image
 | ||||
| func PushImage(destImg string) error { | ||||
| func PushImage(ms *img.MutableSource, destImg string) error { | ||||
| 	srcRef := &img.ProxyReference{ | ||||
| 		ImageReference: nil, | ||||
| 		Src:            &sourceImage, | ||||
| 		Src:            ms, | ||||
| 	} | ||||
| 	destRef, err := alltransports.ParseImageName("docker://" + destImg) | ||||
| 	if err != nil { | ||||
|  |  | |||
|  | @ -39,7 +39,7 @@ func TestSnapshotFileChange(t *testing.T) { | |||
| 	newFiles := map[string]string{ | ||||
| 		"foo":        "newbaz1", | ||||
| 		"bar/bat":    "baz", | ||||
| 		"work-dir/bat": "bat", | ||||
| 		"kbuild/bat": "bat", | ||||
| 	} | ||||
| 	if err := testutil.SetupFiles(testDir, newFiles); err != nil { | ||||
| 		t.Fatalf("Error setting up fs: %s", err) | ||||
|  | @ -135,14 +135,14 @@ func TestSnapshotFiles(t *testing.T) { | |||
| 	// Make some changes to the filesystem
 | ||||
| 	newFiles := map[string]string{ | ||||
| 		"foo":         "newbaz1", | ||||
| 		"work-dir/file": "bat", | ||||
| 		"kbuild/file": "bat", | ||||
| 	} | ||||
| 	if err := testutil.SetupFiles(testDir, newFiles); err != nil { | ||||
| 		t.Fatalf("Error setting up fs: %s", err) | ||||
| 	} | ||||
| 	filesToSnapshot := []string{ | ||||
| 		filepath.Join(testDir, "foo"), | ||||
| 		filepath.Join(testDir, "work-dir/file"), | ||||
| 		filepath.Join(testDir, "kbuild/file"), | ||||
| 	} | ||||
| 	contents, err := snapshotter.TakeSnapshotOfFiles(filesToSnapshot) | ||||
| 	if err != nil { | ||||
|  | @ -199,7 +199,7 @@ func setUpTestDir() (string, *Snapshotter, error) { | |||
| 	files := map[string]string{ | ||||
| 		"foo":         "baz1", | ||||
| 		"bar/bat":     "baz2", | ||||
| 		"work-dir/file": "file", | ||||
| 		"kbuild/file": "file", | ||||
| 	} | ||||
| 	// Set up initial files
 | ||||
| 	if err := testutil.SetupFiles(testDir, files); err != nil { | ||||
|  |  | |||
|  | @ -28,7 +28,7 @@ import ( | |||
| 	"strings" | ||||
| ) | ||||
| 
 | ||||
| var whitelist = []string{"/work-dir"} | ||||
| var whitelist = []string{"/kbuild"} | ||||
| 
 | ||||
| // ExtractFileSystemFromImage pulls an image and unpacks it to a file system at root
 | ||||
| func ExtractFileSystemFromImage(img string) error { | ||||
|  |  | |||
|  | @ -46,7 +46,7 @@ func Test_fileSystemWhitelist(t *testing.T) { | |||
| 	} | ||||
| 
 | ||||
| 	actualWhitelist, err := fileSystemWhitelist(path) | ||||
| 	expectedWhitelist := []string{"/work-dir", "/proc", "/dev", "/dev/pts", "/sys"} | ||||
| 	expectedWhitelist := []string{"/kbuild", "/proc", "/dev", "/dev/pts", "/sys"} | ||||
| 	sort.Strings(actualWhitelist) | ||||
| 	sort.Strings(expectedWhitelist) | ||||
| 	testutil.CheckErrorAndDeepEqual(t, false, err, expectedWhitelist, actualWhitelist) | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue