stolostron / multicluster-global-hub

the main repository for the multicluster global hub
Apache License 2.0
20 stars 30 forks source link

make: *** [Makefile:101: fmt] Error 127 #243

Closed irshadstars closed 3 months ago

irshadstars commented 1 year ago

i following installation documents for multicluster-global-hub .

i have installed ACM in an OpenShift Container Platform and try to bring Multicluster Global Hub Operator in developing environment :

[root@api.acm27test.cp.fyre.ibm.com ~]# oc get pod -n open-cluster-management NAME READY STATUS RESTARTS AGE console-chart-console-v2-7697bd7764-59v7h 1/1 Running 0 21h console-chart-console-v2-7697bd7764-l52v6 1/1 Running 0 8h grc-policy-addon-controller-8549f6dfcd-d4fg5 1/1 Running 0 21h grc-policy-addon-controller-8549f6dfcd-rsmw4 1/1 Running 0 21h grc-policy-propagator-7646646c54-5zgnd 2/2 Running 1 (8h ago) 21h grc-policy-propagator-7646646c54-tct9j 2/2 Running 2 (5h57m ago) 21h insights-client-5479f95fd8-cq966 1/1 Running 0 21h insights-metrics-6b6bd9d7df-46nzl 2/2 Running 0 21h klusterlet-addon-controller-v2-6c55bc6c46-c4q25 1/1 Running 1 (8h ago) 21h klusterlet-addon-controller-v2-6c55bc6c46-h7hxx 1/1 Running 3 (7h32m ago) 21h management-ingress-10155-64588954d8-45fvx 2/2 Running 0 21h management-ingress-10155-64588954d8-nmphp 2/2 Running 0 21h multicluster-observability-operator-6bcbc99465-lmlmm 1/1 Running 6 (5h57m ago) 21h multicluster-operators-application-7564795b95-j5sv5 3/3 Running 2 (21h ago) 21h multicluster-operators-channel-d6956fb9d-c464r 1/1 Running 1 (21h ago) 21h multicluster-operators-hub-subscription-68d9455966-dm7jj 1/1 Running 1 (21h ago) 21h multicluster-operators-standalone-subscription-5b78bbff64-w82mw 1/1 Running 0 21h multicluster-operators-subscription-report-6fc48d8f49-4xbsz 1/1 Running 0 21h multiclusterhub-operator-f76fcd5d7-4wk24 1/1 Running 1 (8h ago) 21h multiclusterhub-repo-7df6c4bb96-qzgb4 1/1 Running 0 21h search-api-6f89b74495-cr6rv 1/1 Running 1 (21h ago) 21h search-collector-7c557fc9c6-wppr7 1/1 Running 0 21h search-indexer-7cf45f599d-lptfk 1/1 Running 1 (21h ago) 21h search-postgres-5b6b8f5989-ft9jn 1/1 Running 0 21h search-v2-operator-controller-manager-8b6984c68-kfznx 1/1 Running 3 (8h ago) 21h submariner-addon-689f784749-fq5cd 1/1 Running 0 21h volsync-addon-controller-658f865f77-jjc92 1/1 Running 0 21h [root@api.acm27test.cp.fyre.ibm.com ~]#

Error occurred when running command
[root@api.acm27test.cp.fyre.ibm.com operator]# make docker-build docker-push IMG=quay.io/rchowdap/multicluster-global-hub-operator:mghirshad GOBIN=/root/multicluster-global-hub/operator/bin go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.8.0 go: downloading sigs.k8s.io/controller-tools v0.8.0 go: downloading github.com/spf13/cobra v1.2.1 go: downloading golang.org/x/tools v0.1.6-0.20210820212750-d4cc65f0b2ff go: downloading sigs.k8s.io/yaml v1.3.0 go: downloading github.com/gobuffalo/flect v0.2.3 go: downloading k8s.io/apiextensions-apiserver v0.23.0 go: downloading k8s.io/apimachinery v0.23.0 go: downloading github.com/fatih/color v1.12.0 go: downloading k8s.io/api v0.23.0 go: downloading gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b go: downloading github.com/spf13/pflag v1.0.5 go: downloading gopkg.in/yaml.v2 v2.4.0 go: downloading github.com/gogo/protobuf v1.3.2 go: downloading k8s.io/utils v0.0.0-20210930125809-cb0fa318a74b go: downloading golang.org/x/sys v0.0.0-20210831042530-f4d43177bf5e go: downloading golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 go: downloading github.com/google/gofuzz v1.1.0 go: downloading k8s.io/klog/v2 v2.30.0 go: downloading sigs.k8s.io/structured-merge-diff/v4 v4.1.2 go: downloading github.com/mattn/go-colorable v0.1.8 go: downloading github.com/mattn/go-isatty v0.0.12 go: downloading sigs.k8s.io/json v0.0.0-20211020170558-c049b76a60c6 go: downloading golang.org/x/mod v0.4.2 go: downloading gopkg.in/inf.v0 v0.9.1 go: downloading github.com/google/go-cmp v0.5.6 go: downloading github.com/go-logr/logr v1.2.0 go: downloading github.com/json-iterator/go v1.1.12 go: downloading golang.org/x/net v0.0.0-20210825183410-e898025ed96a go: downloading github.com/modern-go/reflect2 v1.0.2 go: downloading github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd go: downloading golang.org/x/text v0.3.7 /root/multicluster-global-hub/operator/bin/controller-gen rbac:roleName=multicluster-global-hub-operator-role crd webhook paths="./..." output:crd:artifacts:config=config/crd/bases /root/multicluster-global-hub/operator/bin/controller-gen object:headerFile="hack/boilerplate.go.txt" paths="./..." bash: gci: command not found make: [Makefile:101: fmt] Error 127 [root@api.acm27test.cp.fyre.ibm.com multicluster-global-hub]# make docker-build docker-push IMG=quay.io/rchowdap/multicluster-global-hub-operator:mghv12 make: No rule to make target 'docker-build'. Stop. [root@api.acm27test.cp.fyre.ibm.com multicluster-global-hub]#

morvencao commented 1 year ago

@irshadstars You need to enter operator directory(https://github.com/stolostron/multicluster-global-hub/tree/main/operator) and then execute:

cd operator
make docker-build docker-push
irshadstars commented 1 year ago

@morvencao i got below error Please help [root@api.acm27test.cp.fyre.ibm.com multicluster-global-hub]# cd operator/ [root@api.acm27test.cp.fyre.ibm.com operator]# make docker-build docker-push mkdir -p /root/multicluster-global-hub/operator/bin GOBIN=/root/multicluster-global-hub/operator/bin go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.8.0 /root/multicluster-global-hub/operator/bin/controller-gen rbac:roleName=multicluster-global-hub-operator-role crd webhook paths="./..." output:crd:artifacts:config=config/crd/bases /root/multicluster-global-hub/operator/bin/controller-gen object:headerFile="hack/boilerplate.go.txt" paths="./..." bash: gci: command not found make: *** [Makefile:101: fmt] Error 127 [root@api.acm27test.cp.fyre.ibm.com operator]# [root@api.acm27test.cp.fyre.ibm.com operator]# uname -r 4.18.0-372.9.1.el8.s390x

morvencao commented 1 year ago

@irshadstars You need to install gci tool(https://github.com/daixiang0/gci#installation) by the following command:

go install github.com/daixiang0/gci@latest

then build again.

irshadstars commented 1 year ago

[root@api.acm27test.cp.fyre.ibm.com operator]# export GOPATH=$HOME/go [root@api.acm27test.cp.fyre.ibm.com operator]# export PATH=$PATH:$GOROOT/bin:$GOPATH/bin [root@api.acm27test.cp.fyre.ibm.com operator]# make docker-build docker-push /root/multicluster-global-hub/operator/bin/controller-gen rbac:roleName=multicluster-global-hub-operator-role crd webhook paths="./..." output:crd:artifacts:config=config/crd/bases /root/multicluster-global-hub/operator/bin/controller-gen object:headerFile="hack/boilerplate.go.txt" paths="./..." GOFUMPT_SPLIT_LONG_LINES=on gofumpt -w ./main.go ./apis/ ./pkg/ bash: gofumpt: command not found make: *** [Makefile:103: fmt] Error 127 [root@api.acm27test.cp.fyre.ibm.com operator]#

morvencao commented 1 year ago

@irshadstars we recently added some lint tools but didn't update document, we will do it soon.

For this you should run the following command to install gofumpt:

go install mvdan.cc/gofumpt@latest
irshadstars commented 1 year ago

error.docx

morvencao commented 1 year ago

@irshadstars can you transform it to other format file or just put it inline in github, because I can't open the error.docx after I downloaded it.

irshadstars commented 1 year ago

@morvencao i got below error while execution make

[root@api.acm27test.cp.fyre.ibm.com operator]# make docker-build docker-push 
warning: GOPATH set to GOROOT (/root/go) has no effect
/root/multicluster-global-hub/operator/bin/controller-gen rbac:roleName=multicluster-global-hub-operator-role crd webhook paths="./..." output:crd:artifacts:config=config/crd/bases
Error: err: exit status 2: stderr: warning: GOPATH set to GOROOT (/root/go) has no effect
# runtime/cgo
cgo: C compiler "gcc" not found: exec: "gcc": executable file not found in $PATH

Usage:
  controller-gen [flags]

Examples:
        # Generate RBAC manifests and crds for all types under apis/,
        # outputting crds to /tmp/crds and everything else to stdout
        controller-gen rbac:roleName=<role name> crd paths=./apis/... output:crd:dir=/tmp/crds output:stdout

        # Generate deepcopy/runtime.Object implementations for a particular file
        controller-gen object paths=./apis/v1beta1/some_types.go

        # Generate OpenAPI v3 schemas for API packages and merge them into existing CRD manifests
        controller-gen schemapatch:manifests=./manifests output:dir=./manifests paths=./pkg/apis/... 

        # Run all the generators for a given project
        controller-gen paths=./apis/...

        # Explain the markers for generating CRDs, and their arguments
        controller-gen crd -ww

Flags:
  -h, --detailed-help count   print out more detailed help
                              (up to -hhh for the most detailed output, or -hhhh for json output)
      --help                  print out usage and a summary of options
      --version               show version
  -w, --which-markers count   print out all markers available with the requested generators
                              (up to -www for the most detailed output, or -wwww for json output)

Options

generators

+webhook                                                                                                           package  generates (partial) {Mutating,Validating}WebhookConfiguration objects.                        
+schemapatch[:generateEmbeddedObjectMeta=<bool>],manifests=<string>[,maxDescLen=<int>]                             package  patches existing CRDs with new schemata.                                                      
+rbac:roleName=<string>                                                                                            package  generates ClusterRole objects.                                                                
+object[:headerFile=<string>][,year=<string>]                                                                      package  generates code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.  
+crd[:allowDangerousTypes=<bool>][,crdVersions=<[]string>][,generateEmbeddedObjectMeta=<bool>][,maxDescLen=<int>]  package  generates CustomResourceDefinition objects.                                                   

generic

+paths=<[]string>  package  represents paths and go-style path patterns to use as package roots.  

output rules (optionally as output:<generator>:...)

+output:artifacts[:code=<string>],config=<string>  package  outputs artifacts to different locations, depending on whether they're package-associated or not.   
+output:dir=<string>                               package  outputs each artifact to the given directory, regardless of if it's package-associated or not.      
+output:none                                       package  skips outputting anything.                                                                          
+output:stdout                                     package  outputs everything to standard-out, with no separation.                                             

run `controller-gen rbac:roleName=multicluster-global-hub-operator-role crd webhook paths=./... output:crd:artifacts:config=config/crd/bases -w` to see all available markers, or `controller-gen rbac:roleName=multicluster-global-hub-operator-role crd webhook paths=./... output:crd:artifacts:config=config/crd/bases -h` for usage
make: *** [Makefile:93: manifests] Error 1
[root@api.acm27test.cp.fyre.ibm.com operator]# 
morvencao commented 1 year ago

@irshadstars According to the error message, you don't have gcc, please install gcc, if you 're using ubuntu, you can do

sudo apt-get install build-essential

After that, name sure your golang is working

go version
irshadstars commented 1 year ago

@morvencao i am using redhat.

[root@api.acm27test.cp.fyre.ibm.com operator]# cat /etc/redhat-release 
Red Hat Enterprise Linux release 8.6 (Ootpa)
[root@api.acm27test.cp.fyre.ibm.com operator]# go version
warning: GOPATH set to GOROOT (/root/go) has no effect
go version go1.18.7 linux/s390x
[root@api.acm27test.cp.fyre.ibm.com operator]#
irshadstars commented 1 year ago
[root@api.acm27test.cp.fyre.ibm.com operator]# make docker-build docker-push
warning: GOPATH set to GOROOT (/root/go) has no effect
mkdir -p /root/multicluster-global-hub/operator/bin
GOBIN=/root/multicluster-global-hub/operator/bin go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.8.0
warning: GOPATH set to GOROOT (/root/go) has no effect
/root/multicluster-global-hub/operator/bin/controller-gen rbac:roleName=multicluster-global-hub-operator-role crd webhook paths="./..." output:crd:artifacts:config=config/crd/bases
/root/multicluster-global-hub/operator/bin/controller-gen object:headerFile="hack/boilerplate.go.txt" paths="./..."
warning: GOPATH set to GOROOT (/root/go) has no effect
GOFUMPT_SPLIT_LONG_LINES=on gofumpt -w ./main.go ./apis/ ./pkg/
go vet ./...
warning: GOPATH set to GOROOT (/root/go) has no effect
go: downloading github.com/kylelemons/godebug v1.1.0
go: downloading github.com/onsi/ginkgo/v2 v2.1.4
go: downloading github.com/gonvenience/ytbx v1.4.4
go: downloading github.com/homeport/dyff v1.5.5
go: downloading github.com/gonvenience/bunt v1.3.4
go: downloading github.com/gonvenience/text v1.0.7
go: downloading github.com/gonvenience/wrap v1.1.2
go: downloading github.com/virtuald/go-ordered-json v0.0.0-20170621173500-b18e6e673d74
go: downloading github.com/gonvenience/term v1.0.2
go: downloading github.com/lucasb-eyer/go-colorful v1.2.0
go: downloading github.com/mattn/go-ciede2000 v0.0.0-20170301095244-782e8c62fec3
go: downloading github.com/gonvenience/neat v1.3.11
go: downloading github.com/mitchellh/hashstructure v1.1.0
go: downloading github.com/sergi/go-diff v1.2.0
go: downloading github.com/texttheater/golang-levenshtein v1.0.1
go: downloading golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f
go: downloading github.com/mattn/go-isatty v0.0.14
go: downloading github.com/mitchellh/go-ps v1.0.0
GOBIN=/root/multicluster-global-hub/operator/bin go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest
warning: GOPATH set to GOROOT (/root/go) has no effect
go: downloading sigs.k8s.io/controller-runtime v0.13.0
go: downloading sigs.k8s.io/controller-runtime/tools/setup-envtest v0.0.0-20221007015352-8ad090e0663e
go: downloading github.com/go-logr/zapr v1.2.0
go: downloading github.com/spf13/afero v1.6.0
go: downloading go.uber.org/zap v1.19.1
unable to find a version that was supported for platform linux/s390x
KUBEBUILDER_ASSETS="" go test -v ./... -coverprofile cover.out
warning: GOPATH set to GOROOT (/root/go) has no effect
?       github.com/stolostron/multicluster-global-hub/operator  [no test files]
?       github.com/stolostron/multicluster-global-hub/operator/apis/v1alpha2    [no test files]
?       github.com/stolostron/multicluster-global-hub/operator/pkg/condition    [no test files]
=== RUN   TestSetImageOverrides
=== RUN   TestSetImageOverrides/no_any_override
=== RUN   TestSetImageOverrides/override_image_repo
=== RUN   TestSetImageOverrides/override_image_from_configmap
=== RUN   TestSetImageOverrides/override_image_repo_image_manifests_from_configmap
--- PASS: TestSetImageOverrides (0.00s)
    --- PASS: TestSetImageOverrides/no_any_override (0.00s)
    --- PASS: TestSetImageOverrides/override_image_repo (0.00s)
    --- PASS: TestSetImageOverrides/override_image_from_configmap (0.00s)
    --- PASS: TestSetImageOverrides/override_image_repo_image_manifests_from_configmap (0.00s)
PASS
coverage: 59.1% of statements
ok      github.com/stolostron/multicluster-global-hub/operator/pkg/config       0.026s  coverage: 59.1% of statements
?       github.com/stolostron/multicluster-global-hub/operator/pkg/constants    [no test files]
=== RUN   TestControllers
Running Suite: Controller Integration Suite - /root/multicluster-global-hub/operator/pkg/controllers/hubofhubs
==============================================================================================================
Random Seed: 1666091784

Will run 6 of 6 specs
------------------------------
[BeforeSuite] [FAILED] [0.003 seconds]
[BeforeSuite] 
/root/multicluster-global-hub/operator/pkg/controllers/hubofhubs/controllers_suite_test.go:69

  Begin Captured GinkgoWriter Output >>
    STEP: bootstrapping test environment 10/18/22 04:16:24.839
    1.6660917848394907e+09      DEBUG   controller-runtime.test-env     starting control plane
    1.6660917848409982e+09      ERROR   controller-runtime.test-env     unable to start the controlplane        {"tries": 0, "error": "exec: \"etcd\": executable file not found in $PATH"}
    sigs.k8s.io/controller-runtime/pkg/envtest.(*Environment).startControlPlane
        /root/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.12.3/pkg/envtest/server.go:330
    sigs.k8s.io/controller-runtime/pkg/envtest.(*Environment).Start
        /root/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.12.3/pkg/envtest/server.go:260
    github.com/stolostron/multicluster-global-hub/operator/pkg/controllers/hubofhubs_test.glob..func1
        /root/multicluster-global-hub/operator/pkg/controllers/hubofhubs/controllers_suite_test.go:89
    github.com/onsi/ginkgo/v2/internal.(*Suite).runNode.func2
        /root/go/pkg/mod/github.com/onsi/ginkgo/v2@v2.1.4/internal/suite.go:596
    1.6660917848412418e+09      ERROR   controller-runtime.test-env     unable to start the controlplane        {"tries": 1, "error": "exec: \"etcd\": executable file not found in $PATH"}
    sigs.k8s.io/controller-runtime/pkg/envtest.(*Environment).startControlPlane
        /root/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.12.3/pkg/envtest/server.go:330
    sigs.k8s.io/controller-runtime/pkg/envtest.(*Environment).Start
        /root/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.12.3/pkg/envtest/server.go:260
    github.com/stolostron/multicluster-global-hub/operator/pkg/controllers/hubofhubs_test.glob..func1
        /root/multicluster-global-hub/operator/pkg/controllers/hubofhubs/controllers_suite_test.go:89
    github.com/onsi/ginkgo/v2/internal.(*Suite).runNode.func2
        /root/go/pkg/mod/github.com/onsi/ginkgo/v2@v2.1.4/internal/suite.go:596
    1.6660917848414052e+09      ERROR   controller-runtime.test-env     unable to start the controlplane        {"tries": 2, "error": "exec: \"etcd\": executable file not found in $PATH"}
    sigs.k8s.io/controller-runtime/pkg/envtest.(*Environment).startControlPlane
        /root/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.12.3/pkg/envtest/server.go:330
    sigs.k8s.io/controller-runtime/pkg/envtest.(*Environment).Start
        /root/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.12.3/pkg/envtest/server.go:260
    github.com/stolostron/multicluster-global-hub/operator/pkg/controllers/hubofhubs_test.glob..func1
        /root/multicluster-global-hub/operator/pkg/controllers/hubofhubs/controllers_suite_test.go:89
    github.com/onsi/ginkgo/v2/internal.(*Suite).runNode.func2
        /root/go/pkg/mod/github.com/onsi/ginkgo/v2@v2.1.4/internal/suite.go:596
    1.6660917848415692e+09      ERROR   controller-runtime.test-env     unable to start the controlplane        {"tries": 3, "error": "exec: \"etcd\": executable file not found in $PATH"}
    sigs.k8s.io/controller-runtime/pkg/envtest.(*Environment).startControlPlane
        /root/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.12.3/pkg/envtest/server.go:330
    sigs.k8s.io/controller-runtime/pkg/envtest.(*Environment).Start
        /root/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.12.3/pkg/envtest/server.go:260
    github.com/stolostron/multicluster-global-hub/operator/pkg/controllers/hubofhubs_test.glob..func1
        /root/multicluster-global-hub/operator/pkg/controllers/hubofhubs/controllers_suite_test.go:89
    github.com/onsi/ginkgo/v2/internal.(*Suite).runNode.func2
        /root/go/pkg/mod/github.com/onsi/ginkgo/v2@v2.1.4/internal/suite.go:596
    1.666091784841794e+09       ERROR   controller-runtime.test-env     unable to start the controlplane        {"tries": 4, "error": "exec: \"etcd\": executable file not found in $PATH"}
    sigs.k8s.io/controller-runtime/pkg/envtest.(*Environment).startControlPlane
        /root/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.12.3/pkg/envtest/server.go:330
    sigs.k8s.io/controller-runtime/pkg/envtest.(*Environment).Start
        /root/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.12.3/pkg/envtest/server.go:260
    github.com/stolostron/multicluster-global-hub/operator/pkg/controllers/hubofhubs_test.glob..func1
        /root/multicluster-global-hub/operator/pkg/controllers/hubofhubs/controllers_suite_test.go:89
    github.com/onsi/ginkgo/v2/internal.(*Suite).runNode.func2
        /root/go/pkg/mod/github.com/onsi/ginkgo/v2@v2.1.4/internal/suite.go:596
  << End Captured GinkgoWriter Output

  Unexpected error:
      <*fmt.wrapError | 0xc000066aa0>: {
          msg: "unable to start control plane itself: failed to start the controlplane. retried 5 times: exec: \"etcd\": executable file not found in $PATH",
          err: <*fmt.wrapError | 0xc000066a80>{
              msg: "failed to start the controlplane. retried 5 times: exec: \"etcd\": executable file not found in $PATH",
              err: <*exec.Error | 0xc000066a40>{
                  Name: "etcd",
                  Err: <*errors.errorString | 0xc000192380>{
                      s: "executable file not found in $PATH",
                  },
              },
          },
      }
      unable to start control plane itself: failed to start the controlplane. retried 5 times: exec: "etcd": executable file not found in $PATH
  occurred
  In [BeforeSuite] at: /root/multicluster-global-hub/operator/pkg/controllers/hubofhubs/controllers_suite_test.go:90
------------------------------
[AfterSuite]! [PANICKED] [0.000 seconds]
[AfterSuite] 
/root/multicluster-global-hub/operator/pkg/controllers/hubofhubs/controllers_suite_test.go:152

  Begin Captured GinkgoWriter Output >>
    STEP: tearing down the test environment 10/18/22 04:16:24.842
  << End Captured GinkgoWriter Output

  Test Panicked
  In [AfterSuite] at: /root/go/src/runtime/panic.go:220

  runtime error: invalid memory address or nil pointer dereference

  Full Stack Trace
    sigs.k8s.io/controller-runtime/pkg/internal/testing/controlplane.(*APIServer).Stop(0xc00035a000)
        /root/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.12.3/pkg/internal/testing/controlplane/apiserver.go:424 +0xc2
    sigs.k8s.io/controller-runtime/pkg/internal/testing/controlplane.(*ControlPlane).Stop(0xc000237400)
        /root/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.12.3/pkg/internal/testing/controlplane/plane.go:97 +0x4c
    sigs.k8s.io/controller-runtime/pkg/envtest.(*Environment).Stop(0xc000237400)
        /root/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.12.3/pkg/envtest/server.go:194 +0x110
    github.com/stolostron/multicluster-global-hub/operator/pkg/controllers/hubofhubs_test.glob..func2()
        /root/multicluster-global-hub/operator/pkg/controllers/hubofhubs/controllers_suite_test.go:155 +0x66
------------------------------

Summarizing 2 Failures:
  [FAIL] [BeforeSuite] 
  /root/multicluster-global-hub/operator/pkg/controllers/hubofhubs/controllers_suite_test.go:90
  [PANICKED!] [AfterSuite] 
  /root/go/src/runtime/panic.go:220

Ran 0 of 6 Specs in 0.004 seconds
FAIL! -- A BeforeSuite node failed so all tests were skipped.
--- FAIL: TestControllers (0.00s)
FAIL
coverage: 0.0% of statements
FAIL    github.com/stolostron/multicluster-global-hub/operator/pkg/controllers/hubofhubs        0.257s
=== RUN   TestControllers
Running Suite: Controller Integration Suite - /root/multicluster-global-hub/operator/pkg/controllers/leafhub
============================================================================================================
Random Seed: 1666091788

Will run 2 of 2 specs
------------------------------
[BeforeSuite] [FAILED] [0.003 seconds]
[BeforeSuite] 
/root/multicluster-global-hub/operator/pkg/controllers/leafhub/controllers_suite_test.go:66

  Begin Captured GinkgoWriter Output >>
    STEP: bootstrapping test environment 10/18/22 04:16:28.076
    1.666091788076565e+09       DEBUG   controller-runtime.test-env     starting control plane
    1.6660917880780792e+09      ERROR   controller-runtime.test-env     unable to start the controlplane        {"tries": 0, "error": "exec: \"etcd\": executable file not found in $PATH"}
    sigs.k8s.io/controller-runtime/pkg/envtest.(*Environment).startControlPlane
        /root/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.12.3/pkg/envtest/server.go:330
    sigs.k8s.io/controller-runtime/pkg/envtest.(*Environment).Start
        /root/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.12.3/pkg/envtest/server.go:260
    github.com/stolostron/multicluster-global-hub/operator/pkg/controllers/leafhub_test.glob..func1
        /root/multicluster-global-hub/operator/pkg/controllers/leafhub/controllers_suite_test.go:83
    github.com/onsi/ginkgo/v2/internal.(*Suite).runNode.func2
        /root/go/pkg/mod/github.com/onsi/ginkgo/v2@v2.1.4/internal/suite.go:596
    1.6660917880783489e+09      ERROR   controller-runtime.test-env     unable to start the controlplane        {"tries": 1, "error": "exec: \"etcd\": executable file not found in $PATH"}
    sigs.k8s.io/controller-runtime/pkg/envtest.(*Environment).startControlPlane
        /root/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.12.3/pkg/envtest/server.go:330
    sigs.k8s.io/controller-runtime/pkg/envtest.(*Environment).Start
        /root/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.12.3/pkg/envtest/server.go:260
    github.com/stolostron/multicluster-global-hub/operator/pkg/controllers/leafhub_test.glob..func1
        /root/multicluster-global-hub/operator/pkg/controllers/leafhub/controllers_suite_test.go:83
    github.com/onsi/ginkgo/v2/internal.(*Suite).runNode.func2
        /root/go/pkg/mod/github.com/onsi/ginkgo/v2@v2.1.4/internal/suite.go:596
    1.6660917880785234e+09      ERROR   controller-runtime.test-env     unable to start the controlplane        {"tries": 2, "error": "exec: \"etcd\": executable file not found in $PATH"}
    sigs.k8s.io/controller-runtime/pkg/envtest.(*Environment).startControlPlane
        /root/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.12.3/pkg/envtest/server.go:330
    sigs.k8s.io/controller-runtime/pkg/envtest.(*Environment).Start
        /root/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.12.3/pkg/envtest/server.go:260
    github.com/stolostron/multicluster-global-hub/operator/pkg/controllers/leafhub_test.glob..func1
        /root/multicluster-global-hub/operator/pkg/controllers/leafhub/controllers_suite_test.go:83
    github.com/onsi/ginkgo/v2/internal.(*Suite).runNode.func2
        /root/go/pkg/mod/github.com/onsi/ginkgo/v2@v2.1.4/internal/suite.go:596
    1.6660917880787044e+09      ERROR   controller-runtime.test-env     unable to start the controlplane        {"tries": 3, "error": "exec: \"etcd\": executable file not found in $PATH"}
    sigs.k8s.io/controller-runtime/pkg/envtest.(*Environment).startControlPlane
        /root/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.12.3/pkg/envtest/server.go:330
    sigs.k8s.io/controller-runtime/pkg/envtest.(*Environment).Start
        /root/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.12.3/pkg/envtest/server.go:260
    github.com/stolostron/multicluster-global-hub/operator/pkg/controllers/leafhub_test.glob..func1
        /root/multicluster-global-hub/operator/pkg/controllers/leafhub/controllers_suite_test.go:83
    github.com/onsi/ginkgo/v2/internal.(*Suite).runNode.func2
        /root/go/pkg/mod/github.com/onsi/ginkgo/v2@v2.1.4/internal/suite.go:596
    1.6660917880788882e+09      ERROR   controller-runtime.test-env     unable to start the controlplane        {"tries": 4, "error": "exec: \"etcd\": executable file not found in $PATH"}
    sigs.k8s.io/controller-runtime/pkg/envtest.(*Environment).startControlPlane
        /root/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.12.3/pkg/envtest/server.go:330
    sigs.k8s.io/controller-runtime/pkg/envtest.(*Environment).Start
        /root/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.12.3/pkg/envtest/server.go:260
    github.com/stolostron/multicluster-global-hub/operator/pkg/controllers/leafhub_test.glob..func1
        /root/multicluster-global-hub/operator/pkg/controllers/leafhub/controllers_suite_test.go:83
    github.com/onsi/ginkgo/v2/internal.(*Suite).runNode.func2
        /root/go/pkg/mod/github.com/onsi/ginkgo/v2@v2.1.4/internal/suite.go:596
  << End Captured GinkgoWriter Output

  Unexpected error:
      <*fmt.wrapError | 0xc0005065c0>: {
          msg: "unable to start control plane itself: failed to start the controlplane. retried 5 times: exec: \"etcd\": executable file not found in $PATH",
          err: <*fmt.wrapError | 0xc0005065a0>{
              msg: "failed to start the controlplane. retried 5 times: exec: \"etcd\": executable file not found in $PATH",
              err: <*exec.Error | 0xc000506560>{
                  Name: "etcd",
                  Err: <*errors.errorString | 0xc0000903b0>{
                      s: "executable file not found in $PATH",
                  },
              },
          },
      }
      unable to start control plane itself: failed to start the controlplane. retried 5 times: exec: "etcd": executable file not found in $PATH
  occurred
  In [BeforeSuite] at: /root/multicluster-global-hub/operator/pkg/controllers/leafhub/controllers_suite_test.go:84
------------------------------
[AfterSuite]! [PANICKED] [0.000 seconds]
[AfterSuite] 
/root/multicluster-global-hub/operator/pkg/controllers/leafhub/controllers_suite_test.go:143

  Begin Captured GinkgoWriter Output >>
    STEP: tearing down the test environment 10/18/22 04:16:28.079
  << End Captured GinkgoWriter Output

  Test Panicked
  In [AfterSuite] at: /root/go/src/runtime/panic.go:220

  runtime error: invalid memory address or nil pointer dereference

  Full Stack Trace
    sigs.k8s.io/controller-runtime/pkg/internal/testing/controlplane.(*APIServer).Stop(0xc00010c2a0)
        /root/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.12.3/pkg/internal/testing/controlplane/apiserver.go:424 +0xc2
    sigs.k8s.io/controller-runtime/pkg/internal/testing/controlplane.(*ControlPlane).Stop(0xc000136000)
        /root/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.12.3/pkg/internal/testing/controlplane/plane.go:97 +0x4c
    sigs.k8s.io/controller-runtime/pkg/envtest.(*Environment).Stop(0xc000136000)
        /root/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.12.3/pkg/envtest/server.go:194 +0x110
    github.com/stolostron/multicluster-global-hub/operator/pkg/controllers/leafhub_test.glob..func2()
        /root/multicluster-global-hub/operator/pkg/controllers/leafhub/controllers_suite_test.go:146 +0x66
------------------------------

Summarizing 2 Failures:
  [FAIL] [BeforeSuite] 
  /root/multicluster-global-hub/operator/pkg/controllers/leafhub/controllers_suite_test.go:84
  [PANICKED!] [AfterSuite] 
  /root/go/src/runtime/panic.go:220

Ran 0 of 2 Specs in 0.003 seconds
FAIL! -- A BeforeSuite node failed so all tests were skipped.
--- FAIL: TestControllers (0.00s)
FAIL
coverage: 0.0% of statements
FAIL    github.com/stolostron/multicluster-global-hub/operator/pkg/controllers/leafhub  0.073s
?       github.com/stolostron/multicluster-global-hub/operator/pkg/controllers/packagemanifest  [no test files]
=== RUN   TestSource
Running Suite: Deployer Integration Suite - /root/multicluster-global-hub/operator/pkg/deployer
===============================================================================================
Random Seed: 1666091785

Will run 6 of 6 specs
------------------------------
[BeforeSuite] [FAILED] [0.005 seconds]
[BeforeSuite] 
/root/multicluster-global-hub/operator/pkg/deployer/hoh_deployer_suite_test.go:30

  Begin Captured GinkgoWriter Output >>
    STEP: bootstrapping test environment 10/18/22 04:16:25.889
    1.6660917858892174e+09      DEBUG   controller-runtime.test-env     starting control plane
    1.666091785890263e+09       ERROR   controller-runtime.test-env     unable to start the controlplane        {"tries": 0, "error": "exec: \"etcd\": executable file not found in $PATH"}
    sigs.k8s.io/controller-runtime/pkg/envtest.(*Environment).startControlPlane
        /root/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.12.3/pkg/envtest/server.go:330
    sigs.k8s.io/controller-runtime/pkg/envtest.(*Environment).Start
        /root/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.12.3/pkg/envtest/server.go:260
    github.com/stolostron/multicluster-global-hub/operator/pkg/deployer_test.glob..func1
        /root/multicluster-global-hub/operator/pkg/deployer/hoh_deployer_suite_test.go:42
    github.com/onsi/ginkgo/v2/internal.(*Suite).runNode.func2
        /root/go/pkg/mod/github.com/onsi/ginkgo/v2@v2.1.4/internal/suite.go:596
    1.6660917858905156e+09      ERROR   controller-runtime.test-env     unable to start the controlplane        {"tries": 1, "error": "exec: \"etcd\": executable file not found in $PATH"}
    sigs.k8s.io/controller-runtime/pkg/envtest.(*Environment).startControlPlane
        /root/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.12.3/pkg/envtest/server.go:330
    sigs.k8s.io/controller-runtime/pkg/envtest.(*Environment).Start
        /root/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.12.3/pkg/envtest/server.go:260
    github.com/stolostron/multicluster-global-hub/operator/pkg/deployer_test.glob..func1
        /root/multicluster-global-hub/operator/pkg/deployer/hoh_deployer_suite_test.go:42
    github.com/onsi/ginkgo/v2/internal.(*Suite).runNode.func2
        /root/go/pkg/mod/github.com/onsi/ginkgo/v2@v2.1.4/internal/suite.go:596
    1.666091785890724e+09       ERROR   controller-runtime.test-env     unable to start the controlplane        {"tries": 2, "error": "exec: \"etcd\": executable file not found in $PATH"}
    sigs.k8s.io/controller-runtime/pkg/envtest.(*Environment).startControlPlane
        /root/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.12.3/pkg/envtest/server.go:330
    sigs.k8s.io/controller-runtime/pkg/envtest.(*Environment).Start
        /root/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.12.3/pkg/envtest/server.go:260
    github.com/stolostron/multicluster-global-hub/operator/pkg/deployer_test.glob..func1
        /root/multicluster-global-hub/operator/pkg/deployer/hoh_deployer_suite_test.go:42
    github.com/onsi/ginkgo/v2/internal.(*Suite).runNode.func2
        /root/go/pkg/mod/github.com/onsi/ginkgo/v2@v2.1.4/internal/suite.go:596
    1.6660917858909233e+09      ERROR   controller-runtime.test-env     unable to start the controlplane        {"tries": 3, "error": "exec: \"etcd\": executable file not found in $PATH"}
    sigs.k8s.io/controller-runtime/pkg/envtest.(*Environment).startControlPlane
        /root/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.12.3/pkg/envtest/server.go:330
    sigs.k8s.io/controller-runtime/pkg/envtest.(*Environment).Start
        /root/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.12.3/pkg/envtest/server.go:260
    github.com/stolostron/multicluster-global-hub/operator/pkg/deployer_test.glob..func1
        /root/multicluster-global-hub/operator/pkg/deployer/hoh_deployer_suite_test.go:42
    github.com/onsi/ginkgo/v2/internal.(*Suite).runNode.func2
        /root/go/pkg/mod/github.com/onsi/ginkgo/v2@v2.1.4/internal/suite.go:596
    1.666091785891124e+09       ERROR   controller-runtime.test-env     unable to start the controlplane        {"tries": 4, "error": "exec: \"etcd\": executable file not found in $PATH"}
    sigs.k8s.io/controller-runtime/pkg/envtest.(*Environment).startControlPlane
        /root/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.12.3/pkg/envtest/server.go:330
    sigs.k8s.io/controller-runtime/pkg/envtest.(*Environment).Start
        /root/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.12.3/pkg/envtest/server.go:260
    github.com/stolostron/multicluster-global-hub/operator/pkg/deployer_test.glob..func1
        /root/multicluster-global-hub/operator/pkg/deployer/hoh_deployer_suite_test.go:42
    github.com/onsi/ginkgo/v2/internal.(*Suite).runNode.func2
        /root/go/pkg/mod/github.com/onsi/ginkgo/v2@v2.1.4/internal/suite.go:596
  << End Captured GinkgoWriter Output

  Unexpected error:
      <*fmt.wrapError | 0xc00038f1e0>: {
          msg: "unable to start control plane itself: failed to start the controlplane. retried 5 times: exec: \"etcd\": executable file not found in $PATH",
          err: <*fmt.wrapError | 0xc00038f1c0>{
              msg: "failed to start the controlplane. retried 5 times: exec: \"etcd\": executable file not found in $PATH",
              err: <*exec.Error | 0xc00038f180>{
                  Name: "etcd",
                  Err: <*errors.errorString | 0xc00007c3b0>{
                      s: "executable file not found in $PATH",
                  },
              },
          },
      }
      unable to start control plane itself: failed to start the controlplane. retried 5 times: exec: "etcd": executable file not found in $PATH
  occurred
  In [BeforeSuite] at: /root/multicluster-global-hub/operator/pkg/deployer/hoh_deployer_suite_test.go:43
------------------------------
[AfterSuite]! [PANICKED] [0.000 seconds]
[AfterSuite] 
/root/multicluster-global-hub/operator/pkg/deployer/hoh_deployer_suite_test.go:56

  Begin Captured GinkgoWriter Output >>
    STEP: tearing down the test environment 10/18/22 04:16:25.894
  << End Captured GinkgoWriter Output

  Test Panicked
  In [AfterSuite] at: /root/go/src/runtime/panic.go:220

  runtime error: invalid memory address or nil pointer dereference

  Full Stack Trace
    sigs.k8s.io/controller-runtime/pkg/internal/testing/controlplane.(*APIServer).Stop(0xc0003c6000)
        /root/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.12.3/pkg/internal/testing/controlplane/apiserver.go:424 +0xc2
    sigs.k8s.io/controller-runtime/pkg/internal/testing/controlplane.(*ControlPlane).Stop(0xc00024c280)
        /root/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.12.3/pkg/internal/testing/controlplane/plane.go:97 +0x4c
    sigs.k8s.io/controller-runtime/pkg/envtest.(*Environment).Stop(0xc00024c280)
        /root/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.12.3/pkg/envtest/server.go:194 +0x110
    github.com/stolostron/multicluster-global-hub/operator/pkg/deployer_test.glob..func2()
        /root/multicluster-global-hub/operator/pkg/deployer/hoh_deployer_suite_test.go:58 +0x54
------------------------------

Summarizing 2 Failures:
  [FAIL] [BeforeSuite] 
  /root/multicluster-global-hub/operator/pkg/deployer/hoh_deployer_suite_test.go:43
  [PANICKED!] [AfterSuite] 
  /root/go/src/runtime/panic.go:220

Ran 0 of 6 Specs in 0.005 seconds
FAIL! -- A BeforeSuite node failed so all tests were skipped.
--- FAIL: TestSource (0.01s)
FAIL
coverage: 0.0% of statements
FAIL    github.com/stolostron/multicluster-global-hub/operator/pkg/deployer     0.072s
=== RUN   TestSource
Running Suite: Render Suite - /root/multicluster-global-hub/operator/pkg/renderer
=================================================================================
Random Seed: 1666091786

Will run 5 of 5 specs
•••••

Ran 5 of 5 Specs in 0.020 seconds
SUCCESS! -- 5 Passed | 0 Failed | 0 Pending | 0 Skipped
--- PASS: TestSource (0.02s)
PASS
coverage: 80.0% of statements
ok      github.com/stolostron/multicluster-global-hub/operator/pkg/renderer     0.030s  coverage: 80.0% of statements
?       github.com/stolostron/multicluster-global-hub/operator/pkg/utils        [no test files]
FAIL
make: *** [Makefile:111: test] Error 1
[root@api.acm27test.cp.fyre.ibm.com operator]# 
morvencao commented 1 year ago

@irshadstars We have special settings about unit tests, you can skip unit tests and build the docker image directly by running:

docker build -t  quay.io/stolostron/multicluster-global-hub-operator:latest .. -f Dockerfile

Make sure you have docker installed in your machine before executing the above command.

irshadstars commented 1 year ago

i tried using above command even throwing error .

[root@api.acm27test.cp.fyre.ibm.com operator]# docker build -t  quay.io/stolostron/multicluster-global-hub-operator:latest .. -f Dockerfile
Emulate Docker CLI using podman. Create /etc/containers/nodocker to quiet msg.
[1/2] STEP 1/6: FROM registry.ci.openshift.org/stolostron/builder:go1.18-linux AS builder
Trying to pull registry.ci.openshift.org/stolostron/builder:go1.18-linux...
Getting image source signatures
Copying blob 6f5eb4931535 done  
Copying blob 0689084f485b done  
Copying blob 7985264c26f7 done  
Copying config 2f4d5a96af done  
Writing manifest to image destination
Storing signatures
[1/2] STEP 2/6: WORKDIR /workspace
--> ba19aab59c4
[1/2] STEP 3/6: COPY go.sum go.mod ./
--> 85d8badb617
[1/2] STEP 4/6: COPY ./operator ./operator
--> e1b6e01513a
[1/2] STEP 5/6: COPY ./pkg ./pkg
--> 4e7dd2df7b2
[1/2] STEP 6/6: RUN CGO_ENABLED=0 go build -a -installsuffix cgo -o bin/multicluster-global-hub-operator operator/main.go
exec /bin/sh: exec format error
Error: error building at STEP "RUN CGO_ENABLED=0 go build -a -installsuffix cgo -o bin/multicluster-global-hub-operator operator/main.go": error while running runtime: exit status 1
[root@api.acm27test.cp.fyre.ibm.com operator]# 
morvencao commented 1 year ago

@irshadstars What's ARCH of your machine? is it amd64 or x86? Please run

uname -a

The problem may be that you built this image for amd64/x86 -- but your runner is using a different architecture.

irshadstars commented 1 year ago

This is s390x arch [root@api.acm27test.cp.fyre.ibm.com ~]# uname -a Linux api.acm27test.cp.fyre.ibm.com 4.18.0-372.26.1.el8_6.s390x #1 SMP Sat Aug 27 02:37:44 EDT 2022 s390x s390x s390x GNU/Linux [root@api.acm27test.cp.fyre.ibm.com ~]#

morvencao commented 1 year ago

@irshadstars we currently don't not support multi-arch build, can you find a amd64/x86 machine?

ldpliu commented 3 months ago

no response, close it. If still has the same error, please reopen it.