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

fix: install toolchain version #15645

Merged
merged 1 commit into from
Dec 17, 2024
Merged

Conversation

erikburt
Copy link
Collaborator

@erikburt erikburt commented Dec 11, 2024

Changes

  • Install the go version specified by the toolchain directive if it exists.

Motivation

This is the cause for the errors seen during go mod cache restores for all of our workflows.

Basically the actions/setup-go action doesn't install the provided toolchain version, so when executing a go command later, it fetches the toolchain version and adds the toolchain's modules to the go mod cache. When we go to restore the cache, it can't overwrite the modules which are already present.

Related: actions/setup-go#424


RE-3325

@erikburt erikburt self-assigned this Dec 11, 2024
@erikburt erikburt requested review from a team as code owners December 11, 2024 18:30
chainchad
chainchad previously approved these changes Dec 11, 2024
Copy link
Contributor

I see you updated files related to core. Please run pnpm changeset in the root directory to add a changeset as well as in the text include at least one of the following tags:

  • #added For any new functionality added.
  • #breaking_change For any functionality that requires manual action for the node to boot.
  • #bugfix For bug fixes.
  • #changed For any change to the existing functionality.
  • #db_update For any feature that introduces updates to database schema.
  • #deprecation_notice For any upcoming deprecation functionality.
  • #internal For changesets that need to be excluded from the final changelog.
  • #nops For any feature that is NOP facing and needs to be in the official Release Notes for the release.
  • #removed For any functionality/config that is removed.
  • #updated For any functionality that is updated.
  • #wip For any change that is not ready yet and external communication about it should be held off till it is feature complete.

🎖️ No JIRA issue number found in: PR title, commit message, or branch name. Please include the issue ID in one of these.

@jmank88
Copy link
Contributor

jmank88 commented Dec 16, 2024

IMHO we need to find a way to work with the tooling, not against it. This is an important feature for reproducability, and disallowing it can suddenly become a problem that surprises us later.

@jmank88
Copy link
Contributor

jmank88 commented Dec 16, 2024

Can we install the correct version if we read the toolchain first?

~/chainlink$ go mod edit -json | jq -r ".Toolchain"
go1.23.4

@erikburt
Copy link
Collaborator Author

AFAICT there's not a great solution to this. Is it possible that we keep the go version in sync with the desired toolchain version, then remove the toolchain directive?

What's the benefit of having a different go and toolchain versions? I don't know if there's subtleties, but it seems unnecessary.

@erikburt
Copy link
Collaborator Author

As you suggested, here is a workaround that gets the toolchain version, and installs that instead. actions/setup-go#457 (comment)

      - uses: actions/checkout@v4
      - id: toolchain
        run: echo "version=$(sed -ne '/^toolchain /s/^toolchain go//p' go.mod)" >> "$GITHUB_OUTPUT"
      - uses: actions/setup-go@v5
        with:
          go-version: ${{ steps.toolchain.outputs.version }}

@erikburt erikburt force-pushed the fix/cache-restore-error-logs branch from 69b478e to acd2f55 Compare December 16, 2024 18:56
@erikburt erikburt changed the title chore: remove toolchain directive from gomods fix: install toolchain version Dec 16, 2024
@erikburt erikburt force-pushed the fix/cache-restore-error-logs branch from acd2f55 to b02e674 Compare December 16, 2024 18:57
@erikburt erikburt requested a review from chainchad December 16, 2024 18:58
@erikburt erikburt added this pull request to the merge queue Dec 17, 2024
Merged via the queue into develop with commit a744ed6 Dec 17, 2024
103 checks passed
@erikburt erikburt deleted the fix/cache-restore-error-logs branch December 17, 2024 19:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants