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

scorecard: add bundle metadata #3474

Merged
merged 1 commit into from Jul 21, 2020

Conversation

estroz
Copy link
Member

@estroz estroz commented Jul 20, 2020

Description of the change:

  • cmd/operator-sdk/generate/bundle: write scorecard bundle metadata to annotations.yaml and bundle.Dockerfile
  • cmd/operator-sdk/scorecard: use scorecard metadata config path if it exists, defaulting to tests/scorecard/config.yaml
  • internal/annotations: consolidate annotations for metrics and scorecard in subpackages here
  • internal/scorecard: encode "config.yaml" as hard-coded file name for the scorecard config, and add metadata to example annotations.yaml files

Motivation for the change: This PR adds scorecard bundle metadata "mediaType" and "config", which are written to bundle metadata on generate bundle when either --overwrite is set or metadata files do not exist. "config.yaml" is a hard-coded file name for the scorecard config file.

Checklist

If the pull request includes user-facing changes, extra documentation is required:

/cc @jmccormick2001 @varshaprasad96 @joelanford

/kind feature

@openshift-ci-robot openshift-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. kind/feature Categorizes issue or PR as related to a new feature. labels Jul 20, 2020
@joelanford joelanford mentioned this pull request Jul 20, 2020
92 tasks
"strings"

"github.com/operator-framework/operator-registry/pkg/lib/bundle"
yaml "gopkg.in/yaml.v3"
Copy link
Contributor

Choose a reason for hiding this comment

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

could we please use sigs.k8s.io/yaml instead of this one for we still closer as possible to rip all these other modules to dealing with yaml as well?

Copy link
Member Author

Choose a reason for hiding this comment

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

That isn't possible until we bump operator-registry versions since the struct being marshalled only has yaml tags. I don't think we'll bump versions until after v1.0.

@estroz estroz force-pushed the feature/scorecard-metadata branch 2 times, most recently from 079c762 to 681eb76 Compare July 21, 2020 20:59
@estroz estroz changed the title [WIP] scorecard: add bundle metadata scorecard: add bundle metadata Jul 21, 2020
@openshift-ci-robot openshift-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 21, 2020
@estroz estroz force-pushed the feature/scorecard-metadata branch from 681eb76 to 742d2a4 Compare July 21, 2020 21:11
Copy link
Contributor

@jmccormick2001 jmccormick2001 left a comment

Choose a reason for hiding this comment

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

I tested this out, seems to work as expected, I modified the annotations.yaml by adding operators.operatorframework.io.test.config.v1: tests/scorecard2/
operators.operatorframework.io.test.mediatype.v1: scorecard+v1

I added a tests/scorecard2 directory with a valid config.yaml file....
I then removed the tests/scorecard directory...

and then ran scorecard, it produced a configMap that holds those values and the tests ran ok....I verified the bundle.tar.gz in the configmap as follows:
kubectl -n default get configmap scorecard-test-qdwt -o jsonpath='{.binaryData.bundle.tar.gz}' | base64 -d > /tmp/bundle.tar.gz

this confirmed that the annotations.yaml included in the configmap matched what I expected.

@estroz estroz force-pushed the feature/scorecard-metadata branch 2 times, most recently from 9002750 to 850009c Compare July 21, 2020 21:58
which are written to bundle metadata on `generate bundle` when either
`--overwrite` is set or metadata files do not exist. "config.yaml"
is a hard-coded file name for the scorecard config file.

cmd/operator-sdk/generate/bundle: write scorecard bundle metadata
to annotations.yaml and bundle.Dockerfile

cmd/operator-sdk/scorecard: use scorecard metadata config path if
it exists, defaulting to `tests/scorecard/config.yaml`

internal/annotations: consolidate annotations for metrics and scorecard
in subpackages here

internal/scorecard: encode "config.yaml" as hard-coded file name for
the scorecard config, and add metadata to example annotations.yaml files
@estroz estroz force-pushed the feature/scorecard-metadata branch from 850009c to d1ebfde Compare July 21, 2020 22:03
@estroz estroz merged commit c51b80c into operator-framework:master Jul 21, 2020
@estroz estroz deleted the feature/scorecard-metadata branch July 21, 2020 22:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants