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

Separate go version for build and go version for compatibility #4430

Open
bnevis-i opened this issue Mar 9, 2023 · 8 comments
Open

Separate go version for build and go version for compatibility #4430

bnevis-i opened this issue Mar 9, 2023 · 8 comments
Labels
ci issue_type denoting non-code changes such as testing or compilation enhancement New feature or request

Comments

@bnevis-i
Copy link
Collaborator

bnevis-i commented Mar 9, 2023

🚀 Feature Request

Relevant Package [REQUIRED]

N/A

Description [REQUIRED]

EdgeX does this wierd thing that other go packages don't do. We parse go.mod for the go version, and then feed that into our BUILDER_BASE to figure out what version of the compiler we are going to use.

What we should be doing is using go.mod to declare what go version our code is COMPATIBLE WITH (i.e. language features) and keep the version that we compile with separate. If one reads the spec for the go directive https://go.dev/ref/mod#go-mod-file-go one can see that this is what was intended.

Describe the solution you'd like

Have a .go-version file that specifies the go version that we want to COMPILE WITH. Leave go.mod specify the go version we are COMPATIBLE WITH.

@bnevis-i bnevis-i added the enhancement New feature or request label Mar 9, 2023
@lenny-goodell
Copy link
Member

@ernestojeda, FYI

@github-project-automation github-project-automation bot moved this to New Issues in Technical WG Mar 13, 2023
@lenny-goodell lenny-goodell added the ci issue_type denoting non-code changes such as testing or compilation label Mar 13, 2023
@ernestojeda
Copy link
Contributor

Yeah, I am OK with this. This really only applies to optimizing local builds. During the CI process, Jenkins always set it's ownBUILDER_BASE.

@lenny-goodell
Copy link
Member

@ernestojeda, How does this apply to local builds?
I thought the go version in the go.mod was used by CI to determine which to use in the pipeline. I.e. if rebuilding Jakarta it will use the go version we set for Jakarta.

@ernestojeda
Copy link
Contributor

ernestojeda commented Mar 13, 2023

The GO_VERSION variable was added to the Makefile specifically to support optimizing local builds, used to determine the Dockerfile from the ci-build-images repository. This behavior is not used for Jenkins builds.

However, you are correct about LTS builds (like Jakarta), we use the go.mod file to determine what version of Go to use (using the getGoModVersion() function) for the build so we make sure we build with a consistent version. For all the rest of the Jenkins builds, we set the Go version for all projects here.

@lenny-goodell
Copy link
Member

The GO_VERSION variable was added to the Makefile specifically to support optimizing local builds, used to determine the Dockerfile from the ci-build-images repository. This behavior is not used for Jenkins builds.

Ahh, ok wasn't aware of this as it is only in edgex-go and for docker builds. THX!

@cloudxxx8 cloudxxx8 moved this from New Issues to Icebox in Technical WG Apr 19, 2023
@cloudxxx8 cloudxxx8 removed this from Technical WG Jun 21, 2023
@cloudxxx8
Copy link
Member

move to DevOps WG
@ernestojeda please help see if we want to continue to discuss this issue or just close it. thanks.

@ernestojeda
Copy link
Contributor

@cloudxxx8 Up to @bnevis-i on this one. We can proceed with his suggestion about adding a new file to the repository. After that is complete, DevOps can update the build process to use this new file.

@bnevis-i
Copy link
Collaborator Author

bnevis-i commented Jun 23, 2023

I think it is in our long-term best interest to go forward with this (otherwise I wouldn't have proposed it).

For example, the SPIRE project has logic in their Makefile to check the go version, and if it doesn't match what it expected, it will download the correct version of the go compiler and compile against it.

I am not necessarily suggesting that we do what SPIRE does (e.g. we could just warn), but the big change is that it will eliminate a superfluous change in go.mod that causes large cascading effects to downstream consumers of the modules.

(P.S. When building our version of SPIRE, we just overwrite .go_version with the version that we are currently standardized on.)

@jumpingliu jumpingliu removed this from DevOps WG Jul 30, 2024
@jumpingliu jumpingliu removed the status in Technical WG Jul 30, 2024
@github-project-automation github-project-automation bot moved this to New Issues in Technical WG Jul 30, 2024
@jumpingliu jumpingliu moved this to New Issues in Technical WG Jul 30, 2024
@cloudxxx8 cloudxxx8 moved this from New Issues to Icebox in Technical WG Oct 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci issue_type denoting non-code changes such as testing or compilation enhancement New feature or request
Projects
Status: Icebox
Development

No branches or pull requests

4 participants