keda icon indicating copy to clipboard operation
keda copied to clipboard

[WIP] re-introduce vendor to satisfy reproducible builds requirement

Open zroubalik opened this issue 1 year ago • 4 comments

re-introduce vendor to satisfy reproducible builds requirement

Checklist

Fixes #3509

zroubalik avatar Aug 08 '22 14:08 zroubalik

/run-e2e internal* Update: You can check the progress here

zroubalik avatar Aug 08 '22 14:08 zroubalik

Can't approve from mobile, > 10k files changed and more than 3kk rows. Is it okey?

JorTurFer avatar Aug 08 '22 17:08 JorTurFer

Didn't you read all of them?

tomkerkhove avatar Aug 08 '22 18:08 tomkerkhove

I am not able to convince mockgen to properly generate mocks from files in vendor directory :(

Hava tried several things, something like this:

pkg/mock/mock_scale/mock_interfaces.go: $(shell pwd)/vendor/k8s.io/client-go/scale/interfaces.go
	$(MOCKGEN) -destination=$@ -package=mock_scale -source=$^ -build_flags=-mod=vendor
pkg/mock/mock_client/mock_interfaces.go: $(shell pwd)/vendor/sigs.k8s.io/controller-runtime/pkg/client/interfaces.go
	$(MOCKGEN) -destination=$@ -package=mock_client -source=$^ -build_flags=-mod=vendor

ends with files like this (note the change in import):

diff --git a/pkg/mock/mock_scale/mock_interfaces.go b/pkg/mock/mock_scale/mock_interfaces.go
index 45c07456..22ffa192 100644
--- a/pkg/mock/mock_scale/mock_interfaces.go
+++ b/pkg/mock/mock_scale/mock_interfaces.go
@@ -1,5 +1,5 @@
 // Code generated by MockGen. DO NOT EDIT.
-// Source: /go/pkg/mod/k8s.io/[email protected]/scale/interfaces.go
+// Source: /Users/zroubali/go/src/github.com/kedacore/keda/vendor/k8s.io/client-go/scale/interfaces.go
 
 // Package mock_scale is a generated GoMock package.
 package mock_scale
@@ -9,11 +9,11 @@ import (
        reflect "reflect"
 
        gomock "github.com/golang/mock/gomock"
+       scale "github.com/kedacore/keda/v2/vendor/k8s.io/client-go/scale"
        v1 "k8s.io/api/autoscaling/v1"
        v10 "k8s.io/apimachinery/pkg/apis/meta/v1"
        schema "k8s.io/apimachinery/pkg/runtime/schema"
        types "k8s.io/apimachinery/pkg/types"
-       scale "k8s.io/client-go/scale"
 )
 
 // MockScalesGetter is a mock of ScalesGetter interface.

the change ulitmately causes failed docker build:

#21 15.44 /workspace/bin/mockgen -destination=pkg/mock/mock_scale/mock_interfaces.go -package=mock_scale -source=/workspace/vendor/k8s.io/client-go/scale/interfaces.go -build_flags=-mod=vendor
#21 15.84 /workspace/bin/mockgen -destination=pkg/mock/mock_client/mock_interfaces.go -package=mock_client -source=/workspace/vendor/sigs.k8s.io/controller-runtime/pkg/client/interfaces.go -build_flags=-mod=vendor
#21 16.21 /workspace/bin/controller-gen object:headerFile="hack/boilerplate.go.txt" paths="./..."
#21 70.61 pkg/mock/mock_client/mock_interfaces.go:12:2: github.com/kedacore/keda/v2/vendor/sigs.k8s.io/controller-runtime/pkg/client must be imported as sigs.k8s.io/controller-runtime/pkg/client
#21 70.61 pkg/mock/mock_scale/mock_interfaces.go:12:2: github.com/kedacore/keda/v2/vendor/k8s.io/client-go/scale must be imported as k8s.io/client-go/scale
#21 70.61 Error: not all generators ran successfully
#21 70.61 run `controller-gen object:headerFile=hack/boilerplate.go.txt paths=./... -w` to see all available markers, or `controller-gen object:headerFile=hack/boilerplate.go.txt paths=./... -h` for usage
#21 70.73 make: *** [Makefile:124: generate] Error 1
------
executor failed running [/bin/sh -c VERSION=${BUILD_VERSION} GIT_COMMIT=${GIT_COMMIT} GIT_VERSION=${GIT_VERSION} TARGET_OS=$TARGETOS ARCH=$TARGETARCH make manager]: exit code: 2

💩 💩 💩 💩 💩 💩 💩 💩

zroubalik avatar Aug 08 '22 21:08 zroubalik

/run-e2e internal* Update: You can check the progress here

zroubalik avatar Nov 10 '22 11:11 zroubalik

zroubalik avatar Nov 10 '22 11:11 zroubalik

/run-e2e internal* Update: You can check the progress here

zroubalik avatar Nov 10 '22 12:11 zroubalik