diff --git a/.github/workflows/prerelease.yml b/.github/workflows/prerelease.yml index c2b8195..7652939 100644 --- a/.github/workflows/prerelease.yml +++ b/.github/workflows/prerelease.yml @@ -9,7 +9,7 @@ on: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - GO_VERSION: '1.16' + GO_VERSION: '1.18' INTEGRATION: "discovery-kubernetes" ORIGINAL_REPO_NAME: 'newrelic/nri-discovery-kubernetes' REPO_FULL_NAME: ${{ github.event.repository.full_name }} diff --git a/.github/workflows/push_pr.yml b/.github/workflows/push_pr.yml index 6d7e829..830a278 100644 --- a/.github/workflows/push_pr.yml +++ b/.github/workflows/push_pr.yml @@ -11,7 +11,7 @@ env: TAG: "v0.0.0" # needed for goreleaser windows builds REPO_FULL_NAME: ${{ github.event.repository.full_name }} ORIGINAL_REPO_NAME: "newrelic/nri-discovery-kubernetes" - GO_VERSION: '1.16' + GO_VERSION: '1.18' jobs: static-analysis: @@ -19,32 +19,22 @@ jobs: runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v2 + - uses: actions/setup-go@v2 + with: + go-version: ${{ env.GO_VERSION }} - uses: newrelic/newrelic-infra-checkers@v1 + with: + golangci-lint-config: golangci-lint-limited - name: Semgrep uses: returntocorp/semgrep-action@v1 with: auditOn: push - name: golangci-lint - uses: golangci/golangci-lint-action@v2 + uses: golangci/golangci-lint-action@v3 continue-on-error: ${{ github.event_name != 'pull_request' }} with: only-new-issues: true - snyk: - name: Run security checks via snyk - runs-on: ubuntu-20.04 - env: - SNYK_TOKEN: ${{ secrets.COREINT_SNYK_TOKEN }} - steps: - - uses: actions/checkout@v2 - - name: Login to DockerHub - uses: docker/login-action@v1 - with: - username: ${{ secrets.OHAI_DOCKER_HUB_ID }} - password: ${{ secrets.OHAI_DOCKER_HUB_PASSWORD }} - - name: Scan code for vulnerabilities - run: make ci/snyk-test - test-nix: name: Run unit tests on *Nix runs-on: ubuntu-20.04 diff --git a/.golangci.yml b/.golangci.yml deleted file mode 100644 index 7d1b085..0000000 --- a/.golangci.yml +++ /dev/null @@ -1,29 +0,0 @@ -run: - timeout: 5m - -linters: - enable: - - govet - - golint - - goimports - - unused - - goconst - - errcheck - enable-all: false - disable-all: true - fast: false - -# all available settings of specific linters -linters-settings: - golint: - # minimal confidence for issues, default is 0.8 - min-confidence: 0.3 - -issues: - exclude-use-default: false - -misspell: - locale: US - -lll: - line-length: 100 diff --git a/Dockerfile b/Dockerfile index e2ac1f7..5c7ce9d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.16-alpine AS build +FROM golang:1.18-alpine AS build RUN apk add --no-cache --update git make WORKDIR /go/src/github.com/newrelic/nri-discovery-kubernetes diff --git a/Dockerfile.release b/Dockerfile.release index 2798402..9d8da49 100644 --- a/Dockerfile.release +++ b/Dockerfile.release @@ -1,8 +1,8 @@ -FROM alpine:3.13 +FROM alpine:3.16 RUN apk add --no-cache --upgrade ca-certificates USER nobody COPY nri-discovery-kubernetes /bin/nri-discovery-kubernetes -ENTRYPOINT ["/bin/nri-discovery-kubernetes"] \ No newline at end of file +ENTRYPOINT ["/bin/nri-discovery-kubernetes"] diff --git a/Makefile b/Makefile index 24fc361..82477dd 100644 --- a/Makefile +++ b/Makefile @@ -8,20 +8,16 @@ IMAGE_NAME ?= newrelic/nri-discovery-kubernetes GOPATH := $(shell go env GOPATH) GORELEASER_VERSION := v0.168.0 GORELEASER_BIN ?= bin/goreleaser -GOLANGCI_LINT_BIN = golangci-lint all: build -build: check-version clean validate test compile +build: check-version clean test compile clean: @echo "=== $(PROJECT) === [ clean ]: Removing binaries and coverage file..." @rm -rfv bin @rm -rfv target -tools: check-version - @which $(GOLANGCI_LINT_BIN) || echo "golangci-lint not found in PATH" >&2 && exit 1 - fmt: @go fmt ./... @@ -29,11 +25,6 @@ deps: @echo "=== $(PROJECT) === [ deps ]: Installing package dependencies required by the project..." @go mod download -validate: deps - @echo "=== $(PROJECT) === [ validate ]: Validating source code running golangci-lint..." - @${GOLANGCI_LINT_BIN} --version - @${GOLANGCI_LINT_BIN} run - compile: deps @echo "=== $(PROJECT) === [ compile ]: Building $(BINARY_NAME)..." @go build -o bin/$(BINARY_NAME) ./cmd/discovery/ @@ -79,4 +70,4 @@ snyk/monitor: deps-only include $(CURDIR)/build/ci.mk include $(CURDIR)/build/release.mk -.PHONY: all fmt build clean tools tools-update deps deps-only validate compile compile-only test check-version tools-golangci-lint docker-build release release/deps release/test snyk snyk/monitor docker-release +.PHONY: all fmt build clean tools tools-update deps deps-only compile compile-only test check-version docker-build release release/deps release/test snyk snyk/monitor docker-release diff --git a/build/Dockerfile b/build/Dockerfile index c918724..263fa3b 100644 --- a/build/Dockerfile +++ b/build/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.16-buster +FROM golang:1.18-buster ARG GH_VERSION='1.10.3' diff --git a/go.mod b/go.mod index 0deb3ce..7247107 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/newrelic/nri-discovery-kubernetes -go 1.13 +go 1.18 require ( github.com/newrelic/nri-kubernetes/v2 v2.8.0 @@ -13,4 +13,53 @@ require ( k8s.io/client-go v0.22.0 ) +require ( + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/fsnotify/fsnotify v1.4.9 // indirect + github.com/go-logr/logr v0.4.0 // indirect + github.com/gogo/protobuf v1.3.2 // indirect + github.com/golang/protobuf v1.5.2 // indirect + github.com/google/go-cmp v0.5.6 // indirect + github.com/google/gofuzz v1.2.0 // indirect + github.com/googleapis/gnostic v0.5.5 // indirect + github.com/hashicorp/hcl v1.0.0 // indirect + github.com/imdario/mergo v0.3.8 // indirect + github.com/json-iterator/go v1.1.11 // indirect + github.com/magiconair/properties v1.8.5 // indirect + github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect + github.com/mitchellh/mapstructure v1.4.1 // indirect + github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect + github.com/modern-go/reflect2 v1.0.1 // indirect + github.com/newrelic/infra-integrations-sdk v2.0.1-0.20180410150501-14a5386f9150+incompatible // indirect + github.com/pelletier/go-toml v1.9.3 // indirect + github.com/pkg/errors v0.9.1 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/prometheus/client_model v0.2.0 // indirect + github.com/prometheus/common v0.26.0 // indirect + github.com/prometheus/prom2json v1.3.0 // indirect + github.com/segmentio/go-camelcase v0.0.0-20160726192923-7085f1e3c734 // indirect + github.com/spf13/afero v1.6.0 // indirect + github.com/spf13/cast v1.3.1 // indirect + github.com/spf13/jwalterweatherman v1.1.0 // indirect + github.com/stretchr/objx v0.2.0 // indirect + github.com/subosito/gotenv v1.2.0 // indirect + golang.org/x/net v0.0.0-20210525063256-abc453219eb5 // indirect + golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c // indirect + golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069 // indirect + golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d // indirect + golang.org/x/text v0.3.6 // indirect + golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac // indirect + google.golang.org/appengine v1.6.7 // indirect + google.golang.org/protobuf v1.26.0 // indirect + gopkg.in/inf.v0 v0.9.1 // indirect + gopkg.in/ini.v1 v1.62.0 // indirect + gopkg.in/yaml.v2 v2.4.0 // indirect + gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect + k8s.io/klog/v2 v2.9.0 // indirect + k8s.io/kubelet v0.22.0 // indirect + k8s.io/utils v0.0.0-20210802155522-efc7438f0176 // indirect + sigs.k8s.io/structured-merge-diff/v4 v4.1.2 // indirect + sigs.k8s.io/yaml v1.2.0 // indirect +) + replace github.com/pkg/sftp => github.com/pkg/sftp v1.13.2