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

Dependency update #16

Merged
merged 3 commits into from
Sep 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
5 changes: 0 additions & 5 deletions .errcheck-excludes

This file was deleted.

29 changes: 7 additions & 22 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: CI
on:
"on":
pull_request:
branches:
- '*'
Expand All @@ -19,38 +19,27 @@ jobs:
steps:
- name: Check out code
uses: actions/checkout@v2
with:
# Only a single commit is fetched by default, for the ref/SHA that
# triggered the workflow. We need `fetch-depth: 0` to fetch all
# history for all branches and tags.
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: "1.16"
go-version: "1.17"
- name: Make build
run: GO_BUILDFLAGS='-mod vendor' make build-all

lint:
name: Lint
runs-on: ubuntu-latest
if: '!contains(github.event.head_commit.message, ''[ci skip]'')'
steps:
- name: Check out code
uses: actions/checkout@v2

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: "1.16"

go-version: "1.17"
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v2
with:
skip-go-installation: true
version: latest

test:
name: Test
needs:
Expand All @@ -59,25 +48,21 @@ jobs:
steps:
- name: Check out code
uses: actions/checkout@v2

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: "1.16"

- name: Cache kubebuilder control plane binaries
go-version: "1.17"
- name: Cache envtest control plane binaries
uses: actions/cache@v2
with:
path: test/bin
key: ${{ runner.os }}-kubebuilder-${{ hashFiles('test/.kubebuilder-version') }}

key: ${{ runner.os }}-kubebuilder-${{ hashFiles('test/.envtest-version') }}
- name: Run tests and generate coverage report
run: GO_BUILDFLAGS='-mod vendor' make build/cover.out

- name: Upload coverage report to Coveralls
env:
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GIT_BRANCH: ${{ github.head_ref }}
run: |
GO111MODULE=off go get -u github.com/mattn/goveralls
go install github.com/mattn/goveralls@latest
goveralls -service=github -coverprofile=build/cover.out
4 changes: 2 additions & 2 deletions .github/workflows/license.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: "1.16"
go-version: "1.17"
- name: Check if source code files have license header
run: |
GO111MODULE=off go get -u github.com/google/addlicense
go install github.com/google/addlicense@latest
find * \( -name vendor -type d -prune \) -o \( -name \*.go -exec addlicense --check -- {} + \)

5 changes: 0 additions & 5 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ linters:
- misspell
- nakedret
- prealloc
- revive
- rowserrcheck
- staticcheck
- structcheck
Expand All @@ -57,10 +56,6 @@ linters-settings:
# `a := b.(MyStruct)`;
check-type-assertions: false

# Path to a file containing a list of functions to exclude from checking.
# See https://github.com/kisielk/errcheck#excluding-functions for details.
exclude: ./.errcheck-excludes

goimports:
# Put imports beginning with prefix after 3rd-party packages. It's a
# comma-separated list of prefixes.
Expand Down
23 changes: 14 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,27 @@
# Edit Makefile.maker.yaml instead. #
################################################################################

MAKEFLAGS=--warn-undefined-variables
# /bin/sh is dash on Debian which does not support all features of ash/bash
# to fix that we use /bin/bash only on Debian to not break Alpine
ifneq ($(shell grep -c debian /etc/os-release),0)
SHELL := /bin/bash
endif

default: build-all

VERSION := $(shell git describe --abbrev=7)
COMMIT_HASH := $(shell git rev-parse --verify HEAD)
BUILD_DATE := $(shell date -u +"%Y-%m-%dT%H:%M:%S%Z")

GOOS = $(shell go env GOOS)
GOARCH = $(shell go env GOARCH)
KUBEBUILDER_RELEASE_VERSION = $(shell cat test/.kubebuilder-version)
ENVTEST_VERSION = $(shell cat test/.envtest-version)

test/bin:
@mkdir $@
# Download kubebuilder and extract it to tmp
curl -L https://go.kubebuilder.io/dl/$(KUBEBUILDER_RELEASE_VERSION)/$(GOOS)/$(GOARCH) | tar -xz -C /tmp/
# Move to test/bin
mv /tmp/kubebuilder*/bin/* test/bin/
# Download setup-envtest tool
go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest
# Download envtest
setup-envtest --bin-dir test/bin use $(ENVTEST_VERSION)

# attach `make test/bin` as a dependency to the autogenerated `make build/cover.out`
build/cover.out: test/bin
Expand Down Expand Up @@ -46,7 +51,7 @@ install: FORCE build/absent-metrics-operator
install -D -m 0755 build/absent-metrics-operator "$(DESTDIR)$(PREFIX)/bin/absent-metrics-operator"

# which packages to test with "go test"
GO_TESTPKGS := $(shell go list -f '{{if .TestGoFiles}}{{.ImportPath}}{{end}}' ./...)
GO_TESTPKGS := $(shell go list -f '{{if or .TestGoFiles .XTestGoFiles}}{{.ImportPath}}{{end}}' ./...)
# which packages to measure coverage for
GO_COVERPKGS := $(shell go list ./...)
# to get around weird Makefile syntax restrictions, we need variables containing a space and comma
Expand Down Expand Up @@ -78,7 +83,7 @@ vendor: FORCE
go mod verify

license-headers: FORCE
@if ! hash addlicense 2>/dev/null; then printf "\e[1;36m>> Installing addlicense...\e[0m\n"; GO111MODULE=off go get -u github.com/google/addlicense; fi
@if ! hash addlicense 2>/dev/null; then printf "\e[1;36m>> Installing addlicense...\e[0m\n"; go install github.com/google/addlicense@latest; fi
find * \( -name vendor -type d -prune \) -o \( -name \*.go -exec addlicense -c "SAP SE" -- {} + \)

clean: FORCE
Expand Down
12 changes: 5 additions & 7 deletions Makefile.maker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,14 @@ verbatim: |
COMMIT_HASH := $(shell git rev-parse --verify HEAD)
BUILD_DATE := $(shell date -u +"%Y-%m-%dT%H:%M:%S%Z")

GOOS = $(shell go env GOOS)
GOARCH = $(shell go env GOARCH)
KUBEBUILDER_RELEASE_VERSION = $(shell cat test/.kubebuilder-version)
ENVTEST_VERSION = $(shell cat test/.envtest-version)

test/bin:
@mkdir $@
# Download kubebuilder and extract it to tmp
curl -L https://go.kubebuilder.io/dl/$(KUBEBUILDER_RELEASE_VERSION)/$(GOOS)/$(GOARCH) | tar -xz -C /tmp/
# Move to test/bin
mv /tmp/kubebuilder*/bin/* test/bin/
# Download setup-envtest tool
go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest
# Download envtest
setup-envtest --bin-dir test/bin use $(ENVTEST_VERSION)

# attach `make test/bin` as a dependency to the autogenerated `make build/cover.out`
build/cover.out: test/bin
Expand Down
87 changes: 70 additions & 17 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,32 +1,85 @@
module github.com/sapcc/absent-metrics-operator

go 1.16
go 1.17

// Note: the "k8s.io/*" and "github.com/prometheus/*" dependencies should have the same
// versions as used by github.com/prometheus-operator/prometheus-operator.
//
// Instructions:
// 1. Delete the `require` and `replace` directives in this file.
// 2. Pick a Git tag on https://github.com/prometheus-operator/prometheus-operator/tags
// 3. Copy the `require` and `replace` directives from that tag's go.mod file. If there
// are any local references in the `replace` directive, remove those.
// 4. Run `make vendor`.
// 5. Open an issue, if the above doesn't work.

// Note: ensure that the "k8s.io/*" and "github.com/prometheus/*" dependencies
// have the same versions as used by github.com/prometheus-operator/prometheus-operator.
require (
github.com/go-kit/kit v0.10.0
github.com/go-kit/log v0.2.0
github.com/onsi/ginkgo v1.16.4
github.com/onsi/gomega v1.13.0
github.com/onsi/gomega v1.15.0
github.com/pkg/errors v0.9.1
github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.48.1
github.com/prometheus-operator/prometheus-operator/pkg/client v0.48.1
github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.51.1
github.com/prometheus-operator/prometheus-operator/pkg/client v0.51.1
github.com/prometheus/client_golang v1.11.0
github.com/prometheus/prometheus v1.8.2-0.20210421143221-52df5ef7a3be
github.com/sapcc/go-bits v0.0.0-20210518135053-8a9465bb1339
github.com/prometheus/prometheus v1.8.2-0.20210914090109-37468d88dce8
github.com/sapcc/go-bits v0.0.0-20210929140247-281bcf017ba7
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
k8s.io/api v0.21.2
k8s.io/apimachinery v0.21.2
k8s.io/api v0.22.2
k8s.io/apimachinery v0.22.2
k8s.io/client-go v12.0.0+incompatible
sigs.k8s.io/controller-runtime v0.9.2
sigs.k8s.io/controller-runtime v0.10.1
)

require (
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/evanphx/json-patch v4.11.0+incompatible // indirect
github.com/fsnotify/fsnotify v1.4.9 // indirect
github.com/go-logfmt/logfmt v0.5.1 // indirect
github.com/go-logr/logr v0.4.0 // indirect
github.com/go-logr/zapr 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.1.0 // indirect
github.com/googleapis/gnostic v0.5.5 // indirect
github.com/imdario/mergo v0.3.12 // indirect
github.com/json-iterator/go v1.1.11 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.1 // indirect
github.com/nxadm/tail v1.4.8 // indirect
github.com/prometheus/client_model v0.2.0 // indirect
github.com/prometheus/common v0.30.0 // indirect
github.com/prometheus/procfs v0.6.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
go.uber.org/atomic v1.9.0 // indirect
go.uber.org/multierr v1.6.0 // indirect
go.uber.org/zap v1.19.0 // indirect
golang.org/x/net v0.0.0-20210903162142-ad29c8ab022f // indirect
golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f // indirect
golang.org/x/sys v0.0.0-20210906170528-6f6e22806c34 // 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.27.1 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
k8s.io/apiextensions-apiserver v0.22.2 // indirect
k8s.io/klog/v2 v2.20.0 // indirect
k8s.io/kube-openapi v0.0.0-20210421082810-95288971da7e // indirect
k8s.io/utils v0.0.0-20210820185131-d34e5cb4466e // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.1.2 // indirect
sigs.k8s.io/yaml v1.2.0 // indirect
)

replace (
// A replace directive is needed for k8s.io/client-go because Cortex (which
// is an indirect dependency through Thanos) has a requirement on v12.0.0.
k8s.io/client-go => k8s.io/client-go v0.21.0
// Override the official klog package with this one. This simply replaces
// the code in vendor/k8s.io/klog with the code of this package.
k8s.io/klog => github.com/simonpasquier/klog-gokit v0.3.0
k8s.io/klog/v2 => github.com/simonpasquier/klog-gokit/v2 v2.1.0
k8s.io/client-go => k8s.io/client-go v0.22.2
k8s.io/klog/v2 => github.com/simonpasquier/klog-gokit/v3 v3.0.0
)
Loading