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

Generate go-licenses during tidy again #21108

Merged
merged 14 commits into from
Sep 9, 2022
Merged

Conversation

silverwind
Copy link
Member

@silverwind silverwind commented Sep 7, 2022

We can not have the frontend target depend on golang because of they way drone is set up. Move the go-licenses generation back into tidy where it will now also be checked for consistency during tidy-check.

(I assume all main branch builds should currently fail like this).

The reasony why it shouldn't be treated the same as for example go generate is because output files are checked in. tidy is imho the optimal target to run this after.

We can not have the `frontend` target depend on golang because of they
way drone is set up. Move the `go-licenses` generation back into `tidy`
where it will now also be checked for consistency during `tidy-check`.
@silverwind silverwind added topic/build PR changes how Gitea is built, i.e. regarding Docker or the Makefile skip-changelog This PR is irrelevant for the (next) changelog, for example bug fixes for unreleased features. labels Sep 7, 2022
@silverwind silverwind added this to the 1.18.0 milestone Sep 7, 2022
@GiteaBot GiteaBot added the lgtm/need 1 This PR needs approval from one additional maintainer to be merged. label Sep 7, 2022
@zeripath
Copy link
Contributor

zeripath commented Sep 8, 2022

No. Do not do this during tidy.

Now that we no longer vendor dependencies we have to run make vendor EVERY TIME we check out a branch - I do not need to have go-licenses run making that checkout EVEN SLOWER.

Just make it part of generate.

@silverwind
Copy link
Member Author

silverwind commented Sep 8, 2022

Now that we no longer vendor dependencies we have to run make vendor EVERY TIME we check out a branch

Why are you even running vendor at all during development? Go functions normally without a vendor directory by resolving what is in go.mod within GOPATH. I'd say you should definitely not run vendor during development and just rely on GOPATH magic. The only purpose of it is to vendor dependencies for the src release tarball.

Just make it part of generate.

That will introduce another complexity layer where we need to run go -> node -> go tools and thus require an additional step on CI, I'm against such additional complexity. I'd either run it after tidy or don't run it automated at all, it's not much work to generate licenses manually after a dependency update.

@zeripath
Copy link
Contributor

zeripath commented Sep 8, 2022

Why are you even running vendor at all during development? Go functions normally without a vendor directory by resolving what is in go.mod within GOPATH. I'd say you should definitely not run vendor during development and just rely on GOPATH magic. The only purpose of it is to vendor dependencies for the src release tarball.

At least with the way vscode is set up for me I have the vendor directory.

This is highly helpful when looking for bugs & errors, otherwise when there is a bug report with a random error how do find where the problem has come from?

Without the vendor directory grep will fail to find the error. VSCode will not be able to jump directly to the affected line.

Do you suggest we grep over the whole of pkgs? How do you propose I change my way of development and bug fixing to cope with new process?

Just make it part of generate.

That will introduce another complexity layer where we need to run go -> node -> go tools and thus require an additional step on CI, I'm against such additional complexity. I'd either run it after tidy or don't run it automated at all, it's not much work to generate licenses manually after a dependency update.

The license file is a GENERATED file.

It belongs in GENERATE.

@silverwind
Copy link
Member Author

silverwind commented Sep 8, 2022

Without the vendor directory grep will fail to find the error. VSCode will not be able to jump directly to the affected line.

Don't know about vscode, but in Sublime Text, I can jump to files in GOPATH just fine and I'd be surprised if VSCode can't do the same. Grepping in dependency code is probably a valid use case, but I guess you could just manually create/delete the vendor directory for such a rare purpose. Thought I do feel such a grep is something go tools should support, e.g. go mod grep akin to git grep.

It belongs in GENERATE.

May be but the conditions for regenerations are very narrow as opposed to other generated stuff, that's why I thougth we get away with this simple method of running it after tidy. Otherwise we will need to introduce another drone step just for this one task.

Anyways, I suggest we land this as a intermediate solution to unbreak main build (and all PR branches).

@silverwind
Copy link
Member Author

I've removed the tidy dependency of vendor. I see no sense in having that dependency and it will enable you to make vendor without issue at any time.

@silverwind
Copy link
Member Author

After latest commit, vendor now also has proper dependencies to allow make to skip it when unnecessary.

Makefile Show resolved Hide resolved
@silverwind
Copy link
Member Author

I guess if we really want to be sure that the licenses are generated for branch switches (which may not run tidy) and such, we'd have to add this discussed separate target for it, so would be the go (licenses) -> node (webpack) -> go (go-generate and build) chain. It'll at minimum require 1 extra step on drone in all pipelines that build.

@silverwind
Copy link
Member Author

silverwind commented Sep 8, 2022

Should be good now I think.

  1. I added a workaround regarding unstable output of google/go-licenses for the top-level module, that is what @zeripath has seen as well.
  2. If the vendor change breaks any workflows, I can revert it, but I think it's the right thing to do to not have it phony and with dependencies.
  3. I added the dependency back to tidy because otherwise one would have to do a build to get the file updated, which they may or may not do. By hooking it into tidy, we can ensure it's up to date and verified with tidy-check.

.drone.yml Show resolved Hide resolved
Copy link
Member

@a1012112796 a1012112796 left a comment

Choose a reason for hiding this comment

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

🚀

@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Sep 9, 2022
@techknowlogick
Copy link
Member

ping lg-tm

@techknowlogick techknowlogick merged commit b5d21c0 into go-gitea:main Sep 9, 2022
@silverwind silverwind deleted the nogodep branch September 9, 2022 16:19
zjjhot added a commit to zjjhot/gitea that referenced this pull request Sep 13, 2022
* upstream/main:
  Update docs comparison.zh-cn.md (go-gitea#21035)
  Use form for admin purge user (go-gitea#21070)
  Make labels clickable in the comments section. (go-gitea#21137)
  Remove fomantic image module (go-gitea#21145)
  [skip ci] Updated translations via Crowdin
  Show .editorconfig errors in frontend (go-gitea#21088)
  Update JS dependencies and lint (go-gitea#21144)
  Fix PlantUML example in document (go-gitea#21142)
  chore(security): Support Go Vulnerability Management (go-gitea#21139)
  [skip ci] Updated licenses and gitignores
  [skip ci] Updated translations via Crowdin
  Improve commit status icons (go-gitea#21124)
  Center-aligning content of WebAuthN page (go-gitea#21127)
  Allow poster to choose reviewers (go-gitea#21084)
  Generate go-licenses during tidy again (go-gitea#21108)
@go-gitea go-gitea locked and limited conversation to collaborators May 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. skip-changelog This PR is irrelevant for the (next) changelog, for example bug fixes for unreleased features. topic/build PR changes how Gitea is built, i.e. regarding Docker or the Makefile type/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants