-
Notifications
You must be signed in to change notification settings - Fork 25
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
COPY command of bundle.Dockerfile is failing #85
Comments
Can we just create the directory during init? Or is this because we're not passing in a scorecard yaml to |
Looks like it should only generate that if the scorecard config is present https://github.com/operator-framework/operator-sdk/blob/master/internal/util/bundleutil/template.go#L53-L55 And here is the problem. We are hardcoding it to true https://github.com/operator-framework/operator-sdk/blob/master/internal/cmd/operator-sdk/generate/bundle/bundle.go#L300 So this causes the COPY command to show up. |
I think you need to do something like this in generate/bundle/bundle.go. diff --git a/internal/cmd/operator-sdk/generate/bundle/bundle.go b/internal/cmd/operator-sdk/generate/bundle/bundle.go
index ad15a75a..080b72dc 100644
--- a/internal/cmd/operator-sdk/generate/bundle/bundle.go
+++ b/internal/cmd/operator-sdk/generate/bundle/bundle.go
@@ -291,13 +291,15 @@ func (c bundleCmd) runMetadata() error {
}
}
+ scorecardConfigPath := filepath.Join(bundleRoot, scorecard.DefaultConfigDir, scorecard.ConfigFileName)
+
bundleMetadata := bundleutil.BundleMetaData{
BundleDir: c.outputDir,
PackageName: c.packageName,
Channels: c.channels,
DefaultChannel: c.defaultChannel,
OtherLabels: metricsannotations.MakeBundleMetadataLabels(c.layout),
- IsScoreConfigPresent: true,
+ IsScoreConfigPresent: genutil.IsExist(scorecardConfigPath),
}
return bundleMetadata.GenerateMetadata() This needs to be tested with the other plugins to make sure it works. If it doesn't adjust accordingly. |
Cool, I will go through it once. |
I will work on it and raise the PR soon. |
I did this change and tested with the Java plugin and it is working. I will test with other plugins too. |
Also, I tried generating a bundle for go, ansible, and helm chart. Every operator scaffolded scorecard details in the bundle.Dockerfile. |
Fix moved to SDK master branch. Closing this issue as it gets fixed. |
Bug Report
After generating the bundle,
bundle.Dockerfile
gets generated with one extra line.COPY bundle/tests/scorecard /tests/scorecard/
While building a bundle image it is failing as there is no such file in our project structure.
What did you do?
Added Run bundle changes.
What did you expect to see?
There are two ways
What did you see instead? Under which circumstances?
ERROR [3/3] COPY bundle/tests/scorecard /tests/scorecard/
Environment
Operator type:
Kubernetes cluster type:
Kind
$ operator-sdk version
operator-sdk version: "v1.20.0-12-g9a501a76-dirty", commit: "9a501a76cb4100144d325782a3d30b29fb653198", kubernetes version: "v1.23", go version: "go1.17.9", GOOS: "darwin", GOARCH: "amd64"
$ java -version
(if language is Java)openjdk version "16.0.2" 2021-07-20
OpenJDK Runtime Environment (build 16.0.2+7-67)
OpenJDK 64-Bit Server VM (build 16.0.2+7-67, mixed mode, sharing)
$ kubectl version
Client Version: version.Info{Major:"1", Minor:"19", GitVersion:"v1.19.0", GitCommit:"2c6062082e8dbbf36936b35dcc27c6882d3a2f67", GitTreeState:"clean", BuildDate:"2022-01-11T19:37:02Z", GoVersion:"go1.15.14", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"21", GitVersion:"v1.21.1", GitCommit:"5e58841cce77d4bc13713ad2b91fa0d961e69192", GitTreeState:"clean", BuildDate:"2021-05-21T23:01:33Z", GoVersion:"go1.16.4", Compiler:"gc", Platform:"linux/amd64"}
The text was updated successfully, but these errors were encountered: