Skip to content

Commit 7b855fe

Browse files
committed
Merge branch 'master' into refactor/controller-runtime-v0.2.0
2 parents c825c90 + ae7fab6 commit 7b855fe

File tree

20 files changed

+556
-125
lines changed

20 files changed

+556
-125
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88
### Changed
99

10+
- Make `ready` package idempotent. Now, a user can call `Set()` or `Unset()` to set the operator's readiness without knowing the current state. ([#1761](https://github.com/operator-framework/operator-sdk/pull/1761))
11+
1012
### Breaking changes
1113

1214
- CSV config field `role-path` is now `role-paths` and takes a list of strings. Users can now specify multiple `Role` and `ClusterRole` manifests using `role-paths`. ([#1704](https://github.com/operator-framework/operator-sdk/pull/1704))
@@ -39,6 +41,8 @@
3941

4042
### Bug Fixes
4143

44+
- Check if `metadata.annotations['alm-examples']` is non-empty before creating contained CR manifests in the scorecard. ([#1789](https://github.com/operator-framework/operator-sdk/pull/1789))
45+
4246
## v0.9.0
4347

4448
### Added

Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,18 @@ test/unit:
110110

111111
test/subcommand: test/subcommand/test-local test/subcommand/scorecard test/subcommand/alpha-olm
112112

113+
test/subcommand2:
114+
./ci/tests/subcommand.sh
115+
113116
test/subcommand/test-local:
114117
./hack/tests/test-subcommand.sh
115118

116119
test/subcommand/scorecard:
117120
./hack/tests/scorecard-subcommand.sh
118121

122+
test/subcommand/scorecard2:
123+
./ci/tests/scorecard-subcommand.sh
124+
119125
test/subcommand/alpha-olm:
120126
./hack/tests/alpha-olm-subcommands.sh
121127

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
FROM osdk-builder as builder
2+
3+
RUN ci/tests/scorecard-proxy-scaffold.sh
4+
5+
FROM registry.access.redhat.com/ubi7/ubi-minimal:latest
6+
7+
ENV PROXY=/usr/local/bin/scorecard-proxy \
8+
USER_UID=1001 \
9+
USER_NAME=proxy
10+
11+
# install operator binary
12+
COPY --from=builder /scorecard/scorecard-proxy ${PROXY}
13+
14+
COPY --from=builder /scorecard/bin /usr/local/bin
15+
RUN /usr/local/bin/user_setup
16+
17+
ENTRYPOINT ["/usr/local/bin/entrypoint"]
18+
19+
USER ${USER_UID}

ci/tests/scorecard-proxy-scaffold.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/usr/bin/env bash
2+
set -eux
3+
4+
ROOTDIR="$(pwd)"
5+
SCORECARD_DIR="/scorecard"
6+
7+
mkdir -p $SCORECARD_DIR
8+
9+
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 \
10+
go build \
11+
-gcflags "all=-trimpath=${ROOTDIR}" \
12+
-asmflags "all=-trimpath=${ROOTDIR}" \
13+
-o $SCORECARD_DIR/scorecard-proxy \
14+
images/scorecard-proxy/cmd/proxy/main.go
15+
mv images/scorecard-proxy/bin $SCORECARD_DIR/bin

ci/tests/scorecard-subcommand.sh

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/usr/bin/env bash
2+
3+
component="scorecard-proxy"
4+
eval IMAGE=$IMAGE_FORMAT
5+
CSV_PATH="deploy/olm-catalog/memcached-operator/0.0.3/memcached-operator.v0.0.3.clusterserviceversion.yaml"
6+
CONFIG_PATH=".test-osdk-scorecard.yaml"
7+
8+
set -ex
9+
10+
# the test framework directory has all the manifests needed to run the cluster
11+
pushd test/test-framework
12+
commandoutput="$(operator-sdk scorecard \
13+
--cr-manifest deploy/crds/cache_v1alpha1_memcached_cr.yaml \
14+
--cr-manifest deploy/crds/cache_v1alpha1_memcachedrs_cr.yaml \
15+
--init-timeout 60 \
16+
--csv-path "$CSV_PATH" \
17+
--verbose \
18+
--proxy-image "$IMAGE" \
19+
2>&1)"
20+
echo $commandoutput | grep "Total Score: 82%"
21+
22+
# test config file
23+
commandoutput2="$(operator-sdk scorecard \
24+
--proxy-image "$IMAGE" \
25+
--config "$CONFIG_PATH")"
26+
# check basic suite
27+
echo $commandoutput2 | grep '^.*"error": 0,[[:space:]]"pass": 3,[[:space:]]"partialPass": 0,[[:space:]]"fail": 0,[[:space:]]"totalTests": 3,[[:space:]]"totalScorePercent": 100,.*$'
28+
# check olm suite
29+
echo $commandoutput2 | grep '^.*"error": 0,[[:space:]]"pass": 2,[[:space:]]"partialPass": 3,[[:space:]]"fail": 0,[[:space:]]"totalTests": 5,[[:space:]]"totalScorePercent": 74,.*$'
30+
# check custom json result
31+
echo $commandoutput2 | grep '^.*"error": 0,[[:space:]]"pass": 1,[[:space:]]"partialPass": 1,[[:space:]]"fail": 0,[[:space:]]"totalTests": 2,[[:space:]]"totalScorePercent": 71,.*$'
32+
popd

ci/tests/subcommand.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/usr/bin/env bash
2+
source hack/lib/test_lib.sh
3+
4+
set -eux
5+
6+
ROOTDIR="$(pwd)"
7+
mkdir -p $ROOTDIR/bin
8+
export PATH=$ROOTDIR/bin:$PATH
9+
10+
if ! [ -x "$(command -v kubectl)" ]; then
11+
curl -Lo kubectl https://storage.googleapis.com/kubernetes-release/release/v1.14.2/bin/linux/amd64/kubectl && chmod +x kubectl && mv kubectl bin/
12+
fi
13+
14+
if ! [ -x "$(command -v oc)" ]; then
15+
curl -Lo oc.tar.gz https://github.com/openshift/origin/releases/download/v3.11.0/openshift-origin-client-tools-v3.11.0-0cbc58b-linux-64bit.tar.gz
16+
tar xvzOf oc.tar.gz openshift-origin-client-tools-v3.11.0-0cbc58b-linux-64bit/oc > oc && chmod +x oc && mv oc bin/ && rm oc.tar.gz
17+
fi
18+
19+
oc version
20+
21+
make install
22+
23+
./hack/tests/test-subcommand.sh
24+
./ci/tests/scorecard-subcommand.sh
25+
# This can't run in openshift-ci because the test cluster already has OLM installed.
26+
#./hack/tests/alpha-olm-subcommands.sh

cmd/operator-sdk/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ func checkDepManager(dm projutil.DepManagerType) error {
145145
}
146146
if !goModOn {
147147
return fmt.Errorf(`dependency manager "modules" requires working directory to be in $GOPATH/src` +
148-
` and GO111MODULE=on, or outside of $GOPATH/src and GO111MODULE="on", "auto", or unset`)
148+
` and GO111MODULE=on, or outside of $GOPATH/src and GO111MODULE="on", "auto", or unset. More info: https://github.com/operator-framework/operator-sdk/blob/master/doc/user-guide.md#go-modules`)
149149
}
150150
case projutil.DepManagerDep:
151151
inGopathSrc, err := projutil.WdInGoPathSrc()

cmd/operator-sdk/new/cmd.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ func doGoScaffold() error {
189189
return merr
190190
} else if !goModOn {
191191
return errors.New(`dependency manager "modules" requires working directory to be in $GOPATH/src` +
192-
` and GO111MODULE=on, or outside of $GOPATH/src and GO111MODULE="on", "auto", or unset`)
192+
` and GO111MODULE=on, or outside of $GOPATH/src and GO111MODULE="on", "auto", or unset. More info: https://github.com/operator-framework/operator-sdk/blob/master/doc/user-guide.md#go-modules`)
193193
}
194194
err = s.Execute(cfg, &scaffold.GoMod{}, &scaffold.Tools{})
195195
default:

0 commit comments

Comments
 (0)