Skip to content

Commit 3a35ff6

Browse files
authored
scorecard CI: use non-default scorecard config (#1058)
* commands/.../scorecard/scorecard.go: grammar * hack/tests/scorecard-subcommand.sh: pass test config path * tests/test-framework/.test-osdk-scorecard.yaml: renamed
1 parent 4369d36 commit 3a35ff6

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

commands/operator-sdk/cmd/scorecard/scorecard.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ func initConfig() error {
300300
if err := viper.ReadInConfig(); err == nil {
301301
log.Info("Using config file: ", viper.ConfigFileUsed())
302302
} else {
303-
log.Warn("Could not load config file; using only flags")
303+
log.Warn("Could not load config file; using flags")
304304
}
305305
return nil
306306
}

hack/tests/scorecard-subcommand.sh

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,28 @@
11
#!/usr/bin/env bash
22

33
DEST_IMAGE="quay.io/example/scorecard-proxy"
4+
CONFIG_PATH=".test-osdk-scorecard.yaml"
45

56
set -ex
67

78
# build scorecard-proxy image (and delete intermediate builder image)
8-
./hack/image/build-scorecard-proxy-image.sh $DEST_IMAGE
9+
./hack/image/build-scorecard-proxy-image.sh "$DEST_IMAGE"
910

1011
# the test framework directory has all the manifests needed to run the cluster
1112
pushd test/test-framework
12-
commandoutput="$(operator-sdk scorecard --cr-manifest deploy/crds/cache_v1alpha1_memcached_cr.yaml --init-timeout 60 --csv-path deploy/memcachedoperator.0.0.2.csv.yaml --verbose --proxy-image $DEST_IMAGE --proxy-pull-policy Never 2>&1)"
13+
commandoutput="$(operator-sdk scorecard \
14+
--cr-manifest deploy/crds/cache_v1alpha1_memcached_cr.yaml \
15+
--init-timeout 60 \
16+
--csv-path deploy/memcachedoperator.0.0.2.csv.yaml \
17+
--verbose \
18+
--proxy-image "$DEST_IMAGE" \
19+
--proxy-pull-policy Never \
20+
2>&1)"
1321
echo $commandoutput | grep "Total Score: 6/8 points"
22+
1423
# test config file
15-
commandoutput2="$(operator-sdk scorecard --proxy-image $DEST_IMAGE)"
24+
commandoutput2="$(operator-sdk scorecard \
25+
--proxy-image "$DEST_IMAGE" \
26+
--config "$CONFIG_PATH")"
1627
echo $commandoutput2 | grep "Total Score: 6/8 points"
1728
popd

0 commit comments

Comments
 (0)