Skip to content

Commit

Permalink
chore: use infra-checkers static analysis settings, bump go to 1.18 a…
Browse files Browse the repository at this point in the history
…nd bump dependencies
  • Loading branch information
sigilioso committed Jul 28, 2022
1 parent f0e731a commit e8eac45
Show file tree
Hide file tree
Showing 8 changed files with 236 additions and 150 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/prerelease.yml
Expand Up @@ -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 }}
Expand Down
24 changes: 7 additions & 17 deletions .github/workflows/push_pr.yml
Expand Up @@ -11,40 +11,30 @@ 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:
name: Run all static analysis
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
Expand Down
2 changes: 1 addition & 1 deletion 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
Expand Down
4 changes: 2 additions & 2 deletions 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"]
ENTRYPOINT ["/bin/nri-discovery-kubernetes"]
13 changes: 2 additions & 11 deletions Makefile
Expand Up @@ -8,32 +8,23 @@ 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 ./...

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/
Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion build/Dockerfile
@@ -1,4 +1,4 @@
FROM golang:1.16-buster
FROM golang:1.18-buster

ARG GH_VERSION='1.10.3'

Expand Down
76 changes: 68 additions & 8 deletions go.mod
@@ -1,16 +1,76 @@
module github.com/newrelic/nri-discovery-kubernetes

go 1.13
go 1.18

require (
github.com/newrelic/nri-kubernetes/v2 v2.8.0
github.com/sirupsen/logrus v1.8.1
github.com/newrelic/nri-kubernetes/v2 v2.13.1
github.com/sirupsen/logrus v1.9.0
github.com/spf13/pflag v1.0.5
github.com/spf13/viper v1.8.1
github.com/stretchr/testify v1.7.0
k8s.io/api v0.22.0
k8s.io/apimachinery v0.22.0
k8s.io/client-go v0.22.0
github.com/spf13/viper v1.12.0
github.com/stretchr/testify v1.8.0
k8s.io/api v0.24.3
k8s.io/apimachinery v0.24.3
k8s.io/client-go v0.24.3
)

require (
github.com/PuerkitoBio/purell v1.1.1 // indirect
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/emicklei/go-restful v2.9.5+incompatible // indirect
github.com/fsnotify/fsnotify v1.5.4 // indirect
github.com/go-logr/logr v1.2.0 // indirect
github.com/go-openapi/jsonpointer v0.19.5 // indirect
github.com/go-openapi/jsonreference v0.19.5 // indirect
github.com/go-openapi/swag v0.19.14 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/gnostic v0.5.7-v3refs // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/imdario/mergo v0.3.8 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/magiconair/properties v1.8.6 // indirect
github.com/mailru/easyjson v0.7.6 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/newrelic/infra-integrations-sdk v2.0.1-0.20180410150501-14a5386f9150+incompatible // indirect
github.com/pelletier/go-toml v1.9.5 // indirect
github.com/pelletier/go-toml/v2 v2.0.1 // 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.28.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.8.2 // indirect
github.com/spf13/cast v1.5.0 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/stretchr/objx v0.4.0 // indirect
github.com/subosito/gotenv v1.3.0 // indirect
golang.org/x/net v0.0.0-20220520000938-2e3eb7b945c2 // indirect
golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5 // indirect
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8 // indirect
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/time v0.0.0-20220210224613-90d013bbcef8 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/protobuf v1.28.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/ini.v1 v1.66.4 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/klog/v2 v2.60.1 // indirect
k8s.io/kube-openapi v0.0.0-20220328201542-3ee0da9b0b42 // indirect
k8s.io/kubelet v0.23.5 // indirect
k8s.io/utils v0.0.0-20220210201930-3a6ce19ff2f9 // indirect
sigs.k8s.io/json v0.0.0-20211208200746-9f7c6b3444d2 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.1 // indirect
sigs.k8s.io/yaml v1.2.0 // indirect
)

replace github.com/pkg/sftp => github.com/pkg/sftp v1.13.2

0 comments on commit e8eac45

Please sign in to comment.