Skip to content

Commit

Permalink
agent scorecard test 3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mwangggg committed May 22, 2024
1 parent ad96512 commit c1b194a
Show file tree
Hide file tree
Showing 7 changed files with 469 additions and 101 deletions.
22 changes: 16 additions & 6 deletions config/scorecard/patches/custom.config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
entrypoint:
- cryostat-scorecard-tests
- operator-install
image: "quay.io/cryostat/cryostat-operator-scorecard:3.0.0-20240511064726"
image: "quay.io/miwan/cryostat-operator-scorecard:3.0.0-20240522175116"
labels:
suite: cryostat
test: operator-install
Expand All @@ -18,7 +18,7 @@
entrypoint:
- cryostat-scorecard-tests
- cryostat-cr
image: "quay.io/cryostat/cryostat-operator-scorecard:3.0.0-20240511064726"
image: "quay.io/miwan/cryostat-operator-scorecard:3.0.0-20240522175116"
labels:
suite: cryostat
test: cryostat-cr
Expand All @@ -28,7 +28,7 @@
entrypoint:
- cryostat-scorecard-tests
- cryostat-multi-namespace
image: "quay.io/cryostat/cryostat-operator-scorecard:3.0.0-20240511064726"
image: "quay.io/miwan/cryostat-operator-scorecard:3.0.0-20240522175116"
labels:
suite: cryostat
test: cryostat-multi-namespace
Expand All @@ -38,7 +38,7 @@
entrypoint:
- cryostat-scorecard-tests
- cryostat-recording
image: "quay.io/cryostat/cryostat-operator-scorecard:3.0.0-20240511064726"
image: "quay.io/miwan/cryostat-operator-scorecard:3.0.0-20240522175116"
labels:
suite: cryostat
test: cryostat-recording
Expand All @@ -48,7 +48,7 @@
entrypoint:
- cryostat-scorecard-tests
- cryostat-config-change
image: "quay.io/cryostat/cryostat-operator-scorecard:3.0.0-20240511064726"
image: "quay.io/miwan/cryostat-operator-scorecard:3.0.0-20240522175116"
labels:
suite: cryostat
test: cryostat-config-change
Expand All @@ -58,7 +58,17 @@
entrypoint:
- cryostat-scorecard-tests
- cryostat-report
image: "quay.io/cryostat/cryostat-operator-scorecard:3.0.0-20240511064726"
image: "quay.io/miwan/cryostat-operator-scorecard:3.0.0-20240522175116"
labels:
suite: cryostat
test: cryostat-report
- op: add
path: /stages/1/tests/-
value:
entrypoint:
- cryostat-scorecard-tests
- cryostat-agent
image: "quay.io/miwan/cryostat-operator-scorecard:3.0.0-20240522175116"
labels:
suite: cryostat
test: cryostat-agent
10 changes: 10 additions & 0 deletions hack/custom.config.yaml.in
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,13 @@
labels:
suite: cryostat
test: cryostat-report
- op: add
path: /stages/1/tests/-
value:
entrypoint:
- cryostat-scorecard-tests
- cryostat-agent
image: "${CUSTOM_SCORECARD_IMG}"
labels:
suite: cryostat
test: cryostat-agent
50 changes: 50 additions & 0 deletions internal/images/custom-scorecard-tests/Dockerfile.cross
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Copyright The Cryostat Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Build the manager binary
FROM --platform=${BUILDPLATFORM} docker.io/library/golang:1.21 as builder
ARG TARGETOS
ARG TARGETARCH

WORKDIR /workspace
# Copy the Go Modules manifests
COPY go.mod go.mod
COPY go.sum go.sum
# cache deps before building and copying source so that we don't need to re-download as much
# and so that source changes don't invalidate our downloaded layer
RUN go mod download

# Copy the go source
COPY api/ api/
COPY internal/images/custom-scorecard-tests/main.go internal/images/custom-scorecard-tests/main.go
COPY internal/test/scorecard/ internal/test/scorecard/

# Build
RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} GO111MODULE=on go build -a -o cryostat-scorecard-tests \
internal/images/custom-scorecard-tests/main.go

FROM registry.access.redhat.com/ubi8/ubi-minimal:latest

ENV TEST=/usr/local/bin/cryostat-scorecard-tests \
USER_UID=1001 \
USER_NAME=test

COPY internal/images/custom-scorecard-tests/bin/user_setup /usr/local/bin/
COPY internal/images/custom-scorecard-tests/bin/entrypoint /usr/local/bin/
COPY --from=builder /workspace/cryostat-scorecard-tests /usr/local/bin/
RUN /usr/local/bin/user_setup

ENTRYPOINT ["/usr/local/bin/entrypoint"]

USER ${USER_UID}
4 changes: 4 additions & 0 deletions internal/images/custom-scorecard-tests/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ func printValidTests() []scapiv1alpha3.TestResult {
tests.CryostatRecordingTestName,
tests.CryostatConfigChangeTestName,
tests.CryostatReportTestName,
tests.CryostatAgentTestName,
}, ","))
result.Errors = append(result.Errors, str)

Expand All @@ -105,6 +106,7 @@ func validateTests(testNames []string) bool {
case tests.CryostatRecordingTestName:
case tests.CryostatConfigChangeTestName:
case tests.CryostatReportTestName:
case tests.CryostatAgentTestName:
default:
return false
}
Expand All @@ -131,6 +133,8 @@ func runTests(testNames []string, bundle *apimanifests.Bundle, namespace string,
results = append(results, *tests.CryostatConfigChangeTest(bundle, namespace, openShiftCertManager))
case tests.CryostatReportTestName:
results = append(results, *tests.CryostatReportTest(bundle, namespace, openShiftCertManager))
case tests.CryostatAgentTestName:
results = append(results, *tests.CryostatAgentTest(bundle, namespace, openShiftCertManager))
default:
log.Fatalf("unknown test found: %s", testName)
}
Expand Down
Loading

0 comments on commit c1b194a

Please sign in to comment.