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

Upgrade to Go 1.20.1 #44620

Merged
merged 2 commits into from Feb 22, 2023
Merged

Upgrade to Go 1.20.1 #44620

merged 2 commits into from Feb 22, 2023

Conversation

@thaJeztah thaJeztah changed the title [DNM] go1.2rc1 test [DNM] go1.20rc1 test Dec 9, 2022
@thaJeztah
Copy link
Member

Hm... 🤔

Setup go version spec 1.20rc1
Attempting to download 1.20rc1...
matching 1.20rc1...
Not found in manifest.  Falling back to download directly from Go
Error: Unable to find Go version '1.20rc1' for platform linux and architecture x64.

Oh! Wonder if they (for the fallback) try to download 1.20rc1 without the go prefix 🤔

@thaJeztah
Copy link
Member

thaJeztah commented Dec 9, 2022

https://github.com/actions/setup-go/blob/30c39bfe0c7338d0d8e99486938f1066b2f92108/src/installer.ts#L77

`Not found in manifest.  Falling back to download directly from Go'

https://github.com/actions/setup-go/blob/30c39bfe0c7338d0d8e99486938f1066b2f92108/src/installer.ts#L245

let version = makeSemver(candidate.version);

https://github.com/actions/setup-go/blob/30c39bfe0c7338d0d8e99486938f1066b2f92108/src/installer.ts#L249-L253

      goFile = candidate.files.find(file => {
        core.debug(
          `${file.arch}===${archFilter} && ${file.os}===${platFilter}`
        );
        return file.arch === archFilter && file.os === platFilter;

So, hm.. at a cursory glance; they download https://go.dev/dl/?mode=json&include=all

  • try to match a SemVer version (?), which go doesn't use
  • try to match against x64, but Go uses GOOS format, so the list will have amd64

@thaJeztah
Copy link
Member

LOL; this one is even more funny; this is the failure on Windows setting up Go;

Setup go version spec 1.20rc1
Attempting to download 1.20rc1...
matching 1.20rc1...
Not found in manifest.  Falling back to download directly from Go
Error: Unable to find Go version '1.20rc1' for platform linux and architecture x64.

"You had one job..."

@neersighted
Copy link
Member Author

It looks like this is fundamentally actions/setup-go#63, which is pretty stalled out upstream. We can use the RC by modifying our version strings to match GHA's expectations, but I think this is another case for my plan to centralize the Go version somewhere and plumb it through with scripts.

@neersighted neersighted changed the title [DNM] go1.20rc1 test [DNM] go1.20rc2 test Jan 10, 2023
@neersighted neersighted marked this pull request as ready for review January 10, 2023 17:06
@neersighted
Copy link
Member Author

Okay, this is ready for review in the sense that while it should not be merged, we are seeing the real CI failures and can start addressing them.

PTAL @thaJeztah @corhere @cpuguy83 @tianon

@thaJeztah
Copy link
Member

This one failure looks possibly genuine; I kicked ci at least once, but think it was the same failure first time;

=== FAIL: amd64.integration-cli TestDockerCLIRunSuite/TestCmdCannotBeInvoked (0.39s)
    docker_cli_run_test.go:3667: assertion failed: 
        Command:  /usr/local/cli/docker run --name testCmdCannotBeInvoked busybox /etc
        ExitCode: 125
        Error:    exit status 125
        Stdout:   
        Stderr:   /usr/local/cli/docker: Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: "/etc": is a directory: unknown.
        time="2023-01-11T22:33:24Z" level=error msg="error waiting for container: context canceled" 
        
        
        Failures:
        ExitCode was 125 expected 126
        Expected error to contain "exit status 126"
    --- FAIL: TestDockerCLIRunSuite/TestCmdCannotBeInvoked (0.39s)

=== FAIL: amd64.integration-cli TestDockerCLIRunSuite (206.38s)

@thaJeztah
Copy link
Member

Golangci-lint failure is likely because golangci is not yet compatible with go1.20

@neersighted
Copy link
Member Author

It looks like the OOM killer to me, though I'm not sure how to get dmesg from GHA without adding it as an explicit step (I'll try that next).

I don't think golangci-lint should need explicit compatibility with Go 1.20, and there are no open issues on their tracker that correlate. Is this typical behavior during a Go upgrade?

@thaJeztah
Copy link
Member

Haven't looked closely at the output. Perhaps you're right and I made the wrong assumption.

It is common though that golangci-lint fails to complete successfully on Go updates (although usually it gives an informative error message). We could try running it locally in a go1.20 container

@thaJeztah
Copy link
Member

thaJeztah commented Jan 11, 2023

The test failure could be string matching; I think those status code are based on output of "why the command failed" (it's ugly, but don't think there's better solutions for some of that); perhaps the error response from Golang was updated. I recently made some updates in that area in #43248

edit: code is here;

moby/daemon/errors.go

Lines 183 to 201 in 6d212fa

// isInvalidCommand tries to detect if the reason the container failed to start
// was due to an invalid command for the container (command not found, or not
// a valid executable).
func isInvalidCommand(errMessage string) bool {
errMessage = strings.ToLower(errMessage)
errMessages := []string{
"executable file not found",
"no such file or directory",
"system cannot find the file specified",
"failed to run runc create/exec call",
}
for _, msg := range errMessages {
if strings.Contains(errMessage, msg) {
return true
}
}
return false
}

@thaJeztah
Copy link
Member

rc3 is available now

@neersighted neersighted changed the title [DNM] go1.20rc2 test [DNM] go1.20rc3 test Jan 19, 2023
@neersighted neersighted changed the title [DNM] go1.20rc3 test [DNM] go1.20 test Feb 3, 2023
daemon/errors.go Outdated
Comment on lines 164 to 151
// syscall.EACCESS to syscall.EISDIR. Unfortunately docker/cli checks
// whether the error message contains syscall.EACCESS.Error() to
// determine whether to exit with code 126 or 125, so we have little
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh my god, when I glanced at this failure, I thought it might be something like that, but I did not fully comprehend the magnitude of coupling.

Copy link
Contributor

Choose a reason for hiding this comment

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

daemon/errors.go Outdated
Comment on lines 163 to 149
// Go 1.20 changed the error for attempting to execute a directory from
// syscall.EACCESS to syscall.EISDIR. Unfortunately docker/cli checks
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a compatibility issue which manifests when runc is compiled against Go 1.20, irrespective of the Go version that Moby is compiled with.

@corhere
Copy link
Contributor

corhere commented Feb 3, 2023

The TestIntegration/TestFileOpCopyIncludeExclude/worker=dockerd buildkit integration test is failing, but it is also failing on master so is unlikely to be a Go 1.20 problem. Everything else is green; I think we're good to go on Go 1.20!

@neersighted neersighted changed the title [DNM] go1.20 test Go 1.20 support Feb 13, 2023
@thaJeztah
Copy link
Member

Some questions;

  • Was the distribution/xfer: fix download fencepost bug commit intended to be part of the go1.20 related work?
  • I see that (but perhaps it's GitHub's presentation) the Go1.20.0 commit is first in the list of commits, but the golangci-lint and fixes related to go1.20 changes are after that; should the order be reversed?
  • I'm wondering if most (if not all) changes related to the deprecation and some other changes could already work on go1.19 (if so, we could consider including those into the 23.0 branch already in case that needs to be updated to go1.20 in future)

@corhere
Copy link
Contributor

corhere commented Feb 14, 2023

  • Was the distribution/xfer: fix download fencepost bug commit intended to be part of the go1.20 related work?

Yes, through a long causal chain. golangci-lint had to be bumped to a version which supports Go 1.20. The bumped golangci-lint flagged a loop-closure bug in the distribution/xfer unit tests. Fixing the loop-closure bug revealed that some of the unintentionally-skipped subtests fail. That commit gets the tests passing again.

  • I see that (but perhaps it's GitHub's presentation) the Go1.20.0 commit is first in the list of commits, but the golangci-lint and fixes related to go1.20 changes are after that; should the order be reversed?

That depends on your opinions on test-driven development. I feel it would be dishonest to invert the history, fixing things before they could have been known to be broken.

  • I'm wondering if most (if not all) changes related to the deprecation and some other changes could already work on go1.19 (if so, we could consider including those into the 23.0 branch already in case that needs to be updated to go1.20 in future)

Yes, all the changes could be backported.

@thaJeztah
Copy link
Member

That depends on your opinions on test-driven development. I feel it would be dishonest to invert the history, fixing things before they could have been known to be broken.

Only in this case, such changes were not due to the Go update, but because we updated a linter?

I can see where you're coming from, but I think "rewriting history" is already something we done with our rebase+squash/cleanup based workflow, that that should not be an issue. W.r.t. an "honest history"; where suitable, we can of course still include a mention of Go and/or Golang-CI versions in the commit message ("Older versions of GolangCI did not catch this error", or "In preparation of newer Go versions, which no longer allow this")

What we tended to do in the past is to;

  • Prepare changes needed for the Go update (if any) that already applied before the update itself
  • This may include addressing issues caught by newer versions of linters
  • Update the linter
  • Update Go, and changes that must go together with the Go update

Most of the time we did the preparation steps in a separate PR, both for visibility, as well as make backporting those changes to release branch(es) non-ambiguous (including it in the same PR as the Go update could otherwise mean "this is a partial backport, with commits X Y and Z omitted").

In this approach;

  • All changes leading up to the Go (and/or Linter) update would be tested in CI before updating Go itself; this allowed us to be sure those changes work with previous Go versions (thus could qualify for backporting if desired).
  • The Go update PR itself would be an "epic" (have a checkbox list with changes) so that we can still keep track of things related to the update (FWIW; this is one reason I tend to backport individual Go updates (e.g. see [20.10 backport] update to go1.19.6 #44990) - I track back all Go updates, and look if potentially other changes were not yet included in the branch. Having the individual commits in backports also helps correlate the changes with the main branch)
  • At that point, the Go update itself is more of a "ceremony" (it would only have the Go version update and only changes that MUST go together with the update (breaking changes))

@corhere
Copy link
Contributor

corhere commented Feb 15, 2023

@thaJeztah you make a very compelling argument. I've captured that in the repo wiki for the benefit of the next person to take on the task of bumping the Go version.

neersighted and others added 2 commits February 22, 2023 16:37
Signed-off-by: Bjorn Neergaard <bneergaard@mirantis.com>
Co-authored-by: Cory Snider <csnider@mirantis.com>
Signed-off-by: Cory Snider <csnider@mirantis.com>
Signed-off-by: Cory Snider <csnider@mirantis.com>
@corhere corhere changed the title Go 1.20 support Upgrade to Go 1.20.1 Feb 22, 2023
Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

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

LGTM

@neersighted
Copy link
Member Author

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants