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

re-introduce vendor to satisfy reproducible builds requirement #3518

Merged
merged 7 commits into from
Nov 10, 2022

Conversation

zroubalik
Copy link
Member

@zroubalik zroubalik commented Aug 8, 2022

re-introduce vendor to satisfy reproducible builds requirement

Checklist

Fixes #3509

@zroubalik zroubalik requested a review from a team as a code owner August 8, 2022 14:41
@zroubalik zroubalik changed the title re-introduce vendor to satisfy reproducible builds requirement [WIP] re-introduce vendor to satisfy reproducible builds requirement Aug 8, 2022
@zroubalik
Copy link
Member Author

zroubalik commented Aug 8, 2022

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

@JorTurFer
Copy link
Member

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

@tomkerkhove
Copy link
Member

Didn't you read all of them?

@zroubalik
Copy link
Member Author

zroubalik commented Aug 8, 2022

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
Copy link
Member Author

zroubalik commented Nov 10, 2022

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

@zroubalik
Copy link
Member Author

zroubalik commented Nov 10, 2022

Signed-off-by: Zbynek Roubalik <[email protected]>
Signed-off-by: Zbynek Roubalik <[email protected]>
Signed-off-by: Zbynek Roubalik <[email protected]>
Signed-off-by: Zbynek Roubalik <[email protected]>
Signed-off-by: Zbynek Roubalik <[email protected]>
Signed-off-by: Zbynek Roubalik <[email protected]>
Signed-off-by: Zbynek Roubalik <[email protected]>
@zroubalik zroubalik changed the title [WIP] re-introduce vendor to satisfy reproducible builds requirement re-introduce vendor to satisfy reproducible builds requirement Nov 10, 2022
@zroubalik
Copy link
Member Author

zroubalik commented Nov 10, 2022

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

Copy link
Member

@JorTurFer JorTurFer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@zroubalik zroubalik merged commit cbdb405 into kedacore:main Nov 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Produce reproducible builds
3 participants