Skip to content

Commit

Permalink
Makefile: set GOPROXY and re-run mods
Browse files Browse the repository at this point in the history
Signed-off-by: Antonio Murdaca <[email protected]>
  • Loading branch information
runcom committed Oct 6, 2019
1 parent cba7aba commit 74ad7c2
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ linters:
#- scopelint
- staticcheck
- structcheck
- typecheck
#- typecheck
- unconvert
- unparam
- varcheck
Expand Down
9 changes: 6 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ GO111MODULE?=on
# vim: noexpandtab ts=8
export GOPATH=$(shell echo $${GOPATH:-$$HOME/go})
export GO111MODULE
export GOPROXY=https://proxy.golang.org

GOFLAGS = "containers_image_openpgp exclude_graphdriver_devicemapper exclude_graphdriver_btrfs containers_image_ostree_stub"

# grab the version from a dummy pkg in k8s.io/code-generator from vendor/modules.txt (read by go list)
versionPath=$(shell GO111MODULE=on go list -f {{.Dir}} k8s.io/code-generator/cmd/client-gen)
Expand Down Expand Up @@ -39,7 +42,7 @@ test: test-unit test-e2e

# Unit tests only (no active cluster required)
test-unit:
go test -count=1 -v ./cmd/... ./pkg/... ./lib/...
go test -tags=$(GOFLAGS) -count=1 -v ./cmd/... ./pkg/... ./lib/...

# Run the code generation tasks.
# Example:
Expand All @@ -60,13 +63,13 @@ go-deps:
install-tools:
# mktemp -d is required to avoid the creation of go modules related files in the project root
cd $(shell mktemp -d) && GO111MODULE=on go get github.com/securego/gosec/cmd/gosec@4b59c948083cd711b6a8aac8f32721b164899f57
cd $(shell mktemp -d) && GO111MODULE=on go get github.com/golangci/golangci-lint/cmd/golangci-lint@v1.17.1
cd $(shell mktemp -d) && GO111MODULE=on go get github.com/golangci/golangci-lint/cmd/golangci-lint@v1.18.0

# Run verification steps
# Example:
# make verify
verify: install-tools
golangci-lint run
golangci-lint run --build-tags=$(GOFLAGS)
# Remove once https://github.com/golangci/golangci-lint/issues/597 is
# addressed
gosec -severity high --confidence medium -exclude G204 -quiet ./...
Expand Down
5 changes: 1 addition & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ require (
github.com/coreos/container-linux-config-transpiler v0.9.0
github.com/coreos/ignition v0.26.0
github.com/creack/pty v1.1.9 // indirect
github.com/cri-o/cri-o v0.0.0-00010101000000-000000000000
github.com/cri-o/cri-o v1.9.0-beta.2.0.20191003162030-4775e1c05c26
github.com/davecgh/go-spew v1.1.1
github.com/docker/docker-credential-helpers v0.6.3 // indirect
github.com/docker/go-metrics v0.0.1 // indirect
Expand Down Expand Up @@ -80,9 +80,6 @@ require (

replace (
github.com/InVisionApp/go-health => github.com/InVisionApp/go-health v1.1.7-0.20190926150048-b5cab38233bb
// TODO(runcom) remove this once peter's 1.16 PR merges
github.com/cri-o/cri-o => github.com/haircommander/cri-o v1.9.0-beta.2.0.20191002183327-24dcc7272b13
// end TODO
github.com/go-log/log => github.com/go-log/log v0.1.1-0.20181211034820-a514cf01a3eb
github.com/godbus/dbus => github.com/godbus/dbus v0.0.0-20190623212516-8a1682060722
github.com/opencontainers/runtime-spec => github.com/opencontainers/runtime-spec v0.1.2-0.20190408193819-a1b50f621a48
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,8 @@ github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:ma
github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY=
github.com/creack/pty v1.1.9 h1:uDmaGzcdjhF4i/plgjmEsriH11Y0o7RKapEf/LDaM3w=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/cri-o/cri-o v1.9.0-beta.2.0.20191003162030-4775e1c05c26 h1:CncYqSfI3xVfedl3cQCCHKEx+nU4QGjcSVk3W8lyFhE=
github.com/cri-o/cri-o v1.9.0-beta.2.0.20191003162030-4775e1c05c26/go.mod h1:Zyf/AWxspq/FDHRYERdpXYUvLQPiC5Vz1lVNl/TpuBY=
github.com/cri-o/ocicni v0.1.1-0.20190702175919-7762645d18ca h1:CJstDqYy9ClWuPcDHMTCAiUS+ckekluYetGR2iYYWuo=
github.com/cri-o/ocicni v0.1.1-0.20190702175919-7762645d18ca/go.mod h1:BO0al9TKber3XUTucLzKgoG5sq8qiOB41H7zSdfw6r8=
github.com/cyphar/filepath-securejoin v0.2.1/go.mod h1:FpkQEhXnPnOthhzymB7CGsFk2G9VLXONKD9G7QGMM+4=
Expand Down Expand Up @@ -448,8 +450,6 @@ github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgf
github.com/grpc-ecosystem/grpc-gateway v1.3.0/go.mod h1:RSKVYQBd5MCa4OVpNdGskqpgL2+G+NZTnrVHpWWfpdw=
github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY=
github.com/grpc-ecosystem/grpc-gateway v1.9.2/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY=
github.com/haircommander/cri-o v1.9.0-beta.2.0.20191002183327-24dcc7272b13 h1:jgtstP4GvVsqmh02FLE9N0QK1/973wAZxa0xWmh8Pzg=
github.com/haircommander/cri-o v1.9.0-beta.2.0.20191002183327-24dcc7272b13/go.mod h1:Zyf/AWxspq/FDHRYERdpXYUvLQPiC5Vz1lVNl/TpuBY=
github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA=
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
github.com/hashicorp/go-multierror v1.0.0 h1:iVjPR7a6H0tWELX5NxNe7bYopibicUzc7uPribsnS6o=
Expand Down
4 changes: 2 additions & 2 deletions hack/build-go.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ mkdir -p ${BIN_PATH}
CGO_ENABLED=0

if [[ $WHAT == "machine-config-controller" ]]; then
GOFLAGS="-tags=containers_image_openpgp"
GOFLAGS="containers_image_openpgp exclude_graphdriver_devicemapper exclude_graphdriver_btrfs containers_image_ostree_stub"
fi

echo "Building ${REPO}/cmd/${WHAT} (${VERSION_OVERRIDE}, ${HASH})"
CGO_ENABLED=${CGO_ENABLED} GOOS=${GOOS} GOARCH=${GOARCH} go build ${GOFLAGS} -ldflags "${GLDFLAGS} -s -w" -o ${BIN_PATH}/${WHAT} ${REPO}/cmd/${WHAT}
CGO_ENABLED=${CGO_ENABLED} GOOS=${GOOS} GOARCH=${GOARCH} go build -tags="${GOFLAGS}" -ldflags "${GLDFLAGS} -s -w" -o ${BIN_PATH}/${WHAT} ${REPO}/cmd/${WHAT}
2 changes: 1 addition & 1 deletion pkg/controller/node/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ func checkNodeReady(node *corev1.Node) error {
cond := &node.Status.Conditions[i]
// We consider the node for scheduling only when its:
// - NodeReady condition status is ConditionTrue,
// - NodeOutOfDisk condition status is ConditionFalse,
// - NodeDiskPressure condition status is ConditionFalse,
// - NodeNetworkUnavailable condition status is ConditionFalse.
if cond.Type == corev1.NodeReady && cond.Status != corev1.ConditionTrue {
return fmt.Errorf("node %s is reporting NotReady", node.Name)
Expand Down
12 changes: 6 additions & 6 deletions pkg/controller/node/status_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,18 @@ func TestIsNodeReady(t *testing.T) {
// node2 ignored - node not Ready
{ObjectMeta: metav1.ObjectMeta{Name: "node2"}, Status: corev1.NodeStatus{Conditions: []corev1.NodeCondition{{Type: corev1.NodeReady, Status: corev1.ConditionFalse}}}},
// node3 ignored - node out of disk
{ObjectMeta: metav1.ObjectMeta{Name: "node3"}, Status: corev1.NodeStatus{Conditions: []corev1.NodeCondition{{Type: corev1.NodeOutOfDisk, Status: corev1.ConditionTrue}}}},
{ObjectMeta: metav1.ObjectMeta{Name: "node3"}, Status: corev1.NodeStatus{Conditions: []corev1.NodeCondition{{Type: corev1.NodeDiskPressure, Status: corev1.ConditionTrue}}}},
// node4 considered
{ObjectMeta: metav1.ObjectMeta{Name: "node4"}, Status: corev1.NodeStatus{Conditions: []corev1.NodeCondition{{Type: corev1.NodeOutOfDisk, Status: corev1.ConditionFalse}}}},
{ObjectMeta: metav1.ObjectMeta{Name: "node4"}, Status: corev1.NodeStatus{Conditions: []corev1.NodeCondition{{Type: corev1.NodeDiskPressure, Status: corev1.ConditionFalse}}}},

// node5 ignored - node out of disk
{ObjectMeta: metav1.ObjectMeta{Name: "node5"}, Status: corev1.NodeStatus{Conditions: []corev1.NodeCondition{{Type: corev1.NodeReady, Status: corev1.ConditionTrue}, {Type: corev1.NodeOutOfDisk, Status: corev1.ConditionTrue}}}},
{ObjectMeta: metav1.ObjectMeta{Name: "node5"}, Status: corev1.NodeStatus{Conditions: []corev1.NodeCondition{{Type: corev1.NodeReady, Status: corev1.ConditionTrue}, {Type: corev1.NodeDiskPressure, Status: corev1.ConditionTrue}}}},
// node6 considered
{ObjectMeta: metav1.ObjectMeta{Name: "node6"}, Status: corev1.NodeStatus{Conditions: []corev1.NodeCondition{{Type: corev1.NodeReady, Status: corev1.ConditionTrue}, {Type: corev1.NodeOutOfDisk, Status: corev1.ConditionFalse}}}},
{ObjectMeta: metav1.ObjectMeta{Name: "node6"}, Status: corev1.NodeStatus{Conditions: []corev1.NodeCondition{{Type: corev1.NodeReady, Status: corev1.ConditionTrue}, {Type: corev1.NodeDiskPressure, Status: corev1.ConditionFalse}}}},
// node7 ignored - node out of disk, node not Ready
{ObjectMeta: metav1.ObjectMeta{Name: "node7"}, Status: corev1.NodeStatus{Conditions: []corev1.NodeCondition{{Type: corev1.NodeReady, Status: corev1.ConditionFalse}, {Type: corev1.NodeOutOfDisk, Status: corev1.ConditionTrue}}}},
{ObjectMeta: metav1.ObjectMeta{Name: "node7"}, Status: corev1.NodeStatus{Conditions: []corev1.NodeCondition{{Type: corev1.NodeReady, Status: corev1.ConditionFalse}, {Type: corev1.NodeDiskPressure, Status: corev1.ConditionTrue}}}},
// node8 ignored - node not Ready
{ObjectMeta: metav1.ObjectMeta{Name: "node8"}, Status: corev1.NodeStatus{Conditions: []corev1.NodeCondition{{Type: corev1.NodeReady, Status: corev1.ConditionFalse}, {Type: corev1.NodeOutOfDisk, Status: corev1.ConditionFalse}}}},
{ObjectMeta: metav1.ObjectMeta{Name: "node8"}, Status: corev1.NodeStatus{Conditions: []corev1.NodeCondition{{Type: corev1.NodeReady, Status: corev1.ConditionFalse}, {Type: corev1.NodeDiskPressure, Status: corev1.ConditionFalse}}}},

// node9 ignored - node unschedulable
{ObjectMeta: metav1.ObjectMeta{Name: "node9"}, Spec: corev1.NodeSpec{Unschedulable: true}},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@ contents:
ExperimentalCriticalPodAnnotation: true
SupportPodPidsLimit: true
LocalStorageCapacityIsolation: false
TLSSecurityProfile: true
serverTLSBootstrap: true
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@ contents:
ExperimentalCriticalPodAnnotation: true
SupportPodPidsLimit: true
LocalStorageCapacityIsolation: false
TLSSecurityProfile: true
serverTLSBootstrap: true
2 changes: 1 addition & 1 deletion vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ github.com/coreos/ignition/config/v1/types
github.com/coreos/pkg/dlopen
# github.com/creack/pty v1.1.9
github.com/creack/pty
# github.com/cri-o/cri-o v0.0.0-00010101000000-000000000000 => github.com/haircommander/cri-o v1.9.0-beta.2.0.20191002183327-24dcc7272b13
# github.com/cri-o/cri-o v1.9.0-beta.2.0.20191003162030-4775e1c05c26
github.com/cri-o/cri-o/pkg/config
github.com/cri-o/cri-o/internal/oci
github.com/cri-o/cri-o/internal/version
Expand Down

0 comments on commit 74ad7c2

Please sign in to comment.