Closed vikasmulaje closed 2 years ago
That file will only be present if operator-sdk actually ran. Judging by the output on stdout, it does not look like it executed far enough to write that file.
Can you manually try to run the operator-sdk scorecard to see what happens? Do you have a working cluster? Is your KUBECONFIG pointed to a valid kubeconfig?
As per discussion with @bcrochet this needs a fix for help message when operator-sdk scorecard fails without generating any logs
/assign rocrisp
@rocrisp: GitHub didn't allow me to assign the following users: sfcrisp.
Note that only redhat-openshift-ecosystem members, repo collaborators and people who have commented on this issue/PR can be assigned. Additionally, issues/PRs can only have 10 assignees at the same time. For more information please see the contributor guide
/assign rocrisp
Hi Vikas, The newest code utilize the crane engine. It requires a KUBECONFIG env to run operator-sdk scorecard. I tested it with an invalid kubeconfig env, and the preflight did not run operator-sdk scorecard.
$export KUBECONFIG=/home/vagrant/preflight/kubeconfigcccc
./preflight check operator
Hi @rocrisp In my scenario where I provide correct kubeconfig and scorecard test fails with msg=\"error running tests context deadline exceeded\"\n dont generate any logs
[vagrant@fedora34 openshift-preflight]$ ./preflight check operator quay.io/opdev/simple-demo-operator-bundle:v0.0.2 time="2021-10-26T08:21:23Z" level=info msg="config file not found, proceeding without it" time="2021-10-26T08:21:23Z" level=info msg="certification library version 0.0.0 <commit: 1d9b2cd7705072685c9faa482491608d98e01465>" time="2021-10-26T08:21:23Z" level=info msg="target image: quay.io/opdev/simple-demo-operator-bundle:v0.0.2" time="2021-10-26T08:21:23Z" level=info msg="pulling image from target registry" time="2021-10-26T08:21:25Z" level=debug msg="temporary directory is /tmp/preflight-2370678981" time="2021-10-26T08:21:25Z" level=debug msg="exporting and flattening image" time="2021-10-26T08:21:25Z" level=debug msg="extracting container filesystem to /tmp/preflight-2370678981/fs" time="2021-10-26T08:21:25Z" level=debug msg="writing container filesystem to output dir/tmp/preflight-2370678981/fs" time="2021-10-26T08:21:27Z" level=info msg="executing checks" time="2021-10-26T08:21:27Z" level=info msg="running check: OperatorPackageNameIsUnique" time="2021-10-26T08:21:27Z" level=trace msg="reading annotations file from the bundle" time="2021-10-26T08:21:27Z" level=debug msg="mounted directory is /tmp/preflight-2370678981/fs" time="2021-10-26T08:21:27Z" level=trace msg="searching for package key (operators.operatorframework.io.bundle.package.v1) in bundle" time="2021-10-26T08:21:27Z" level=trace msg="bundle data: map[operators.operatorframework.io.bundle.channel.default.v1:stable operators.operatorframework.io.bundle.channels.v1:stable operators.operatorframework.io.bundle.manifests.v1:manifests/ operators.operatorframework.io.bundle.mediatype.v1:registry+v1 operators.operatorframework.io.bundle.metadata.v1:metadata/ operators.operatorframework.io.bundle.package.v1:simple-demo-operator operators.operatorframework.io.metrics.builder:operator-sdk-v1.11.0+git operators.operatorframework.io.metrics.mediatype.v1:metrics+v1 operators.operatorframework.io.metrics.project_layout:go.kubebuilder.io/v3 operators.operatorframework.io.test.config.v1:tests/scorecard/ operators.operatorframework.io.test.mediatype.v1:scorecard+v1]" time="2021-10-26T08:21:27Z" level=debug msg="operator package name is simple-demo-operator" time="2021-10-26T08:21:27Z" level=trace msg="making API request to https://catalog.redhat.com/api/containers/v1/operators/packages?filter=package_name%3D%3Dsimple-demo-operator" time="2021-10-26T08:21:28Z" level=trace msg="response code: 200 OK" time="2021-10-26T08:21:28Z" level=trace msg="response body: {\n \"data\": [],\n \"page\": 0,\n \"page_size\": 100,\n \"total\": 0\n}\n" time="2021-10-26T08:21:28Z" level=info msg="check completed: OperatorPackageNameIsUnique" result=PASSED time="2021-10-26T08:21:28Z" level=info msg="running check: ScorecardBasicSpecCheck" time="2021-10-26T08:21:28Z" level=debug msg="Running operator-sdk scorecard check for quay.io/opdev/simple-demo-operator-bundle:v0.0.2" time="2021-10-26T08:21:28Z" level=debug msg="--selector=[test=basic-check-spec-test]" time="2021-10-26T08:21:28Z" level=trace msg="running scorecard with the following invocation[operator-sdk scorecard --output json --selector=test=basic-check-spec-test --kubeconfig /home/vagrant/preflight/kubeconfig --namespace default --service-account default --config /tmp/scorecard-test-config-2435494600.yaml --verbose /tmp/preflight-2370678981/fs]" time="2021-10-26T08:21:59Z" level=error msg="stdout: " time="2021-10-26T08:21:59Z" level=error msg="stderr: time=\"2021-10-26T08:21:29Z\" level=debug msg=\"Debug logging is set\"\nError: error running tests context deadline exceeded\nUsage:\n operator-sdk scorecard [flags]\n\nFlags:\n -c, --config string path to scorecard config file\n -h, --help help for scorecard\n --kubeconfig string kubeconfig path\n -L, --list Option to enable listing which tests are run\n -n, --namespace string namespace to run the test images in\n -o, --output string Output format for results. Valid values: text, json (default \"text\")\n -l, --selector string label selector to determine which tests are run\n -s, --service-account string Service account to use for tests (default \"default\")\n -x, --skip-cleanup Disable resource cleanup after tests are run\n -w, --wait-time duration seconds to wait for tests to complete. Example: 35s (default 30s)\n\nGlobal Flags:\n --plugins strings plugin keys to be used for this subcommand execution\n --verbose Enable verbose logging\n\ntime=\"2021-10-26T08:21:59Z\" level=fatal msg=\"error running tests context deadline exceeded\"\n" time="2021-10-26T08:21:59Z" level=info msg="check completed: ScorecardBasicSpecCheck" ERROR="failed to run operator-sdk scorecard: exit status 1" result="failed to run operator-sdk scorecard: exit status 1" time="2021-10-26T08:21:59Z" level=info msg="running check: ScorecardOlmSuiteCheck" time="2021-10-26T08:21:59Z" level=debug msg="Running operator-sdk scorecard Check for quay.io/opdev/simple-demo-operator-bundle:v0.0.2" time="2021-10-26T08:21:59Z" level=debug msg="--selector=[suite=olm]" time="2021-10-26T08:21:59Z" level=trace msg="running scorecard with the following invocation[operator-sdk scorecard --output json --selector=suite=olm --kubeconfig /home/vagrant/preflight/kubeconfig --namespace default --service-account default --config /tmp/scorecard-test-config-2159993586.yaml --verbose /tmp/preflight-2370678981/fs]" time="2021-10-26T08:22:31Z" level=error msg="stdout: " time="2021-10-26T08:22:31Z" level=error msg="stderr: time=\"2021-10-26T08:22:00Z\" level=debug msg=\"Debug logging is set\"\nError: error running tests context deadline exceeded\nUsage:\n operator-sdk scorecard [flags]\n\nFlags:\n -c, --config string path to scorecard config file\n -h, --help help for scorecard\n --kubeconfig string kubeconfig path\n -L, --list Option to enable listing which tests are run\n -n, --namespace string namespace to run the test images in\n -o, --output string Output format for results. Valid values: text, json (default \"text\")\n -l, --selector string label selector to determine which tests are run\n -s, --service-account string Service account to use for tests (default \"default\")\n -x, --skip-cleanup Disable resource cleanup after tests are run\n -w, --wait-time duration seconds to wait for tests to complete. Example: 35s (default 30s)\n\nGlobal Flags:\n --plugins strings plugin keys to be used for this subcommand execution\n --verbose Enable verbose logging\n\ntime=\"2021-10-26T08:22:31Z\" level=fatal msg=\"error running tests context deadline exceeded\"\n" time="2021-10-26T08:22:31Z" level=info msg="check completed: ScorecardOlmSuiteCheck" ERROR="failed to run operator-sdk scorecard: exit status 1" result="failed to run operator-sdk scorecard: exit status 1" time="2021-10-26T08:22:31Z" level=info msg="running check: DeployableByOLM" I1026 08:22:37.152245 9655 request.go:665] Waited for 1.044711349s due to client-side throttling, not priority and fairness, request: GET:https://api.sharedocp4upi48.lab.upshift.rdu2.redhat.com:6443/apis/metal3.io/v1alpha1?timeout=32s time="2021-10-26T08:22:40Z" level=trace msg="reading annotations file from the bundle" time="2021-10-26T08:22:40Z" level=debug msg="mounted directory is /tmp/preflight-2370678981/fs" time="2021-10-26T08:22:40Z" level=trace msg="searching for key (operators.operatorframework.io.bundle.channel.default.v1) in bundle" time="2021-10-26T08:22:40Z" level=trace msg="bundle data: map[operators.operatorframework.io.bundle.channel.default.v1:stable operators.operatorframework.io.bundle.channels.v1:stable operators.operatorframework.io.bundle.manifests.v1:manifests/ operators.operatorframework.io.bundle.mediatype.v1:registry+v1 operators.operatorframework.io.bundle.metadata.v1:metadata/ operators.operatorframework.io.bundle.package.v1:simple-demo-operator operators.operatorframework.io.metrics.builder:operator-sdk-v1.11.0+git operators.operatorframework.io.metrics.mediatype.v1:metrics+v1 operators.operatorframework.io.metrics.project_layout:go.kubebuilder.io/v3 operators.operatorframework.io.test.config.v1:tests/scorecard/ operators.operatorframework.io.test.mediatype.v1:scorecard+v1]" time="2021-10-26T08:22:40Z" level=trace msg="searching for key (operators.operatorframework.io.bundle.package.v1) in bundle" time="2021-10-26T08:22:40Z" level=trace msg="bundle data: map[operators.operatorframework.io.bundle.channel.default.v1:stable operators.operatorframework.io.bundle.channels.v1:stable operators.operatorframework.io.bundle.manifests.v1:manifests/ operators.operatorframework.io.bundle.mediatype.v1:registry+v1 operators.operatorframework.io.bundle.metadata.v1:metadata/ operators.operatorframework.io.bundle.package.v1:simple-demo-operator operators.operatorframework.io.metrics.builder:operator-sdk-v1.11.0+git operators.operatorframework.io.metrics.mediatype.v1:metrics+v1 operators.operatorframework.io.metrics.project_layout:go.kubebuilder.io/v3 operators.operatorframework.io.test.config.v1:tests/scorecard/ operators.operatorframework.io.test.mediatype.v1:scorecard+v1]" time="2021-10-26T08:22:41Z" level=debug msg="Namespace created: simple-demo-operator" time="2021-10-26T08:22:41Z" level=trace msg="Received Namespace object from API server: &Namespace{ObjectMeta:{simple-demo-operator b6629712-a16a-410f-be3c-5b6f47b0715e 1984122 0 2021-10-26 08:22:40 +0000 UTC <nil> <nil> map[kubernetes.io/metadata.name:simple-demo-operator] map[] [] [] [{preflight Update v1 2021-10-26 08:22:40 +0000 UTC FieldsV1 {\"f:metadata\":{\"f:labels\":{\".\":{},\"f:kubernetes.io/metadata.name\":{}}}} }]},Spec:NamespaceSpec{Finalizers:[kubernetes],},Status:NamespaceStatus{Phase:Active,Conditions:[]NamespaceCondition{},},}" time="2021-10-26T08:22:41Z" level=debug msg="No docker config file is found to access the index image in private registries. Proceeding..." time="2021-10-26T08:22:45Z" level=debug msg="Creating CatalogSource simple-demo-operator in namespace simple-demo-operator" time="2021-10-26T08:22:46Z" level=debug msg="CatalogSource simple-demo-operator is created successfully in namespace simple-demo-operator" I1026 08:22:48.111092 9655 request.go:665] Waited for 1.049396323s due to client-side throttling, not priority and fairness, request: GET:https://api.sharedocp4upi48.lab.upshift.rdu2.redhat.com:6443/apis/user.openshift.io/v1?timeout=32s time="2021-10-26T08:22:51Z" level=debug msg="Creating OperatorGroup simple-demo-operator in namespace simple-demo-operator" time="2021-10-26T08:22:51Z" level=debug msg="OperatorGroup simple-demo-operator is created successfully in namespace simple-demo-operator" time="2021-10-26T08:22:56Z" level=debug msg="Creating Subscription simple-demo-operator in namespace simple-demo-operator" time="2021-10-26T08:22:56Z" level=debug msg="Subscription simple-demo-operator is created successfully in namespace simple-demo-operator" time="2021-10-26T08:22:56Z" level=debug msg="Waiting for Subscription.status.installedCSV to become ready..." I1026 08:22:58.500918 9655 request.go:665] Waited for 1.036735074s due to client-side throttling, not priority and fairness, request: GET:https://api.sharedocp4upi48.lab.upshift.rdu2.redhat.com:6443/apis/template.openshift.io/v1?timeout=32s time="2021-10-26T08:23:01Z" level=debug msg="fetching subscription simple-demo-operator from namespace simple-demo-operator " time="2021-10-26T08:23:01Z" level=debug msg="Subscription.status.installedCSV is not set yet, retrying..." time="2021-10-26T08:23:04Z" level=debug msg="Waiting for Subscription.status.installedCSV to become ready..." I1026 08:23:08.502462 9655 request.go:665] Waited for 3.35713935s due to client-side throttling, not priority and fairness, request: GET:https://api.sharedocp4upi48.lab.upshift.rdu2.redhat.com:6443/apis/triggers.tekton.dev/v1alpha1?timeout=32s time="2021-10-26T08:23:09Z" level=debug msg="fetching subscription simple-demo-operator from namespace simple-demo-operator " time="2021-10-26T08:23:09Z" level=debug msg="Subscription.status.installedCSV is simple-demo-operator.v0.0.2" time="2021-10-26T08:23:09Z" level=trace msg="Looking for csv simple-demo-operator.v0.0.2 in namespace simple-demo-operator" time="2021-10-26T08:23:09Z" level=debug msg="Waiting for ClusterServiceVersion to become ready..." time="2021-10-26T08:23:14Z" level=debug msg="fetching csv simple-demo-operator.v0.0.2 from namespace simple-demo-operator " time="2021-10-26T08:23:14Z" level=debug msg="CSV is not ready yet, retrying..." time="2021-10-26T08:23:16Z" level=debug msg="Waiting for ClusterServiceVersion to become ready..." I1026 08:23:19.025974 9655 request.go:665] Waited for 1.078966541s due to client-side throttling, not priority and fairness, request: GET:https://api.sharedocp4upi48.lab.upshift.rdu2.redhat.com:6443/apis/samples.operator.openshift.io/v1?timeout=32s time="2021-10-26T08:23:22Z" level=debug msg="fetching csv simple-demo-operator.v0.0.2 from namespace simple-demo-operator " time="2021-10-26T08:23:22Z" level=debug msg="CSV is created successfully: simple-demo-operator.v0.0.2" I1026 08:23:29.036010 9655 request.go:665] Waited for 3.650777442s due to client-side throttling, not priority and fairness, request: GET:https://api.sharedocp4upi48.lab.upshift.rdu2.redhat.com:6443/apis/operator.tekton.dev/v1alpha1?timeout=32s time="2021-10-26T08:23:29Z" level=warning msg="Unapproved registry found: quay.io/vmulaje/simple-demo-index:0.1.1" time="2021-10-26T08:23:29Z" level=warning msg="Unapproved registry found: gcr.io/kubebuilder/kube-rbac-proxy:v0.8.0" time="2021-10-26T08:23:29Z" level=warning msg="Unapproved registry found: quay.io/opdev/simple-demo-operator:0.0.2" time="2021-10-26T08:23:29Z" level=debug msg="Dumping data in artifacts/ directory" time="2021-10-26T08:23:34Z" level=debug msg="fetching subscription simple-demo-operator from namespace simple-demo-operator " I1026 08:23:39.065994 9655 request.go:665] Waited for 3.190724893s due to client-side throttling, not priority and fairness, request: GET:https://api.sharedocp4upi48.lab.upshift.rdu2.redhat.com:6443/apis/controlplane.operator.openshift.io/v1alpha1?timeout=32s time="2021-10-26T08:23:40Z" level=debug msg="fetching catalogsource: simple-demo-operator" time="2021-10-26T08:23:45Z" level=debug msg="fetching operatorgroup simple-demo-operator from namespace simple-demo-operator" time="2021-10-26T08:23:45Z" level=debug msg="fetching namespace: simple-demo-operator" time="2021-10-26T08:23:45Z" level=trace msg="Deleting the resources created by Check" I1026 08:23:49.080454 9655 request.go:665] Waited for 2.397202137s due to client-side throttling, not priority and fairness, request: GET:https://api.sharedocp4upi48.lab.upshift.rdu2.redhat.com:6443/apis/operators.coreos.com/v1alpha2?timeout=32s time="2021-10-26T08:23:50Z" level=debug msg="Deleting Subscription simple-demo-operator in namespace simple-demo-operator" time="2021-10-26T08:23:51Z" level=debug msg="Subscription simple-demo-operator is deleted successfully from namespace simple-demo-operator" time="2021-10-26T08:23:56Z" level=debug msg="Deleting CatalogSource simple-demo-operator in namespace simple-demo-operator" time="2021-10-26T08:23:56Z" level=debug msg="CatalogSource simple-demo-operator is deleted successfully from namespace simple-demo-operator" I1026 08:23:59.113846 9655 request.go:665] Waited for 1.951374154s due to client-side throttling, not priority and fairness, request: GET:https://api.sharedocp4upi48.lab.upshift.rdu2.redhat.com:6443/apis/security.internal.openshift.io/v1?timeout=32s time="2021-10-26T08:24:01Z" level=debug msg="Deleting OperatorGroup simple-demo-operator in namespace simple-demo-operator" time="2021-10-26T08:24:01Z" level=debug msg="OperatorGroup simple-demo-operator is deleted successfully from namespace simple-demo-operator" time="2021-10-26T08:24:01Z" level=debug msg="Deleting secret registry-auth-keys from namespace simple-demo-operator" time="2021-10-26T08:24:02Z" level=debug msg="Deleting namespace: simple-demo-operator" time="2021-10-26T08:24:02Z" level=info msg="check completed: DeployableByOLM" result=PASSED time="2021-10-26T08:24:02Z" level=info msg="running check: ValidateOperatorBundle" time="2021-10-26T08:24:02Z" level=trace msg="reading annotations file from the bundle" time="2021-10-26T08:24:02Z" level=debug msg="mounted directory is /tmp/preflight-2370678981/fs" time="2021-10-26T08:24:02Z" level=debug msg="Command being run: [operator-sdk bundle validate -b none --output json-alpha1 --select-optional name=community --select-optional name=operatorhub --verbose /tmp/preflight-2370678981/fs]" time="2021-10-26T08:24:03Z" level=warning msg="Warning: Value : (simple-demo-operator.v0.0.2) csv.Spec.minKubeVersion is not informed. It is recommended you provide this information. Otherwise, it would mean that your operator project can be distributed and installed in any cluster version available, which is not necessarily the case for all projects." time="2021-10-26T08:24:03Z" level=info msg="check completed: ValidateOperatorBundle" result=PASSED time="2021-10-26T08:24:03Z" level=debug msg="md5 sum: 1a44ac806b272418630c65cfa8ca1e94" { "image": "quay.io/opdev/simple-demo-operator-bundle:v0.0.2", "passed": false, "certification_hash": "1a44ac806b272418630c65cfa8ca1e94", "test_library": { "name": "github.com/redhat-openshift-ecosystem/openshift-preflight", "version": "0.0.0", "commit": "1d9b2cd7705072685c9faa482491608d98e01465" }, "results": { "passed": [ { "name": "OperatorPackageNameIsUnique", "elapsed_time": 1025, "description": "Validating Bundle image package name uniqueness" }, { "name": "DeployableByOLM", "elapsed_time": 90617, "description": "Checking if the operator could be deployed by OLM, and images are from approved sources" }, { "name": "ValidateOperatorBundle", "elapsed_time": 1011, "description": "Validating Bundle image that checks if it can validate the content and format of the operator bundle" } ], "failed": [], "errors": [ { "name": "ScorecardBasicSpecCheck", "elapsed_time": 31848, "description": "Check to make sure that all CRs have a spec block.", "help": "Check ScorecardBasicSpecCheck encountered an error. Please review the artifacts/operator_bundle_scorecard_BasicSpecCheck.json file for more information." }, { "name": "ScorecardOlmSuiteCheck", "elapsed_time": 31930, "description": "Operator-sdk scorecard OLM Test Suite Check", "help": "Check ScorecardOlmSuiteCheck encountered an error. Please review the artifacts/operator_bundle_scorecard_OlmSuiteCheck.json file for more information." } ] } }
ran into the same issue, the detailed logs are here: #307
Got it and thank you! So, I did go ahead and create a pull request to eliminate this problem.
Bug Description
No logs found under artifacts directory after running preflight check operator
Version and Command Invocation
preflight version 0.0.0 <commit: 3ebe6680764eb06051149c85e7a0001dc0a985b2>
Steps to Reproduce:
(How can we reproduce this?) 1) run preflight check operator 2) check artifacts directory
Expected Result
log files should be present under artificats directory
Actual Result
Additional Context
(Anything else you think might help us troubleshoot, like your platform, dependency versions, etc).