diff --git a/cmd/frostfs-adm/internal/modules/morph/download.go b/cmd/frostfs-adm/internal/modules/morph/download.go deleted file mode 100644 index 3c50c0b34e..0000000000 --- a/cmd/frostfs-adm/internal/modules/morph/download.go +++ /dev/null @@ -1,40 +0,0 @@ -package morph - -import ( - "context" - "errors" - "fmt" - "io" - "net/http" - "strings" - - "github.com/google/go-github/v39/github" - "github.com/spf13/cobra" -) - -func downloadContractsFromGithub(cmd *cobra.Command) (io.ReadCloser, error) { - gcl := github.NewClient(nil) - release, _, err := gcl.Repositories.GetLatestRelease(context.Background(), "nspcc-dev", "frostfs-contract") - if err != nil { - return nil, fmt.Errorf("can't fetch release info: %w", err) - } - - cmd.Printf("Found %s (%s), downloading...\n", release.GetTagName(), release.GetName()) - - var url string - for _, a := range release.Assets { - if strings.HasPrefix(a.GetName(), "frostfs-contract") { - url = a.GetBrowserDownloadURL() - break - } - } - if url == "" { - return nil, errors.New("can't find contracts archive in release assets") - } - - resp, err := http.Get(url) - if err != nil { - return nil, fmt.Errorf("can't fetch contracts archive: %w", err) - } - return resp.Body, nil -} diff --git a/cmd/frostfs-adm/internal/modules/morph/initialize_deploy.go b/cmd/frostfs-adm/internal/modules/morph/initialize_deploy.go index 1e35fb79f0..7e03eae20a 100644 --- a/cmd/frostfs-adm/internal/modules/morph/initialize_deploy.go +++ b/cmd/frostfs-adm/internal/modules/morph/initialize_deploy.go @@ -401,8 +401,7 @@ func (c *initializeContext) readContracts(names []string) error { } else { var r io.ReadCloser if c.ContractPath == "" { - c.Command.Println("Contracts flag is missing, latest release will be fetched from Github.") - r, err = downloadContractsFromGithub(c.Command) + return errors.New("contracts flag is missing") } else { r, err = os.Open(c.ContractPath) } diff --git a/cmd/frostfs-adm/internal/modules/morph/root.go b/cmd/frostfs-adm/internal/modules/morph/root.go index 1361fe1584..431be125c8 100644 --- a/cmd/frostfs-adm/internal/modules/morph/root.go +++ b/cmd/frostfs-adm/internal/modules/morph/root.go @@ -309,7 +309,8 @@ func initUpdateContractsCmd() { RootCmd.AddCommand(updateContractsCmd) updateContractsCmd.Flags().String(alphabetWalletsFlag, "", "Path to alphabet wallets dir") updateContractsCmd.Flags().StringP(endpointFlag, "r", "", "N3 RPC node endpoint") - updateContractsCmd.Flags().String(contractsInitFlag, "", "Path to archive with compiled FrostFS contracts (default fetched from latest github release)") + updateContractsCmd.Flags().String(contractsInitFlag, "", "Path to archive with compiled FrostFS contracts") + _ = updateContractsCmd.MarkFlagRequired(contractsInitFlag) } func initDumpBalancesCmd() { @@ -370,7 +371,8 @@ func initInitCmd() { RootCmd.AddCommand(initCmd) initCmd.Flags().String(alphabetWalletsFlag, "", "Path to alphabet wallets dir") initCmd.Flags().StringP(endpointFlag, "r", "", "N3 RPC node endpoint") - initCmd.Flags().String(contractsInitFlag, "", "Path to archive with compiled FrostFS contracts (default fetched from latest github release)") + initCmd.Flags().String(contractsInitFlag, "", "Path to archive with compiled FrostFS contracts") + _ = initCmd.MarkFlagRequired(contractsInitFlag) initCmd.Flags().Uint(epochDurationCLIFlag, 240, "Amount of side chain blocks in one FrostFS epoch") initCmd.Flags().Uint(maxObjectSizeCLIFlag, 67108864, "Max single object size in bytes") initCmd.Flags().Bool(homomorphicHashDisabledCLIFlag, false, "Disable object homomorphic hashing") diff --git a/go.mod b/go.mod index 551fb0fb76..2f0244c6ed 100644 --- a/go.mod +++ b/go.mod @@ -11,7 +11,6 @@ require ( github.com/cheggaaa/pb v1.0.29 github.com/chzyer/readline v1.5.1 github.com/flynn-archive/go-shlex v0.0.0-20150515145356-3f9db97f8568 - github.com/google/go-github/v39 v39.2.0 github.com/google/uuid v1.3.0 github.com/hashicorp/golang-lru/v2 v2.0.1 github.com/klauspost/compress v1.16.5 @@ -59,7 +58,6 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/golang/snappy v0.0.3 // indirect - github.com/google/go-querystring v1.1.0 // indirect github.com/gorilla/websocket v1.4.2 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/hashicorp/golang-lru v0.6.0 // indirect diff --git a/go.sum b/go.sum index 185e3e00d9..3e5bcd5704 100644 Binary files a/go.sum and b/go.sum differ