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

Tools 2841 #35

Merged
merged 16 commits into from
Mar 13, 2024
5 changes: 2 additions & 3 deletions .github/workflows/snyk-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,15 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
submodules: true
- name: Get go version from go.mod
run: |
echo "GO_VERSION=$(grep '^go ' go.mod | cut -d " " -f 2)" >> $GITHUB_ENV
- name: Setup go version
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
- name: Install dependencies
run : |
make dependencies
- name: Setup snyk CLI
uses: snyk/actions/setup@master
- name: Run Snyk to check for vulnerabilities and record dependencies
Expand Down
11 changes: 6 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,13 @@ jobs:
- uses: actions/checkout@v3
with:
submodules: true
- uses: actions/setup-go@v4
with:
go-version: "^1.19.0"
- name: Install dependencies
- name: Get go version from go.mod
run: |
make dependencies
echo "GO_VERSION=$(grep '^go ' go.mod | cut -d " " -f 2)" >> $GITHUB_ENV
- name: Setup go version
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
- name: Write feature keys
run: |
echo "$FEATURESV1" > /tmp/featuresv1.conf
Expand Down
22 changes: 10 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ TESTDATA_DIR = $(ROOT_DIR)/testdata
COVERAGE_DIR = $(TESTDATA_DIR)/coverage
COV_UNIT_DIR = $(COVERAGE_DIR)/unit
COV_INTEGRATION_DIR = $(COVERAGE_DIR)/integration
ASCONFIG = asconfig
BUILD_DIR = $(ROOT_DIR)/bin
ACONFIG_BIN = $(BUILD_DIR)/$(ASCONFIG)

ifdef GOOS
GO_ENV_VARS = GOOS=$(GOOS)
Expand All @@ -17,9 +20,8 @@ GO_ENV_VARS += GOARCH=$(GOARCH)
endif

# Builds asconfig binary
.PHONY: asconfig
asconfig: dependencies
$(GO_ENV_VARS) go build -ldflags="-X 'github.com/aerospike/asconfig/cmd.VERSION=$(VERSION)'" -o bin/asconfig .
$(ACONFIG_BIN): $(wildcard *.go)
$(GO_ENV_VARS) go build -ldflags="-X 'github.com/aerospike/asconfig/cmd.VERSION=$(VERSION)'" -o $(ACONFIG_BIN) .

# Clean up
.PHONY: clean
Expand All @@ -29,17 +31,13 @@ clean:
$(RM) -r $(TESTDATA_DIR)/bin/*
$(MAKE) -C $(ROOT_DIR)/pkg/ $@

PHONY: dependencies
dependencies:
git submodule update --init

PHONY: install
install: asconfig
install -m 755 ./bin/asconfig $(INSTALL_DIR)
install: $(ACONFIG_BIN)
install -m 755 $(ACONFIG_BIN) $(INSTALL_DIR)

PHONY: uninstall
uninstall:
rm $(INSTALL_DIR)/asconfig
rm $(INSTALL_DIR)/$(ASCONFIG)

# fpm is needed to build these artifacts
.PHONY: all
Expand All @@ -61,12 +59,12 @@ tar: asconfig
test: integration unit

.PHONY: integration
integration: dependencies
integration:
mkdir -p $(COV_INTEGRATION_DIR) || true
go test -tags=integration -timeout 30m

.PHONY: unit
unit: dependencies
unit:
mkdir -p $(COV_UNIT_DIR) || true
go test -tags=unit -cover ./... -args -test.gocoverdir=$(COV_UNIT_DIR)

Expand Down
11 changes: 1 addition & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,13 @@ Build asconfig using the included makefile and display usage information.
```shell
git clone https://github.com/aerospike/asconfig.git
cd asconfig
git submodule update --init
make
./bin/asconfig --help
```

The built binary is available at bin/asconfig.

You can also build asconfig using `go build`.

```shell
git clone https://github.com/aerospike/asconfig.git
cd asconfig
git submodule update --init
go build -o ./bin/asconfig
./bin/asconfig --help
```

Install or uninstall asconfig.

```shell
Expand Down
5 changes: 2 additions & 3 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,11 @@ func newRootCmd() *cobra.Command {
},
}

rootCmd.Version = VERSION

// TODO: log levels should be generic and not tied to logrus or golang.
logLevelUsage := fmt.Sprintf("Set the logging detail level. Valid levels are: %v", log.GetLogLevels())
rootCmd.PersistentFlags().StringP("log-level", "l", "info", logLevelUsage)
rootCmd.PersistentFlags().AddFlagSet(cfFileFlags.NewFlagSet(flags.DefaultWrapHelpString))
flags.SetupRoot(rootCmd, "Aerospike Config")
flags.SetupRoot(rootCmd, "Aerospike Config", VERSION)

rootCmd.SilenceErrors = true
rootCmd.SilenceUsage = true
Expand Down
29 changes: 21 additions & 8 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
module github.com/aerospike/asconfig

go 1.20
go 1.21

toolchain go1.21.7

require (
github.com/aerospike/aerospike-client-go/v6 v6.14.1
github.com/aerospike/aerospike-management-lib v1.2.1-0.20240131023930-e7454a7e0866
github.com/aerospike/tools-common-go v0.0.0-20240202003831-d9386330f03a
github.com/aerospike/aerospike-client-go/v7 v7.1.0
github.com/aerospike/aerospike-management-lib v1.2.1-0.20240312121654-af11e0a2cf3a
github.com/aerospike/tools-common-go v0.0.0-20240221005915-c73ebdf1bd6b
github.com/bombsimon/logrusr/v4 v4.1.0
github.com/docker/docker v24.0.7+incompatible
github.com/docker/docker v25.0.3+incompatible
github.com/go-logr/logr v1.4.1
github.com/opencontainers/image-spec v1.0.2
github.com/sirupsen/logrus v1.9.3
Expand All @@ -20,13 +22,15 @@ require (
require (
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect
github.com/Microsoft/go-winio v0.6.1 // indirect
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/deckarep/golang-set/v2 v2.6.0 // indirect
github.com/distribution/reference v0.5.0 // indirect
github.com/docker/distribution v2.8.3+incompatible // indirect
github.com/docker/go-connections v0.5.0 // indirect
github.com/docker/go-units v0.5.0 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
Expand All @@ -38,6 +42,7 @@ require (
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/qdm12/reprint v0.0.0-20200326205758-722754a53494 // indirect
github.com/rogpeppe/go-internal v1.10.0 // indirect
github.com/sagikazarmark/locafero v0.4.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
github.com/sourcegraph/conc v0.3.0 // indirect
Expand All @@ -49,17 +54,25 @@ require (
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
github.com/xeipuuv/gojsonschema v1.2.0 // indirect
github.com/yuin/gopher-lua v1.1.1 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.48.0 // indirect
go.opentelemetry.io/otel v1.24.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.24.0 // indirect
go.opentelemetry.io/otel/metric v1.24.0 // indirect
go.opentelemetry.io/otel/sdk v1.24.0 // indirect
go.opentelemetry.io/otel/trace v1.24.0 // indirect
go.opentelemetry.io/proto/otlp v1.1.0 // indirect
go.uber.org/atomic v1.9.0 // indirect
go.uber.org/multierr v1.9.0 // indirect
golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect
golang.org/x/mod v0.14.0 // indirect
golang.org/x/net v0.20.0 // indirect
golang.org/x/sync v0.6.0 // indirect
golang.org/x/sys v0.16.0 // indirect
golang.org/x/sys v0.17.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/tools v0.16.1 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240108191215-35c7eff3a6b1 // indirect
google.golang.org/grpc v1.60.1 // indirect
google.golang.org/grpc v1.61.0 // indirect
google.golang.org/protobuf v1.32.0 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
)
Loading
Loading