From 16a40f0a91b31cca31b42cd6b1d5f7b324b061c4 Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Wed, 28 Aug 2024 21:52:09 +0000 Subject: [PATCH 1/6] fix(cmd): add missing --config handling (#4323) * fix(cmd): add missing `--config` handling * cl * cl++ --- changelog.md | 1 + ignite/cmd/chain_build.go | 6 ++++++ ignite/cmd/chain_debug.go | 1 + ignite/cmd/chain_faucet.go | 5 +++++ ignite/cmd/chain_init.go | 6 ++++++ 5 files changed, 19 insertions(+) diff --git a/changelog.md b/changelog.md index 246e8d93b7..c55031feed 100644 --- a/changelog.md +++ b/changelog.md @@ -44,6 +44,7 @@ - [#4091](https://github.com/ignite/cli/pull/4091) Fix race conditions in the plugin logic - [#4128](https://github.com/ignite/cli/pull/4128) Check for duplicate proto fields in config - [#4309](https://github.com/ignite/cli/pull/4309) Fix chain id for chain simulations +- [#4323](https://github.com/ignite/cli/pull/4323) Add missing `--config` handling in the `chain` commands ## [`v28.5.1`](https://github.com/ignite/cli/releases/tag/v28.5.1) diff --git a/ignite/cmd/chain_build.go b/ignite/cmd/chain_build.go index 470769161d..b72156e240 100644 --- a/ignite/cmd/chain_build.go +++ b/ignite/cmd/chain_build.go @@ -123,6 +123,12 @@ func chainBuildHandler(cmd *cobra.Command, _ []string) error { chainOption = append(chainOption, chain.CheckDependencies()) } + // check if custom config is defined + config, _ := cmd.Flags().GetString(flagConfig) + if config != "" { + chainOption = append(chainOption, chain.ConfigFile(config)) + } + c, err := chain.NewWithHomeFlags(cmd, chainOption...) if err != nil { return err diff --git a/ignite/cmd/chain_debug.go b/ignite/cmd/chain_debug.go index 37220aa0e1..fe84548cd3 100644 --- a/ignite/cmd/chain_debug.go +++ b/ignite/cmd/chain_debug.go @@ -100,6 +100,7 @@ func chainDebug(cmd *cobra.Command, session *cliui.Session) error { chain.KeyringBackend(chaincmd.KeyringBackendTest), } + // check if custom config is defined config, _ := cmd.Flags().GetString(flagConfig) if config != "" { chainOptions = append(chainOptions, chain.ConfigFile(config)) diff --git a/ignite/cmd/chain_faucet.go b/ignite/cmd/chain_faucet.go index 4e2515dedc..ecc858bbf1 100644 --- a/ignite/cmd/chain_faucet.go +++ b/ignite/cmd/chain_faucet.go @@ -40,6 +40,11 @@ func chainFaucetHandler(cmd *cobra.Command, args []string) error { chain.CollectEvents(session.EventBus()), } + config, _ := cmd.Flags().GetString(flagConfig) + if config != "" { + chainOption = append(chainOption, chain.ConfigFile(config)) + } + c, err := chain.NewWithHomeFlags(cmd, chainOption...) if err != nil { return err diff --git a/ignite/cmd/chain_init.go b/ignite/cmd/chain_init.go index 9a40fecd61..440d048b10 100644 --- a/ignite/cmd/chain_init.go +++ b/ignite/cmd/chain_init.go @@ -112,6 +112,12 @@ func chainInitHandler(cmd *cobra.Command, _ []string) error { chainOption = append(chainOption, chain.CheckDependencies()) } + // check if custom config is defined + config, _ := cmd.Flags().GetString(flagConfig) + if config != "" { + chainOption = append(chainOption, chain.ConfigFile(config)) + } + c, err := chain.NewWithHomeFlags(cmd, chainOption...) if err != nil { return err From 8a038fc9892e2165b980a8be4d0cb297cca4bdc8 Mon Sep 17 00:00:00 2001 From: Danilo Pantani Date: Thu, 29 Aug 2024 00:41:42 +0200 Subject: [PATCH 2/6] chore: bump golangci-lint to `v1.60.3` (#4324) * bump golangci-lint to `v1.60.3` * run mod tidy --- .github/workflows/test-lint.yml | 2 +- go.mod | 4 ++-- go.sum | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test-lint.yml b/.github/workflows/test-lint.yml index 514fbaae64..29a12a9729 100644 --- a/.github/workflows/test-lint.yml +++ b/.github/workflows/test-lint.yml @@ -35,7 +35,7 @@ jobs: - uses: golangci/golangci-lint-action@v6 if: env.GIT_DIFF with: - version: v1.58.0 + version: v1.60.3 install-mode: goinstall args: --timeout 10m github-token: ${{ secrets.github_token }} diff --git a/go.mod b/go.mod index 847a787f80..37fb48a1e9 100644 --- a/go.mod +++ b/go.mod @@ -43,7 +43,7 @@ require ( github.com/gobuffalo/plush/v4 v4.1.19 github.com/gobwas/glob v0.2.3 github.com/goccy/go-yaml v1.11.3 - github.com/golangci/golangci-lint v1.60.2 + github.com/golangci/golangci-lint v1.60.3 github.com/google/go-github/v48 v48.2.0 github.com/google/go-querystring v1.1.0 github.com/gorilla/mux v1.8.1 @@ -404,7 +404,7 @@ require ( github.com/sasha-s/go-deadlock v0.3.1 // indirect github.com/sashamelentyev/interfacebloat v1.1.0 // indirect github.com/sashamelentyev/usestdlibvars v1.27.0 // indirect - github.com/securego/gosec/v2 v2.20.1-0.20240820084340-81cda2f91fbe // indirect + github.com/securego/gosec/v2 v2.20.1-0.20240822074752-ab3f6c1c83a0 // indirect github.com/segmentio/ksuid v1.0.3 // indirect github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 // indirect github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c // indirect diff --git a/go.sum b/go.sum index fdf06293b5..ae1f71ea0f 100644 --- a/go.sum +++ b/go.sum @@ -667,8 +667,8 @@ github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a h1:w8hkcTqaFpzKqonE9 github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a/go.mod h1:ryS0uhF+x9jgbj/N71xsEqODy9BN81/GonCZiOzirOk= github.com/golangci/gofmt v0.0.0-20240816233607-d8596aa466a9 h1:/1322Qns6BtQxUZDTAT4SdcoxknUki7IAoK4SAXr8ME= github.com/golangci/gofmt v0.0.0-20240816233607-d8596aa466a9/go.mod h1:Oesb/0uFAyWoaw1U1qS5zyjCg5NP9C9iwjnI4tIsXEE= -github.com/golangci/golangci-lint v1.60.2 h1:Y8aWnZCMOLY5T7Ga5hcoemyKsZZJCUmIIK3xTD3jIhc= -github.com/golangci/golangci-lint v1.60.2/go.mod h1:4UvjLpOJoQSvmyWkmO1urDR3txhL9R9sn4oM/evJ95g= +github.com/golangci/golangci-lint v1.60.3 h1:l38A5de24ZeDlcFF+EB7m3W5joPD99/hS5SIHJPyZa0= +github.com/golangci/golangci-lint v1.60.3/go.mod h1:J4vOpcjzRI+lDL2DKNGBZVB3EQSBfCBCMpaydWLtJNo= github.com/golangci/misspell v0.6.0 h1:JCle2HUTNWirNlDIAUO44hUsKhOFqGPoC4LZxlaSXDs= github.com/golangci/misspell v0.6.0/go.mod h1:keMNyY6R9isGaSAu+4Q8NMBwMPkh15Gtc8UCVoDtAWo= github.com/golangci/modinfo v0.3.4 h1:oU5huX3fbxqQXdfspamej74DFX0kyGLkw1ppvXoJ8GA= @@ -1291,8 +1291,8 @@ github.com/sashamelentyev/interfacebloat v1.1.0/go.mod h1:+Y9yU5YdTkrNvoX0xHc84d github.com/sashamelentyev/usestdlibvars v1.27.0 h1:t/3jZpSXtRPRf2xr0m63i32ZrusyurIGT9E5wAvXQnI= github.com/sashamelentyev/usestdlibvars v1.27.0/go.mod h1:9nl0jgOfHKWNFS43Ojw0i7aRoS4j6EBye3YBhmAIRF8= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= -github.com/securego/gosec/v2 v2.20.1-0.20240820084340-81cda2f91fbe h1:exdneYmXwZ4+VaIWv9mQ47uIHkTQSN50DYdCjXJ1cdQ= -github.com/securego/gosec/v2 v2.20.1-0.20240820084340-81cda2f91fbe/go.mod h1:iyeMMRw8QEmueUSZ2VqmkQMiDyDcobfPnG00CV/NWdE= +github.com/securego/gosec/v2 v2.20.1-0.20240822074752-ab3f6c1c83a0 h1:VqD4JMoqwuuCz8GZlBDsIDyE6K4YUsWJpbNtuOWHoFk= +github.com/securego/gosec/v2 v2.20.1-0.20240822074752-ab3f6c1c83a0/go.mod h1:iyeMMRw8QEmueUSZ2VqmkQMiDyDcobfPnG00CV/NWdE= github.com/segmentio/ksuid v1.0.3 h1:FoResxvleQwYiPAVKe1tMUlEirodZqlqglIuFsdDntY= github.com/segmentio/ksuid v1.0.3/go.mod h1:/XUiZBD3kVx5SmUOl55voK5yeAbBNNIed+2O73XgrPE= github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= From b605676bfcc65a86422785919dc55bd43ae07347 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 28 Aug 2024 22:52:33 +0000 Subject: [PATCH 3/6] chore(deps): bump micromatch from 4.0.5 to 4.0.8 in /docs (#4320) Bumps [micromatch](https://github.com/micromatch/micromatch) from 4.0.5 to 4.0.8.
Release notes

Sourced from micromatch's releases.

4.0.8

Ultimate release that fixes both CVE-2024-4067 and CVE-2024-4068. We consider the issues low-priority, so even if you see automated scanners saying otherwise, don't be scared.

Changelog

Sourced from micromatch's changelog.

[4.0.8] - 2024-08-22

  • backported CVE-2024-4067 fix (from v4.0.6) over to 4.x branch

[4.0.7] - 2024-05-22

  • this is basically v4.0.5, with some README updates
  • it is vulnerable to CVE-2024-4067
  • Updated braces to v3.0.3 to avoid CVE-2024-4068
  • does NOT break API compatibility

[4.0.6] - 2024-05-21

  • Added hasBraces to check if a pattern contains braces.
  • Fixes CVE-2024-4067
  • BREAKS API COMPATIBILITY
  • Should be labeled as a major release, but it's not.
Commits
  • 8bd704e 4.0.8
  • a0e6841 run verb to generate README documentation
  • 4ec2884 Merge branch 'v4' into hauserkristof-feature/v4.0.8
  • 03aa805 Merge pull request #266 from hauserkristof/feature/v4.0.8
  • 814f5f7 lint
  • 67fcce6 fix: CHANGELOG about braces & CVE-2024-4068, v4.0.5
  • 113f2e3 fix: CVE numbers in CHANGELOG
  • d9dbd9a feat: updated CHANGELOG
  • 2ab1315 fix: use actions/setup-node@v4
  • 1406ea3 feat: rework test to work on macos with node 10,12 and 14
  • Additional commits viewable in compare view

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=micromatch&package-manager=npm_and_yarn&previous-version=4.0.5&new-version=4.0.8)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) You can disable automated security fix PRs for this repo from the [Security Alerts page](https://github.com/ignite/cli/network/alerts).
--- docs/yarn.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/yarn.lock b/docs/yarn.lock index abf6550f6c..59493a0750 100644 --- a/docs/yarn.lock +++ b/docs/yarn.lock @@ -2770,7 +2770,7 @@ brace-expansion@^1.1.7: balanced-match "^1.0.0" concat-map "0.0.1" -braces@^3.0.2, braces@~3.0.2: +braces@^3.0.3, braces@~3.0.2: version "3.0.3" resolved "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz" integrity sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA== @@ -5245,11 +5245,11 @@ methods@~1.1.2: integrity sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w== micromatch@^4.0.2, micromatch@^4.0.4, micromatch@^4.0.5: - version "4.0.5" - resolved "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz" - integrity sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA== + version "4.0.8" + resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.8.tgz#d66fa18f3a47076789320b9b1af32bd86d9fa202" + integrity sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA== dependencies: - braces "^3.0.2" + braces "^3.0.3" picomatch "^2.3.1" mime-db@1.52.0, "mime-db@>= 1.43.0 < 2": From b45387489027f57ab15b78849c2b7be4b3867aed Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 28 Aug 2024 23:08:37 +0000 Subject: [PATCH 4/6] chore(pkg): remove github.com/jpillora/chisel package (#4317) * chore(deps): bump github.com/jpillora/chisel from 1.9.1 to 1.10.0 Bumps [github.com/jpillora/chisel](https://github.com/jpillora/chisel) from 1.9.1 to 1.10.0. - [Release notes](https://github.com/jpillora/chisel/releases) - [Commits](https://github.com/jpillora/chisel/compare/v1.9.1...v1.10.0) --- updated-dependencies: - dependency-name: github.com/jpillora/chisel dependency-type: direct:production ... Signed-off-by: dependabot[bot] * deprecate xchisel --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Julien Robert --- changelog.md | 1 + go.mod | 8 ----- go.sum | 13 -------- ignite/pkg/xchisel/xchisel.go | 58 ----------------------------------- 4 files changed, 1 insertion(+), 79 deletions(-) delete mode 100644 ignite/pkg/xchisel/xchisel.go diff --git a/changelog.md b/changelog.md index c55031feed..c6eb124d2f 100644 --- a/changelog.md +++ b/changelog.md @@ -37,6 +37,7 @@ - [#4189](https://github.com/ignite/cli/pull/4189) Deprecate `ignite node` for `ignite connect` app - [#4290](https://github.com/ignite/cli/pull/4290) Remove ignite ics logic from ignite cli (this functionality will be in the `consumer` app) - [#4295](https://github.com/ignite/cli/pull/4295) Stop scaffolding `pulsar` files +- [#4317](https://github.com/ignite/cli/pull/4317) Remove xchisel dependency ### Fixes diff --git a/go.mod b/go.mod index 37fb48a1e9..35c52b4040 100644 --- a/go.mod +++ b/go.mod @@ -52,7 +52,6 @@ require ( github.com/iancoleman/strcase v0.3.0 github.com/ignite/web v0.6.1 github.com/imdario/mergo v0.3.13 - github.com/jpillora/chisel v1.9.1 github.com/lib/pq v1.10.9 github.com/manifoldco/promptui v0.9.0 github.com/mitchellh/mapstructure v1.5.0 @@ -124,9 +123,7 @@ require ( github.com/alexkohler/nakedret/v2 v2.0.4 // indirect github.com/alexkohler/prealloc v1.0.0 // indirect github.com/alingse/asasalint v0.0.11 // indirect - github.com/andrew-d/go-termutil v0.0.0-20150726205930-009166a695a2 // indirect github.com/antlr4-go/antlr/v4 v4.13.0 // indirect - github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 // indirect github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect github.com/ashanbrown/forbidigo v1.6.0 // indirect github.com/ashanbrown/makezero v1.1.1 // indirect @@ -306,10 +303,6 @@ require ( github.com/jjti/go-spancheck v0.6.2 // indirect github.com/jmhodges/levigo v1.0.0 // indirect github.com/josharian/intern v1.0.0 // indirect - github.com/jpillora/ansi v1.0.3 // indirect - github.com/jpillora/backoff v1.0.0 // indirect - github.com/jpillora/requestlog v1.0.0 // indirect - github.com/jpillora/sizestr v1.0.0 // indirect github.com/julz/importas v0.1.0 // indirect github.com/karamaru-alpha/copyloopvar v1.1.0 // indirect github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect @@ -433,7 +426,6 @@ require ( github.com/timakin/bodyclose v0.0.0-20230421092635-574207250966 // indirect github.com/timonwong/loggercheck v0.9.4 // indirect github.com/tomarrell/wrapcheck/v2 v2.9.0 // indirect - github.com/tomasen/realip v0.0.0-20180522021738-f0c99a92ddce // indirect github.com/tommy-muehle/go-mnd/v2 v2.5.1 // indirect github.com/ugorji/go/codec v1.2.11 // indirect github.com/ultraware/funlen v0.1.0 // indirect diff --git a/go.sum b/go.sum index ae1f71ea0f..44b095c9e5 100644 --- a/go.sum +++ b/go.sum @@ -129,8 +129,6 @@ github.com/alexkohler/prealloc v1.0.0 h1:Hbq0/3fJPQhNkN0dR95AVrr6R7tou91y0uHG5pO github.com/alexkohler/prealloc v1.0.0/go.mod h1:VetnK3dIgFBBKmg0YnD9F9x6Icjd+9cvfHR56wJVlKE= github.com/alingse/asasalint v0.0.11 h1:SFwnQXJ49Kx/1GghOFz1XGqHYKp21Kq1nHad/0WQRnw= github.com/alingse/asasalint v0.0.11/go.mod h1:nCaoMhw7a9kSJObvQyVzNTPBDbNpdocqrSP7t/cW5+I= -github.com/andrew-d/go-termutil v0.0.0-20150726205930-009166a695a2 h1:axBiC50cNZOs7ygH5BgQp4N+aYrZ2DNpWZ1KG3VOSOM= -github.com/andrew-d/go-termutil v0.0.0-20150726205930-009166a695a2/go.mod h1:jnzFpU88PccN/tPPhCpnNU8mZphvKxYM9lLNkd8e+os= github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be h1:9AeTilPcZAjCFIImctFaOjnTIavg87rW78vTPkQqLI8= github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be/go.mod h1:ySMOLuWl6zY27l47sB3qLNK6tF2fkHG55UZxx8oIVo4= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= @@ -874,16 +872,7 @@ github.com/jmhodges/levigo v1.0.0/go.mod h1:Q6Qx+uH3RAqyK4rFQroq9RL7mdkABMcfhEI+ github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= -github.com/jpillora/ansi v1.0.3 h1:nn4Jzti0EmRfDxm7JtEs5LzCbNwd5sv+0aE+LdS9/ZQ= -github.com/jpillora/ansi v1.0.3/go.mod h1:D2tT+6uzJvN1nBVQILYWkIdq7zG+b5gcFN5WI/VyjMY= -github.com/jpillora/backoff v1.0.0 h1:uvFg412JmmHBHw7iwprIxkPMI+sGQ4kzOWsMeHnm2EA= github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= -github.com/jpillora/chisel v1.9.1 h1:nGOF58+45WHlvDcq6AZu7En8nWOBCZHqj9boo5rB4qU= -github.com/jpillora/chisel v1.9.1/go.mod h1:qvgGfFR9ZhiDoYJM4IM1omX1HLbQSkZag8miP9u4SsQ= -github.com/jpillora/requestlog v1.0.0 h1:bg++eJ74T7DYL3DlIpiwknrtfdUA9oP/M4fL+PpqnyA= -github.com/jpillora/requestlog v1.0.0/go.mod h1:HTWQb7QfDc2jtHnWe2XEIEeJB7gJPnVdpNn52HXPvy8= -github.com/jpillora/sizestr v1.0.0 h1:4tr0FLxs1Mtq3TnsLDV+GYUWG7Q26a6s+tV5Zfw2ygw= -github.com/jpillora/sizestr v1.0.0/go.mod h1:bUhLv4ctkknatr6gR42qPxirmd5+ds1u7mzD+MZ33f0= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.8/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= @@ -1413,8 +1402,6 @@ github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1 github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/tomarrell/wrapcheck/v2 v2.9.0 h1:801U2YCAjLhdN8zhZ/7tdjB3EnAoRlJHt/s+9hijLQ4= github.com/tomarrell/wrapcheck/v2 v2.9.0/go.mod h1:g9vNIyhb5/9TQgumxQyOEqDHsmGYcGsVMOx/xGkqdMo= -github.com/tomasen/realip v0.0.0-20180522021738-f0c99a92ddce h1:fb190+cK2Xz/dvi9Hv8eCYJYvIGUTN2/KLq1pT6CjEc= -github.com/tomasen/realip v0.0.0-20180522021738-f0c99a92ddce/go.mod h1:o8v6yHRoik09Xen7gje4m9ERNah1d1PPsVq1VEx9vE4= github.com/tommy-muehle/go-mnd/v2 v2.5.1 h1:NowYhSdyE/1zwK9QCLeRb6USWdoif80Ie+v+yU8u1Zw= github.com/tommy-muehle/go-mnd/v2 v2.5.1/go.mod h1:WsUAkMJMYww6l/ufffCD3m+P7LEvr8TnZn9lwVDlgzw= github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= diff --git a/ignite/pkg/xchisel/xchisel.go b/ignite/pkg/xchisel/xchisel.go deleted file mode 100644 index b77cf387ec..0000000000 --- a/ignite/pkg/xchisel/xchisel.go +++ /dev/null @@ -1,58 +0,0 @@ -package xchisel - -import ( - "context" - "fmt" - "os" - "time" - - chclient "github.com/jpillora/chisel/client" - chserver "github.com/jpillora/chisel/server" - - "github.com/ignite/cli/v29/ignite/pkg/errors" -) - -var DefaultServerPort = "7575" - -func ServerAddr() string { - return os.Getenv("CHISEL_ADDR") -} - -func IsEnabled() bool { - return ServerAddr() != "" -} - -func StartServer(ctx context.Context, port string) error { - s, err := chserver.NewServer(&chserver.Config{}) - if err != nil { - return err - } - if err := s.StartContext(ctx, "127.0.0.1", port); err != nil { - return err - } - if err = s.Wait(); errors.Is(err, context.Canceled) { - return nil - } - return err -} - -func StartClient(ctx context.Context, serverAddr, localPort, remotePort string) error { - c, err := chclient.NewClient(&chclient.Config{ - MaxRetryInterval: time.Second, - MaxRetryCount: -1, - Server: serverAddr, - Remotes: []string{fmt.Sprintf("127.0.0.1:%s:127.0.0.1:%s", localPort, remotePort)}, - }) - if err != nil { - return err - } - c.Logger.Info = false - c.Logger.Debug = false - if err := c.Start(ctx); err != nil { - return err - } - if err = c.Wait(); errors.Is(err, context.Canceled) { - return nil - } - return err -} From 08e061ab258b5ec3be935df58a1efc56ead94c74 Mon Sep 17 00:00:00 2001 From: Danilo Pantani Date: Thu, 29 Aug 2024 09:18:35 +0200 Subject: [PATCH 5/6] feat: add `buf.build` version to `ignite version` command (#4326) * add buf.build version * add changelog --------- Co-authored-by: Julien Robert --- changelog.md | 1 + ignite/pkg/cosmosbuf/buf.go | 26 ++++++++++++++++++++++++-- ignite/version/version.go | 9 +++++++++ 3 files changed, 34 insertions(+), 2 deletions(-) diff --git a/changelog.md b/changelog.md index c6eb124d2f..dd26879628 100644 --- a/changelog.md +++ b/changelog.md @@ -17,6 +17,7 @@ - [#4113](https://github.com/ignite/cli/pull/4113) Generate chain config documentation automatically - [#4131](https://github.com/ignite/cli/pull/4131) Support `bytes` as data type in the `scaffold` commands - [#4300](https://github.com/ignite/cli/pull/4300) Only panics the module in the most top function level +- [#4326](https://github.com/ignite/cli/pull/4326) fAdd `buf.build` version to `ignite version` command ### Changes diff --git a/ignite/pkg/cosmosbuf/buf.go b/ignite/pkg/cosmosbuf/buf.go index 9af7b48007..d7a2a1081f 100644 --- a/ignite/pkg/cosmosbuf/buf.go +++ b/ignite/pkg/cosmosbuf/buf.go @@ -1,15 +1,18 @@ package cosmosbuf import ( + "bytes" "context" "fmt" "path/filepath" + "strings" "github.com/gobwas/glob" "golang.org/x/sync/errgroup" "github.com/ignite/cli/v29/ignite/pkg/cache" "github.com/ignite/cli/v29/ignite/pkg/cmdrunner/exec" + "github.com/ignite/cli/v29/ignite/pkg/cmdrunner/step" "github.com/ignite/cli/v29/ignite/pkg/dircache" "github.com/ignite/cli/v29/ignite/pkg/errors" "github.com/ignite/cli/v29/ignite/pkg/goenv" @@ -124,7 +127,7 @@ func FileByFile() GenOption { // New creates a new Buf based on the installed binary. func New(cacheStorage cache.Storage, goModPath string) (Buf, error) { - path, err := xexec.ResolveAbsPath(filepath.Join(goenv.Bin(), binaryName)) + p, err := path() if err != nil { return Buf{}, err } @@ -136,7 +139,7 @@ func New(cacheStorage cache.Storage, goModPath string) (Buf, error) { } return Buf{ - path: path, + path: p, cache: c, }, nil } @@ -309,3 +312,22 @@ func (b Buf) command( } return command, nil } + +func path() (string, error) { + return xexec.ResolveAbsPath(filepath.Join(goenv.Bin(), binaryName)) +} + +// Version runs the buf Version command. +func Version(ctx context.Context) (string, error) { + p, err := path() + if err != nil { + return "", err + } + + bufOut := &bytes.Buffer{} + if err := exec.Exec(ctx, []string{p, "--version"}, exec.StepOption(step.Stdout(bufOut))); err != nil { + return "", err + } + + return strings.TrimSpace(bufOut.String()), nil +} diff --git a/ignite/version/version.go b/ignite/version/version.go index 3b8fb6b715..efd6eaa509 100644 --- a/ignite/version/version.go +++ b/ignite/version/version.go @@ -18,6 +18,7 @@ import ( chainconfig "github.com/ignite/cli/v29/ignite/config/chain" "github.com/ignite/cli/v29/ignite/pkg/cmdrunner/exec" "github.com/ignite/cli/v29/ignite/pkg/cmdrunner/step" + "github.com/ignite/cli/v29/ignite/pkg/cosmosbuf" "github.com/ignite/cli/v29/ignite/pkg/cosmosver" "github.com/ignite/cli/v29/ignite/pkg/errors" "github.com/ignite/cli/v29/ignite/pkg/gitpod" @@ -40,6 +41,7 @@ type Info struct { CLIVersion string GoVersion string SDKVersion string + BufVersion string BuildDate string SourceHash string ConfigVersion string @@ -150,6 +152,7 @@ func Long(ctx context.Context) (string, error) { write("Ignite CLI source hash", info.SourceHash) write("Ignite CLI config version", info.ConfigVersion) write("Cosmos SDK version", info.SDKVersion) + write("Buf.Build version", info.BufVersion) write("Your OS", info.OS) write("Your arch", info.Arch) @@ -221,9 +224,15 @@ func GetInfo(ctx context.Context) (Info, error) { uname = strings.TrimSpace(unameBuf.String()) } + bufVersion, err := cosmosbuf.Version(ctx) + if err != nil { + return info, err + } + info.Uname = uname info.CLIVersion = resolveDevVersion(ctx) info.BuildDate = date + info.BufVersion = bufVersion info.SourceHash = head info.ConfigVersion = fmt.Sprintf("v%d", chainconfig.LatestVersion) info.SDKVersion = sdkVersion From e04d0f6924154018999a1adf829565e4560c669c Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Thu, 29 Aug 2024 08:33:31 +0000 Subject: [PATCH 6/6] fix(analytics): check do not track (#4329) Our do not track check was wrong and always returning true. This is why we were getting nothing. --- ignite/internal/analytics/analytics.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ignite/internal/analytics/analytics.go b/ignite/internal/analytics/analytics.go index 3858aa7117..e60bfe7c62 100644 --- a/ignite/internal/analytics/analytics.go +++ b/ignite/internal/analytics/analytics.go @@ -102,8 +102,10 @@ func SendMetric(wg *sync.WaitGroup, cmd *cobra.Command) { // checkDNT check if the user allow to track data or if the DO_NOT_TRACK // env var is set https://consoledonottrack.com/ func checkDNT() (anonIdentity, error) { - if dnt, err := strconv.ParseBool(os.Getenv(envDoNotTrack)); err != nil || dnt { - return anonIdentity{DoNotTrack: true}, nil + if dnt := os.Getenv(envDoNotTrack); dnt != "" { + if dnt, err := strconv.ParseBool(dnt); err != nil || dnt { + return anonIdentity{DoNotTrack: true}, nil + } } globalPath, err := config.DirPath()