Skip to content

Commit

Permalink
fix: dive icon decentralisation error, remove unused flags (#72)
Browse files Browse the repository at this point in the history
* chore: add release workflow

* fix: fix decentralisation error

* chore: remove git relase action
  • Loading branch information
shreyasbhat0 authored Jul 27, 2023
1 parent 46e4483 commit 9fc9cf5
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 26 deletions.
53 changes: 35 additions & 18 deletions cli/.goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,32 @@ before:
- go generate ./...
- go build
builds:
- binary: "dive"
- id: cli
binary: "dive"
env:
- CGO_ENABLED=0
- CGO_ENABLED={{ if eq .Os "windows" }}0{{ else }}1{{ end }}
# Only override compilers if we are on CI, otherwise use the locally available C/C++ toolchain
- >-
{{- if index .Env "CI" }}
{{- if eq .Os "darwin" }}CC=o64h-clang{{- end }}
{{- if eq .Os "linux" }}
{{- if eq .Arch "amd64"}}CC=x86_64-linux-musl-gcc{{- end }}
{{- if eq .Arch "arm64"}}CC=aarch64-linux-musl-gcc{{- end }}
{{- end }}
{{- end }}
- >-
{{- if index .Env "CI" }}
{{- if eq .Os "darwin" }}CXX=o64h-clang++{{- end }}
{{- if eq .Os "linux" }}
{{- if eq .Arch "amd64"}}CXX=x86_64-linux-musl-g++{{- end }}
{{- if eq .Arch "arm64"}}CXX=aarch64-linux-musl-g++{{- end }}
{{- end }}
{{- end }}
ldflags:
- >-
{{- if eq .Os "linux" }}-linkmode external -extldflags "-static"{{- end }}
tags:
- osusergo
goos:
- linux
- windows
Expand All @@ -20,23 +43,15 @@ builds:
- arm64

archives:
- format: tar.gz
# this name template makes the OS and Arch compatible with the results of uname.
name_template: >-
{{ tolower .ProjectName }}_
{{- tolower .Os }}_
{{- if eq .Arch "amd64" }}x86_64
{{- else if eq .Arch "386" }}i386
{{- else }}{{ .Arch }}{{ end }}
{{- if .Arm }}v{{ .Arm }}{{ end }}_{{ .Tag }}
# use zip for windows archives
format_overrides:
- goos: windows
format: zip

- id: cli
builds:
- cli
name_template: dive-cli_{{ .Tag }}_{{ tolower .Os }}_{{ .Arch }}
brews:
# creates a brew formula representing the latest version
- name: dive-cli
ids:
- cli
tap:
owner: hugobyte
name: homebrew-tap
Expand All @@ -54,14 +69,16 @@ brews:
# creates a versioned brew formula, enabling installation of specific versions of kurtosis cli
- name: dive-cli@{{ .Tag }}
ids:
- cli
tap:
owner: hugobyte
name: homebrew-tap
commit_author:
name: shreyasbhat0
commit_msg_template: "Automated formula created for the CLI, version {{ .Tag }}"
homepage: "https://www.kurtosistech.com"
description: "CLI for managing Kurtosis environments."
homepage: "https://hugobyte.com"
description: "CLI for Dive Package"
license: "Apache 2.0"
# NOTE: Goreleaser *should* automatically detect the binaries packaged inside the archives being installed by the Homebrew formula, but it doesn't due to:
# https://github.com/goreleaser/goreleaser/issues/2488
Expand Down
2 changes: 1 addition & 1 deletion cli/commands/chain/types/eth.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ It establishes a connection to the Ethereum network and allows the node in execu
data := RunEthNode(diveContext)

diveContext.SetSpinnerMessage("Execution Completed")
err := data.WriteDiveResponse(diveContext)
err := data.WriteDiveResponse()
if err != nil {
diveContext.FatalError("Failed To Write To File", err.Error())
}
Expand Down
2 changes: 1 addition & 1 deletion cli/commands/chain/types/hardhat.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ It establishes a connection to the hardhat network and allows the node in execut

diveContext.SetSpinnerMessage("Execution Completed")

err := data.WriteDiveResponse(diveContext)
err := data.WriteDiveResponse()
if err != nil {
diveContext.FatalError("Failed To Write To File", err.Error())
}
Expand Down
7 changes: 3 additions & 4 deletions cli/commands/chain/types/icon.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ It establishes a connection to the Icon network and allows the node in executing
diveContext.SetSpinnerMessage("Starting Decentralisation")
Decentralisation(diveContext, params)

err := nodeResponse.WriteDiveResponse(diveContext)
err := nodeResponse.WriteDiveResponse()

if err != nil {
diveContext.FatalError("Failed To Write To File", err.Error())
Expand All @@ -87,7 +87,7 @@ It establishes a connection to the Icon network and allows the node in executing

nodeResponse := RunIconNode(diveContext)

err := nodeResponse.WriteDiveResponse(diveContext)
err := nodeResponse.WriteDiveResponse()

if err != nil {
diveContext.FatalError("Failed To Write To File", err.Error())
Expand All @@ -99,7 +99,6 @@ It establishes a connection to the Icon network and allows the node in executing
},
}

iconCmd.Flags().StringVarP(&id, "id", "i", "", "custom chain id for icon node")
iconCmd.Flags().StringVarP(&genesis, "genesis", "g", "", "path to custom genesis file")
iconCmd.Flags().StringVarP(&configFilePath, "config", "c", "", "path to custom config json file")
iconCmd.Flags().BoolP("decentralisation", "d", false, "decentralise Icon Node")
Expand All @@ -120,7 +119,7 @@ func IconDecentralisationCmd(diveContext *common.DiveContext) *cobra.Command {
Run: func(cmd *cobra.Command, args []string) {

params := GetDecentralizeParms(serviceName, nodeEndpoint, keystorePath, keystorepassword, networkID)

diveContext.InitKurtosisContext()
Decentralisation(diveContext, params)

diveContext.StopSpinner(fmt.Sprintln("Decentralisation Completed.Please find service details in dive.json"))
Expand Down
4 changes: 2 additions & 2 deletions cli/common/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,15 @@ func (dive *DiveserviceResponse) Decode(responseData []byte) (*DiveserviceRespon
return dive, nil
}
func (dive *DiveserviceResponse) EncodeToString() (string, error) {

encodedBytes, err := json.Marshal(dive)
if err != nil {
return "", nil
}

return string(encodedBytes), nil
}
func (dive *DiveserviceResponse) WriteDiveResponse(diveContext *DiveContext) error {
func (dive *DiveserviceResponse) WriteDiveResponse() error {

serialisedData, err := dive.EncodeToString()

Expand Down Expand Up @@ -105,7 +106,6 @@ func ReadConfigFile(filePath string) ([]byte, error) {
return file, nil
}
func WriteToFile(data string) error {

pwd, err := os.Getwd()

if err != nil {
Expand Down

0 comments on commit 9fc9cf5

Please sign in to comment.