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

feat: improve buf rate limit (backport #4133) #4206

Merged
merged 12 commits into from
Jul 10, 2024

Conversation

mergify[bot]
Copy link
Contributor

@mergify mergify bot commented Jun 21, 2024

Description

  • Remove third_party_paths from the chain config.
  • Decrease the Buf. Build requests by grouping the requests into only one using the --path for the generate command.
  • Create an option to run the proto files one by one so we can skip the workspace for the third-party modules, like the swagger file generation.
  • Create a cache for the buf file, increasing the Ignite run speed.
    This is an automatic backport of pull request feat: improve buf rate limit #4133 done by Mergify.

* draft improvements

* use --path flag mutilple times

* remove `Build.Proto.ThirdPartyPaths` from the config

* add logic for run buf by folder or by file

* update cosmos-sdk

* fix exclude files for swagger

* fix buf cache

* add changelog

* update buf deps

* fix unit test

* fix wrong proto go path

* clear buf cache

* fix doctor tests and remove `third_party_paths` from the docs

* improve Test_extractRootModulePath test cases

* Update ignite/pkg/cosmosbuf/cache.go

Co-authored-by: Jerónimo Albi <[email protected]>

* fix changelog.md

* improve cache logic

* create a dircache pkg

* add comments

* rename methods `CopyCache` to `CopyTo` and `SaveCache` to `Save`

---------

Co-authored-by: Pantani <Pantani>
Co-authored-by: Jerónimo Albi <[email protected]>
(cherry picked from commit 0b41262)

# Conflicts:
#	ignite/cmd/cmd.go
#	ignite/config/chain/base/config.go
#	ignite/config/chain/v1/testdata/config.yaml
#	ignite/config/chain/v1/testdata/config2.yaml
#	ignite/internal/analytics/analytics.go
#	ignite/pkg/cosmosbuf/buf.go
#	ignite/pkg/cosmosgen/generate_go.go
#	ignite/pkg/cosmosgen/generate_openapi.go
#	integration/doctor/testdata/config-need-migrate.txt
@mergify mergify bot added the conflicts label Jun 21, 2024
Copy link
Contributor Author

mergify bot commented Jun 21, 2024

Cherry-pick of 0b41262 has failed:

On branch mergify/bp/release/v28.x.y/pr-4133
Your branch is up to date with 'origin/release/v28.x.y'.

You are currently cherry-picking commit 0b412628.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
	modified:   changelog.md
	modified:   docs/docs/02-guide/06-ibc.md
	modified:   docs/docs/02-guide/07-interchange/02-init.md
	modified:   docs/docs/08-references/02-config.md
	modified:   docs/versioned_docs/version-v0.25/kb/03-config.md
	modified:   docs/versioned_docs/version-v0.25/kb/06-proto.md
	modified:   ignite/config/chain/v1/config_test.go
	deleted:    ignite/pkg/cosmosbuf/buf_test.go
	modified:   ignite/pkg/cosmosgen/cosmosgen.go
	modified:   ignite/pkg/cosmosgen/generate.go
	new file:   ignite/pkg/cosmosgen/generate_openapi_test.go
	modified:   ignite/pkg/cosmosgen/generate_typescript.go
	new file:   ignite/pkg/dircache/cache.go
	new file:   ignite/pkg/dircache/cache_test.go
	new file:   ignite/pkg/dircache/testdata/subdata/subfile
	new file:   ignite/pkg/dircache/testdata/testfile
	modified:   ignite/pkg/xos/files.go
	modified:   ignite/pkg/xos/files_test.go
	modified:   ignite/services/chain/generate.go
	modified:   ignite/services/scaffolder/scaffolder.go
	modified:   ignite/templates/app/files/proto/buf.lock

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   ignite/cmd/cmd.go
	both modified:   ignite/config/chain/base/config.go
	both modified:   ignite/config/chain/v1/testdata/config.yaml
	both modified:   ignite/config/chain/v1/testdata/config2.yaml
	both modified:   ignite/internal/analytics/analytics.go
	both modified:   ignite/pkg/cosmosbuf/buf.go
	both modified:   ignite/pkg/cosmosgen/generate_go.go
	both modified:   ignite/pkg/cosmosgen/generate_openapi.go
	both modified:   integration/doctor/testdata/config-need-migrate.txt

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally

@mergify mergify bot mentioned this pull request Jun 21, 2024
@github-actions github-actions bot added component:docs Documentation additions or improvements. component:ci CI/CD workflow and automated jobs. component:templates component:configs component:cmd type:services Service-related issues. type:internal component:packages labels Jun 21, 2024
@julienrbrt julienrbrt self-assigned this Jun 21, 2024
@julienrbrt julienrbrt marked this pull request as draft June 21, 2024 12:22
Copy link
Contributor

github-actions bot commented Jun 21, 2024

Visit the preview URL for this PR (updated for commit ba2840e):

https://igntservices-docs--pr4206-mergify-bp-release-v-g38uu843.web.app

(expires Fri, 12 Jul 2024 16:22:20 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 95379efd94dd497aaa37c2d0354e6e2cafca5ec5

@Pantani Pantani closed this Jul 4, 2024
@Pantani Pantani deleted the mergify/bp/release/v28.x.y/pr-4133 branch July 4, 2024 13:46
@Pantani Pantani added backport/v28.x.y Backport to v28.x.y and removed backport/v28.x.y Backport to v28.x.y labels Jul 4, 2024
@Pantani Pantani restored the mergify/bp/release/v28.x.y/pr-4133 branch July 4, 2024 17:52
@Pantani Pantani reopened this Jul 4, 2024
@Pantani Pantani force-pushed the mergify/bp/release/v28.x.y/pr-4133 branch from 99a1372 to 63ae4ec Compare July 4, 2024 18:17
@github-actions github-actions bot removed the component:docs Documentation additions or improvements. label Jul 4, 2024
@Pantani Pantani marked this pull request as ready for review July 4, 2024 18:31
Copy link

codecov bot commented Jul 4, 2024

Codecov Report

Attention: Patch coverage is 8.27338% with 255 lines in your changes missing coverage. Please review.

Project coverage is 25.94%. Comparing base (232b10d) to head (cdd543f).
Report is 37 commits behind head on release/v28.x.y.

Current head cdd543f differs from pull request most recent head ba2840e

Please upload reports for the commit ba2840e to get more accurate results.

Additional details and impacted files

Impacted file tree graph

@@                 Coverage Diff                 @@
##           release/v28.x.y    #4206      +/-   ##
===================================================
+ Coverage            24.74%   25.94%   +1.19%     
===================================================
  Files                  297      301       +4     
  Lines                24979    25653     +674     
===================================================
+ Hits                  6182     6655     +473     
- Misses               18230    18417     +187     
- Partials               567      581      +14     
Files Coverage Δ
ignite/pkg/cosmosanalysis/app/app.go 58.00% <ø> (ø)
ignite/pkg/cosmosanalysis/cosmosanalysis.go 84.02% <ø> (ø)
ignite/pkg/cosmosgen/generate_vuex.go 0.00% <ø> (ø)
ignite/pkg/repoversion/repoversion.go 57.47% <ø> (ø)
ignite/services/chain/init.go 0.00% <ø> (ø)
ignite/services/scaffolder/scaffolder.go 0.00% <ø> (ø)
ignite/pkg/cosmosgen/generate_typescript.go 0.00% <0.00%> (ø)
ignite/services/chain/generate.go 0.00% <0.00%> (ø)
ignite/cmd/cmd.go 0.00% <0.00%> (ø)
ignite/pkg/cosmosgen/cosmosgen.go 3.33% <0.00%> (+0.15%) ⬆️
... and 6 more

... and 2 files with indirect coverage changes

@github-actions github-actions bot added the component:docs Documentation additions or improvements. label Jul 5, 2024
Copy link
Member

@julienrbrt julienrbrt left a comment

Choose a reason for hiding this comment

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

tACK!

Copy link
Member

@julienrbrt julienrbrt left a comment

Choose a reason for hiding this comment

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

Now #4202 is broken with a different message btw and on non-minimal chains as well.

error while running command /home/julien/tools/go/bin/buf generate /home/julien/tools/go/pkg/mod/github.com/cosmos/[email protected]/proto/cosmos/vesting/v1beta1 --template=/home/julien/downloads/foo2/proto/buf.gen.sta.yaml --output=/tmp/gen-openapi-module-spec2507011614 --error-format=json --log-format=json --path=/home/julien/tools/go/pkg/mod/github.com/cosmos/[email protected]/proto/cosmos/vesting/v1beta1/tx.proto --path=/home/julien/tools/go/pkg/mod/github.com/cosmos/[email protected]/proto/cosmos/vesting/v1beta1/vesting.proto: Failure: failed to build input "proto/cosmos/vesting/v1beta1" because it is contained by module at path "proto" specified in your configuration, you must provide the workspace or module as the input, and filter to this path using --path : exit status 1

@Pantani
Copy link
Collaborator

Pantani commented Jul 10, 2024

Now #4202 is broken with a different message btw and on non-minimal chains as well.

error while running command /home/julien/tools/go/bin/buf generate /home/julien/tools/go/pkg/mod/github.com/cosmos/[email protected]/proto/cosmos/vesting/v1beta1 --template=/home/julien/downloads/foo2/proto/buf.gen.sta.yaml --output=/tmp/gen-openapi-module-spec2507011614 --error-format=json --log-format=json --path=/home/julien/tools/go/pkg/mod/github.com/cosmos/[email protected]/proto/cosmos/vesting/v1beta1/tx.proto --path=/home/julien/tools/go/pkg/mod/github.com/cosmos/[email protected]/proto/cosmos/vesting/v1beta1/vesting.proto: Failure: failed to build input "proto/cosmos/vesting/v1beta1" because it is contained by module at path "proto" specified in your configuration, you must provide the workspace or module as the input, and filter to this path using --path : exit status 1

@julienrbrt, we need to merge the other PRs after this one to the ts client generation works again:

#4226
#4225
#4224

@Pantani Pantani requested a review from julienrbrt July 10, 2024 01:07
@Pantani
Copy link
Collaborator

Pantani commented Jul 10, 2024

Now #4202 is broken with a different message btw and on non-minimal chains as well.
error while running command /home/julien/tools/go/bin/buf generate /home/julien/tools/go/pkg/mod/github.com/cosmos/[email protected]/proto/cosmos/vesting/v1beta1 --template=/home/julien/downloads/foo2/proto/buf.gen.sta.yaml --output=/tmp/gen-openapi-module-spec2507011614 --error-format=json --log-format=json --path=/home/julien/tools/go/pkg/mod/github.com/cosmos/[email protected]/proto/cosmos/vesting/v1beta1/tx.proto --path=/home/julien/tools/go/pkg/mod/github.com/cosmos/[email protected]/proto/cosmos/vesting/v1beta1/vesting.proto: Failure: failed to build input "proto/cosmos/vesting/v1beta1" because it is contained by module at path "proto" specified in your configuration, you must provide the workspace or module as the input, and filter to this path using --path : exit status 1

@julienrbrt, we need to merge the other PRs after this one to the ts client generation works again:

#4226 #4225 #4224

but we also need to merge this one first for the others works, because the backport to update the buf version is already merged

@julienrbrt julienrbrt enabled auto-merge (squash) July 10, 2024 05:50
@julienrbrt julienrbrt merged commit 31a9c2c into release/v28.x.y Jul 10, 2024
47 of 48 checks passed
@julienrbrt julienrbrt deleted the mergify/bp/release/v28.x.y/pr-4133 branch July 10, 2024 09:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:ci CI/CD workflow and automated jobs. component:cmd component:configs component:docs Documentation additions or improvements. component:packages component:templates type:internal type:services Service-related issues.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants