Skip to content

Commit

Permalink
chore: use infra-checkers static analysis settings and bump go to 1.18
Browse files Browse the repository at this point in the history
  • Loading branch information
sigilioso committed Jul 28, 2022
1 parent f0e731a commit 055624e
Show file tree
Hide file tree
Showing 8 changed files with 64 additions and 63 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
29 changes: 0 additions & 29 deletions .golangci.yml

This file was deleted.

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
51 changes: 50 additions & 1 deletion 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
Expand All @@ -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

0 comments on commit 055624e

Please sign in to comment.