-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Disable buildvcs
#20056
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
Disable buildvcs
#20056
Conversation
AbdulrhmnGhanem
commented
Jun 20, 2022
- Fixes Docker build fails if gitea is a git submodule #20055
- Fixes go-gitea#20055
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can achieve this with goflags env var, or extra goflags. This also disables it for all builds, not just your specific use case.
I think Golang's
It doesn't help Gitea's build, and may break reproducible build (even the code the exactly the same, the output differs due to different repository information). |
A bit off topic, but about reproducible builds:
If we want those we should at least do:
But as I read the pages above because we're using CGO it's going to be tricky anyway to have reproducible builds. |
You are right, though does it make sense the docker build should fail depending on the VCS status? Failing when building inside a submodule is just a symptom I am sure there are other cases where it would fail too. |
Yeah, what @42wim said has changed my pov. I'll drop my review, although I'll suggest adding the flag into the existing goflag env var instead of hardcoding it directly. |
Makefile
Outdated
@@ -602,7 +602,7 @@ generate: $(TAGS_PREREQ) | |||
@CC= GOOS= GOARCH= $(GO) generate -tags '$(TAGS)' $(GO_PACKAGES) | |||
|
|||
$(EXECUTABLE): $(GO_SOURCES) $(TAGS_PREREQ) | |||
CGO_CFLAGS="$(CGO_CFLAGS)" $(GO) build $(GOFLAGS) $(EXTRA_GOFLAGS) -tags '$(TAGS)' -ldflags '-s -w $(LDFLAGS)' -o $@ | |||
CGO_CFLAGS="$(CGO_CFLAGS)" $(GO) build -buildvcs=false $(GOFLAGS) $(EXTRA_GOFLAGS) -tags '$(TAGS)' -ldflags '-s -w $(LDFLAGS)' -o $@ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why aren't you just setting EXTRA_GOFLAGS to use this flag for your specific need. Most people building Gitea do not need this flag and will not need it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even if the reasons above don't justify the use of this flag, what value does this flag remove from other users? It just resets the build to behave as pre-1.18.
Adding GOFLAGS += -buildvcs=false the build fails with the same error, is this wrong? |
what about just adding it as Line 68 in 389496b
It'll be overwritten if someone tries to add their own extra goflags, but I think that something that can be dealt with in a later PR. |
It doesn't work! |
Why modifying the makefile? Using env variables is just easier:
Which passes the go flag correctly:
|
This doesn't resolve the issue addressed by this PR. Running the repro steps in the issue and adding |
From my point of view, it's clear that we(the Gitea maintainers) don't see the benefit of adding this flag globally, as it doesn't provide any benefits to any other use-case. You can configure build flags like that via environments, there's no need to hard-code them. You mention that the flag is passed along with the build command, but it still fails, at that point it's out of Gitea's hand and likely a Go/Docker bug. The current PR doesn't fix the issue it still results into the same error. Unless this PR is to fix of why the error still exists even with Also as mentioned on the original issue, Go1.19 won't have this issue anymore. |