Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump to Replace golang 1.10 with 1.12 #1384

Closed
wants to merge 1 commit into from

Conversation

rhatdan
Copy link
Member

@rhatdan rhatdan commented Mar 4, 2019

Signed-off-by: Daniel J Walsh [email protected]

Copy link
Member

@TomSweeneyRedHat TomSweeneyRedHat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM and thanks for saving me 10 minutes, was about to hit this.

@TomSweeneyRedHat
Copy link
Member

Well so much for the quick and easy touch. 1.12 is failing with a vet on a docker/types.go. It doesn't like that we have

        Parent     ID            `json:"parent,omitempty"`

in both the V2Image and V1Compatibility structs. I think we can change the one in the V1Compatibility struct (line 137) to

        ParentV1     ID          `json:"parent,omitempty"`

That compiles and seems to run, but I didn't test it much....

Here's the full error:

HEAD is now at 2c632d1a Merge pull request #1824 from cyphar/fix-mips-build-devNumber
ln -sf ../../opencontainers/runc/runc
# Run gofmt on version 1.11 and higher
# github.com/containers/buildah/docker
docker/types.go:164:2: struct field Parent repeats json tag "parent" also at types.go:137
Error: source package github.com/containers/buildah/docker does not pass go vet.
Makefile:66: recipe for target 'validate' failed
make: *** [validate] Error 1
The command "make install.tools install.libseccomp.sudo all runc validate SECURITYTAGS="apparmor seccomp"" exited with 2.

@rhatdan
Copy link
Member Author

rhatdan commented Mar 5, 2019

@mtrmac @nalind What should we do about this. I don't think there is a way to fix this.
Is there a way to tell golint to ignore this error.

@mtrmac
Copy link
Contributor

mtrmac commented Mar 5, 2019

At a first glance this rather looks like a real bug; is there a more complex point to it that I am missing?

@rhatdan
Copy link
Member Author

rhatdan commented Mar 12, 2019

@mtrmac Nope, the problem is this is in vendored code.

@vrothberg
Copy link
Member

@rhatdan, you can exclude the file from validation in the scripts, see https://github.com/containers/buildah/blob/master/tests/validate/gofmt.sh.

@mtrmac
Copy link
Contributor

mtrmac commented Mar 13, 2019

@rhatdan, you can exclude the file from validation in the scripts, see https://github.com/containers/buildah/blob/master/tests/validate/gofmt.sh.

How about just fixing the data structures? There’s no point in having a validation step if we are going to ignore its output.

A parent field in a JSON data structure just can’t both be a “a unique 64 character identifier of the image” and an ID == digest.Digest at the same time; this inconsistency is a real bug.


@mtrmac Nope, the problem is this is in vendored code.

https://github.com/containers/buildah/blob/master/docker/types.go is not vendored; it’s a manually-made copy.

@rhatdan
Copy link
Member Author

rhatdan commented Mar 13, 2019

@mtrmac What would you suggest we call it.

@mtrmac
Copy link
Contributor

mtrmac commented Mar 13, 2019

@mtrmac What would you suggest we call it.

This question does not make sense to me WRT the situation in docker/types.go.

@rh-atomic-bot
Copy link
Collaborator

☔ The latest upstream changes (presumably 8ceda28) made this pull request unmergeable. Please resolve the merge conflicts.

@vrothberg
Copy link
Member

I am seeing a similar issue in containers/image with go 1.12.

@vrothberg
Copy link
Member

vrothberg commented Apr 5, 2019

As mentioned above, we have the issue over at containers/image: https://github.com/containers/image/blob/master/manifest/docker_schema2.go#L151

However, when (un)marshalling, we would encounter an error (that we never saw) which gives me the impression we can rename the field to anything.

@rhatdan
Copy link
Member Author

rhatdan commented Apr 5, 2019

Yes the golang 1.12 error is present in Master. I was just about to send an email to you and Nalin about it.

@vrothberg
Copy link
Member

@rhatdan I did this in c/image (not merged) containers/image@3c99f1f

@rhatdan
Copy link
Member Author

rhatdan commented Apr 5, 2019

But this does not fix the golang 1.12 issue.

/home/dwalsh/go/src/github.com/containers/buildah/tests/../buildah --debug --registries-conf /home/dwalsh/go/src/github.com/containers/buildah/tests/registries.conf --root /var/tmp/tmpb4105aa0cb712a22b20b69f2/root --runroot /var/tmp/tmpb4105aa0cb712a22b20b69f2/runroot --storage-driver vfs bud --debug=false --signature-policy /home/dwalsh/go/src/github.com/containers/buildah/tests/policy.json -t target --target mytarget /home/dwalsh/go/src/github.com/containers/buildah/tests/bud/target 
STEP 1: FROM ubuntu:latest
Getting image source signatures
Copying blob 898c46f3b1a1 skipped: already exists
Copying blob 63366dfa0a50 done
Copying blob 041d4cd74a92 done
Copying blob 6e1bee0f8701 done
Copying config 94e814e2ef done
Writing manifest to image destination
Storing signatures
error creating build container: The following failures happened while trying to pull image specified by "ubuntu:latest" based on search registries in /home/dwalsh/go/src/github.com/containers/buildah/tests/registries.conf:
* "localhost/ubuntu:latest": Error determining manifest MIME type for docker://localhost/ubuntu:latest: pinging docker registry returned: Get https://localhost/v2/: dial tcp [::1]:443: connect: connection refused
* "docker.io/library/ubuntu:latest": Error committing the finished image: error adding layer with blob "sha256:63366dfa0a5076458e37ebae948bc7823bab256ca27e09ab94d298e37df4c2a3": error creating layer with ID "f03e2da849b45acfcb4824e392d435bad4f8bc7520c225fd634644bc5980dac6": open /var/tmp/tmpb4105aa0cb712a22b20b69f2/root/vfs/dir/f03e2da849b45acfcb4824e392d435bad4f8bc7520c225fd634644bc5980dac6/bin/bash: file exists
* "registry.fedoraproject.org/ubuntu:latest": Error determining manifest MIME type for docker://registry.fedoraproject.org/ubuntu:latest: Error reading manifest latest in registry.fedoraproject.org/ubuntu: manifest unknown: manifest unknown
* "registry.access.redhat.com/ubuntu:latest": Error determining manifest MIME type for docker://registry.access.redhat.com/ubuntu:latest: Error reading manifest latest in registry.access.redhat.com/ubuntu: unknown: Not Found

@vrothberg
Copy link
Member

@rhatdan the error is not linked to v1.12 but to Buildah's integration requiring a local registry with credentials to be running on the host. I hit the same issue last week and opened #1453 to kick off a discussion.

@vrothberg
Copy link
Member

The error does not occur in Travis (see https://travis-ci.org/containers/buildah/builds/516139048?utm_source=github_status&utm_medium=notification) which sets up everything. I think we should make the integration tests easier to reproduce and run on a dev machine.

@rhatdan
Copy link
Member Author

rhatdan commented Apr 5, 2019

I am not seeing this, I can now create the error with a much simpler command. It seems to be tied to the vfs storage driver.

Try
./buildah --storage-driver=vfs --root=/tmp/test1 ubuntu:latest

@rhatdan
Copy link
Member Author

rhatdan commented Apr 5, 2019

Also tied to ubuntu image. fedora and alpine working.

@rhatdan
Copy link
Member Author

rhatdan commented Apr 5, 2019

 ./buildah --storage-driver=vfs --root=/tmp/test2 pull ubuntu:latest 
Getting image source signatures
Copying blob 898c46f3b1a1 skipped: already exists
Copying blob 041d4cd74a92 done
Copying blob 6e1bee0f8701 done
Copying blob 63366dfa0a50 done
Copying config 94e814e2ef done
Writing manifest to image destination
Storing signatures
The following failures happened while trying to pull image specified by "ubuntu:latest" based on search registries in /etc/containers/registries.conf:
* "localhost/ubuntu:latest": Error determining manifest MIME type for docker://localhost/ubuntu:latest: pinging docker registry returned: Get https://localhost/v2/: dial tcp [::1]:443: connect: connection refused
* "docker.io/library/ubuntu:latest": Error committing the finished image: error adding layer with blob "sha256:63366dfa0a5076458e37ebae948bc7823bab256ca27e09ab94d298e37df4c2a3": error creating layer with ID "f03e2da849b45acfcb4824e392d435bad4f8bc7520c225fd634644bc5980dac6": open /tmp/test2/vfs/dir/f03e2da849b45acfcb4824e392d435bad4f8bc7520c225fd634644bc5980dac6/bin/bash: file exists
* "registry.fedoraproject.org/ubuntu:latest": Error determining manifest MIME type for docker://registry.fedoraproject.org/ubuntu:latest: Error reading manifest latest in registry.fedoraproject.org/ubuntu: manifest unknown: manifest unknown
* "quay.io/ubuntu:latest": Error determining manifest MIME type for docker://quay.io/ubuntu:latest: Error reading manifest latest in quay.io/ubuntu: error parsing HTTP 404 response body: invalid character '<' looking for beginning of value: "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2 Final//EN\">\n<title>404 Not Found</title>\n<h1>Not Found</h1>\n<p>The requested URL was not found on the server.  If you entered the URL manually please check your spelling and try again.</p>\n"
* "registry.access.redhat.com/ubuntu:latest": Error determining manifest MIME type for docker://registry.access.redhat.com/ubuntu:latest: Error reading manifest latest in registry.access.redhat.com/ubuntu: unknown: Not Found
* "registry.centos.org/ubuntu:latest": Error determining manifest MIME type for docker://registry.centos.org/ubuntu:latest: Error reading manifest latest in registry.centos.org/ubuntu: manifest unknown: manifest unknown

@rhatdan
Copy link
Member Author

rhatdan commented Apr 5, 2019

@nalind @mtrmac Any ideas?

@rhatdan
Copy link
Member Author

rhatdan commented Apr 5, 2019

This is the error line that matters:

  • "docker.io/library/ubuntu:latest": Error committing the finished image: error adding layer with blob "sha256:63366dfa0a5076458e37ebae948bc7823bab256ca27e09ab94d298e37df4c2a3": error creating layer with ID "f03e2da849b45acfcb4824e392d435bad4f8bc7520c225fd634644bc5980dac6": open /tmp/test2/vfs/dir/f03e2da849b45acfcb4824e392d435bad4f8bc7520c225fd634644bc5980dac6/bin/bash: file exists

@vrothberg
Copy link
Member

Seems to be related to VFS. Good catch @rhatdan. I only saw the red herring :^)

@vrothberg
Copy link
Member

Same for podman master.

@vrothberg
Copy link
Member

@vrothberg
Copy link
Member

It's a character device that we are not catching.

@vrothberg
Copy link
Member

The (dirty) diff below makes it work locally on my machine. Can you try it out @rhatdan?

diff --git a/vendor/github.com/containers/storage/drivers/copy/copy.go b/vendor/github.com/containers/storage/drivers/copy/copy.go
index bcbc612848df..449c2bd8a855 100644
--- a/vendor/github.com/containers/storage/drivers/copy/copy.go
+++ b/vendor/github.com/containers/storage/drivers/copy/copy.go
@@ -153,8 +153,8 @@ func DirCopy(srcDir, dstDir string, copyMode Mode, copyXattrs bool) error {
 
 		isHardlink := false
 
-		switch f.Mode() & os.ModeType {
-		case 0: // Regular file
+		switch mode := f.Mode(); {
+		case mode.IsRegular(): // Regular file
 			id := fileID{dev: stat.Dev, ino: stat.Ino}
 			if copyMode == Hardlink {
 				isHardlink = true
@@ -172,12 +172,12 @@ func DirCopy(srcDir, dstDir string, copyMode Mode, copyXattrs bool) error {
 				copiedFiles[id] = dstPath
 			}
 
-		case os.ModeDir:
+		case mode.IsDir():
 			if err := os.Mkdir(dstPath, f.Mode()); err != nil && !os.IsExist(err) {
 				return err
 			}
 
-		case os.ModeSymlink:
+		case mode&os.ModeSymlink != 0:
 			link, err := os.Readlink(srcPath)
 			if err != nil {
 				return err
@@ -187,14 +187,14 @@ func DirCopy(srcDir, dstDir string, copyMode Mode, copyXattrs bool) error {
 				return err
 			}
 
-		case os.ModeNamedPipe:
+		case mode&os.ModeNamedPipe != 0:
 			fallthrough
-		case os.ModeSocket:
+		case mode&os.ModeSocket != 0:
 			if err := unix.Mkfifo(dstPath, stat.Mode); err != nil {
 				return err
 			}
 
-		case os.ModeDevice:
+		case mode&os.ModeDevice!=0:
 			if rsystem.RunningInUserNS() {
 				// cannot create a device if running in user namespace
 				return nil
@@ -202,9 +202,11 @@ func DirCopy(srcDir, dstDir string, copyMode Mode, copyXattrs bool) error {
 			if err := unix.Mknod(dstPath, stat.Mode, int(stat.Rdev)); err != nil {
 				return err
 			}
+		case mode&os.ModeCharDevice!=0:
+			panic("IT S A CHAR DEVICE")
 
 		default:
-			return fmt.Errorf("unknown file type for %s", srcPath)
+			return fmt.Errorf("unknown file type (mode %s) for %s", f.Mode(), srcPath)
 		}
 
 		// Everything below is copying metadata from src to dst. All this metadata

@vrothberg
Copy link
Member

vrothberg commented Apr 5, 2019

@rhatdan, here's a PR: containers/storage#315

@vrothberg
Copy link
Member

The problem was that we were checking for full matches of the masks, so char devices were not covered by the ModeDevice check.

@rhatdan rhatdan changed the title Bump to Replace golang 1.10 with 1.12 [WIP] Bump to Replace golang 1.10 with 1.12 Apr 5, 2019
@rhatdan
Copy link
Member Author

rhatdan commented Apr 5, 2019

@vrothberg Worked for me locally will see if full tests works.

@mtrmac
Copy link
Contributor

mtrmac commented Apr 5, 2019

@rhatdan I did this in c/image (not merged) containers/image@3c99f1f

(Is there a PR?) This does not really make sense to me; schema2 is a fixed format with a fixed specification; we can’t just introduce a new field name for an existing field like this. (If it actually exists[*])

A parent field in a JSON data structure just can’t both be a “a unique 64 character identifier of the image” and an ID == digest.Digest at the same time; this inconsistency is a real bug.

If we can’t change the external formats, either our data structures just don’t match that format and should be fixed, or we are taking shortcuts (reusing data structures across formats that have different semantics in different formats) that we shouldn’t be taking, or, sure, the externally-defined formats may be inconsistently defined.

(It seems to kind of be all three at the same time; docker/docker similarly inherits the parent field, but it has explicit {v1+schema1}/schema2 conversion code that somewhat bypasses the marshaling/unmarshaling aspect, and in schema2 the JSON field seems to be ignored and replaced on load with a value stored elsewhere. So, the data structures don’t match the format, all three instances of the code are taking shortcuts, and to the extent that code in docker/docker is the canonical documentation, it is inconsistently defined.

[*] maybe that field does not “actually exist”, after all — but then we should remove it from the declaration, not rename it.)

@rhatdan
Copy link
Member Author

rhatdan commented Apr 6, 2019

Removing the field cause compilation errors.

Vendor in containers/storage v1.12.2

Signed-off-by: Daniel J Walsh <[email protected]>
@rhatdan rhatdan changed the title [WIP] Bump to Replace golang 1.10 with 1.12 Bump to Replace golang 1.10 with 1.12 Apr 6, 2019
@rhatdan
Copy link
Member Author

rhatdan commented Apr 6, 2019

Ok I checked upstream in Moby and they still have the duplicate name. I am just going to tell go vet to not check the docker types.

@rhatdan
Copy link
Member Author

rhatdan commented Apr 12, 2019

@TomSweeneyRedHat @vrothberg @giuseppe @nalind Lets get this merged PTAL.

Copy link
Member

@TomSweeneyRedHat TomSweeneyRedHat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but would like some other head nods before merging.

@vrothberg
Copy link
Member

LGTM, we need a similar go-vet trick when we bump c/image. I think it's to bump our other repos to 1.12 as well do avoid surprises.

@vrothberg
Copy link
Member

@rh-atomic-bot r+

@rh-atomic-bot
Copy link
Collaborator

📌 Commit 19f29cc has been approved by vrothberg

@rh-atomic-bot
Copy link
Collaborator

⌛ Testing commit 19f29cc with merge fcc12bd...

@rh-atomic-bot
Copy link
Collaborator

☀️ Test successful - status-papr, status-travis
Approved by: vrothberg
Pushing fcc12bd to master...

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants