From 9519a6616a2ea5fc4d60b6345ede6ea1d41facd4 Mon Sep 17 00:00:00 2001 From: Jorropo Date: Wed, 5 Apr 2023 17:21:48 +0200 Subject: [PATCH 1/5] cmd/boxo-migrate: add an error message if we do not find a .git folder (#263) --- cmd/boxo-migrate/boxomigrate.go | 34 +++++++++++++++++++++++++++++++ cmd/boxo-migrate/staticcheck.conf | 1 + 2 files changed, 35 insertions(+) create mode 100644 cmd/boxo-migrate/staticcheck.conf diff --git a/cmd/boxo-migrate/boxomigrate.go b/cmd/boxo-migrate/boxomigrate.go index 287620358..89adce9fa 100644 --- a/cmd/boxo-migrate/boxomigrate.go +++ b/cmd/boxo-migrate/boxomigrate.go @@ -4,6 +4,7 @@ import ( "fmt" "log" "os" + "path/filepath" "strings" migrate "github.com/ipfs/boxo/cmd/boxo-migrate/internal" @@ -55,9 +56,14 @@ func main() { &cli.BoolFlag{ Name: "dryrun", }, + &cli.BoolFlag{ + Name: "force", + Usage: "run even if no .git folder is found", + }, }, Action: func(clictx *cli.Context) error { dryrun := clictx.Bool("dryrun") + force := clictx.Bool("force") configFile := clictx.String("config") migrator, err := buildMigrator(dryrun, configFile) @@ -67,6 +73,34 @@ func main() { fmt.Printf("\n\n") + if !force { + p, err := os.Getwd() + if err != nil { + return fmt.Errorf("failed to fetch current working directory: %w", err) + } + + for { + g := filepath.Join(p, ".git") + _, err := os.Stat(g) + if err == nil { + break + } + newP := filepath.Dir(p) + if p == newP { + return fmt.Errorf(` +⚠️ Version Control System Check ⚠️ + +We couldn't locate a .git folder in any parent paths. We strongly recommend +using a Version Control System to help you easily compare and revert to a +previous state if needed, as this tool doesn't have an undo feature. + +If you're using a different VCS or like to live dangerously, you can bypass this +check by adding the --force flag.`) + } + p = newP + } + } + if !dryrun { err := migrator.GoGet("github.com/ipfs/boxo@v0.8.0-rc3") if err != nil { diff --git a/cmd/boxo-migrate/staticcheck.conf b/cmd/boxo-migrate/staticcheck.conf new file mode 100644 index 000000000..4282b2d9e --- /dev/null +++ b/cmd/boxo-migrate/staticcheck.conf @@ -0,0 +1 @@ +checks = ["-ST1005"] From 99c07bd6fcccc8d78c927a9260111560c54eb3a1 Mon Sep 17 00:00:00 2001 From: Gus Eggert Date: Tue, 4 Apr 2023 16:44:48 -0400 Subject: [PATCH 2/5] docs: add changelog for v0.8.0 --- CHANGELOG.md | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 000000000..27476c21f --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,52 @@ +# Changelog + +## v0.8.0 +### Added + +- Migrated repositories into Boxo + - github.com/ipfs/interface-go-ipfs-core => ./coreiface + - github.com/ipfs/go-pinning-service-http-client => ./pinning/remote/client + - github.com/ipfs/go-path => ./path + - github.com/ipfs/go-namesys => ./namesys + - github.com/ipfs/go-mfs => ./mfs + - github.com/ipfs/go-ipfs-provider => ./provider + - github.com/ipfs/go-ipfs-pinner => ./pinning/pinner + - github.com/ipfs/go-ipfs-keystore => ./keystore + - github.com/ipfs/go-filestore => ./filestore + - github.com/ipfs/go-ipns => ./ipns + - github.com/ipfs/go-blockservice => ./blockservice + - github.com/ipfs/go-ipfs-chunker => ./chunker + - github.com/ipfs/go-fetcher => ./fetcher + - github.com/ipfs/go-ipfs-blockstore => ./blockstore + - github.com/ipfs/go-ipfs-posinfo => ./filestore/posinfo + - github.com/ipfs/go-ipfs-util => ./util + - github.com/ipfs/go-ipfs-ds-help => ./datastore/dshelp + - github.com/ipfs/go-verifcid => ./verifcid + - github.com/ipfs/go-ipfs-exchange-offline => ./exchange/offline + - github.com/ipfs/go-ipfs-routing => ./routing + - github.com/ipfs/go-ipfs-exchange-interface => ./exchange + - github.com/ipfs/go-unixfs => ./ipld/unixfs + - github.com/ipfs/go-merkledag => ./ipld/merkledag + - github.com/ipld/go-car => ./ipld/car +- Added a migration tool to aid in migrating from the migrated repositories to Boxo, see the documentation here: https://github.com/ipfs/boxo/blob/main/README.md#migrating-to-boxo + - Added a check to ensure the migration tool is only run in a Git repository (with an optional override flag) +- Added tracing and metrics to the refactored gateway for its IPFS backend + + +### Changed + +- Removed a mention of "bitswap" in blockservice debug logs +- Changed the Bitswap message package from "bitswap.message.pb" to "bitswap.message.v1.pb" to avoid protobuf panics due to duplicate registration with [go-bitswap](https://github.com/ipfs/go-bitswap) +- Remove a busyloop in blockservice getBlocks by removing batching when caching + +### Deprecated + +### Removed + +### Fixed + +- Ensure dag-cbor/json codecs are registered in the gateway handler +- Refactor the Gateway API to operate on higher level semantics +- Fixed a panic in the gateway handler when returning errors + +### Security From cde9cc294bf1cb2a316a92db7007f014a6b49b4c Mon Sep 17 00:00:00 2001 From: Gus Eggert Date: Tue, 4 Apr 2023 16:49:05 -0400 Subject: [PATCH 3/5] feat: update migrator tool to use v0.8.0 --- cmd/boxo-migrate/boxomigrate.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/boxo-migrate/boxomigrate.go b/cmd/boxo-migrate/boxomigrate.go index 89adce9fa..94f82ab5e 100644 --- a/cmd/boxo-migrate/boxomigrate.go +++ b/cmd/boxo-migrate/boxomigrate.go @@ -102,7 +102,7 @@ check by adding the --force flag.`) } if !dryrun { - err := migrator.GoGet("github.com/ipfs/boxo@v0.8.0-rc3") + err := migrator.GoGet("github.com/ipfs/boxo@v0.8.0") if err != nil { return err } From ce7c0f4d91cc15791bf1418fabfad4247cb7d28c Mon Sep 17 00:00:00 2001 From: Gus Eggert Date: Tue, 4 Apr 2023 16:50:56 -0400 Subject: [PATCH 4/5] docs: add note to changelog about using Keep a Changelog format --- CHANGELOG.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 27476c21f..7c09d1bf6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,13 @@ # Changelog -## v0.8.0 +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [Unreleased] + +## [0.8.0] - 2023-04-04 ### Added - Migrated repositories into Boxo From 0324949e632e39b82eccbabfdc69a76c18bb74ff Mon Sep 17 00:00:00 2001 From: Gus Eggert Date: Wed, 5 Apr 2023 08:55:55 -0400 Subject: [PATCH 5/5] Release v0.8.0 --- CHANGELOG.md | 8 +++++++- version.json | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7c09d1bf6..cedb40a1f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] -## [0.8.0] - 2023-04-04 +## [0.8.0] - 2023-04-05 ### Added - Migrated repositories into Boxo @@ -48,8 +48,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Deprecated +None + ### Removed +None + ### Fixed - Ensure dag-cbor/json codecs are registered in the gateway handler @@ -57,3 +61,5 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fixed a panic in the gateway handler when returning errors ### Security + +None diff --git a/version.json b/version.json index 019b1210e..0ad79e3bf 100644 --- a/version.json +++ b/version.json @@ -1,3 +1,3 @@ { - "version": "v0.8.0-rc4" + "version": "v0.8.0" }