Skip to content

Commit b247772

Browse files
Merge pull request #1168 from DavidHurta/create-openshift-tests-extension-binary
OTA-1403: Create minimal openshift tests extension
2 parents ddb11b3 + b2af387 commit b247772

File tree

40 files changed

+3288
-7
lines changed

40 files changed

+3288
-7
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package main
2+
3+
import (
4+
"os"
5+
6+
"github.com/spf13/cobra"
7+
8+
"github.com/openshift-eng/openshift-tests-extension/pkg/cmd"
9+
"github.com/openshift-eng/openshift-tests-extension/pkg/extension"
10+
"github.com/openshift-eng/openshift-tests-extension/pkg/extension/extensiontests"
11+
)
12+
13+
func main() {
14+
registry := extension.NewRegistry()
15+
ext := extension.NewExtension("openshift", "payload", "cluster-version-operator")
16+
17+
var specs extensiontests.ExtensionTestSpecs
18+
ext.AddSpecs(specs)
19+
registry.Register(ext)
20+
21+
root := &cobra.Command{
22+
Long: "OpenShift Tests Extension for Cluster Version Operator",
23+
}
24+
root.AddCommand(cmd.DefaultExtensionCommands(registry)...)
25+
26+
if err := func() error {
27+
return root.Execute()
28+
}(); err != nil {
29+
os.Exit(1)
30+
}
31+
}

go.mod

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ require (
1010
github.com/ghodss/yaml v1.0.0
1111
github.com/google/go-cmp v0.6.0
1212
github.com/google/uuid v1.6.0
13+
github.com/openshift-eng/openshift-tests-extension v0.0.0-20250220212757-b9c4d98a0c45
1314
github.com/openshift/api v0.0.0-20250207102212-9e59a77ed2e0
1415
github.com/openshift/client-go v0.0.0-20250131180035-f7ec47e2d87a
1516
github.com/openshift/library-go v0.0.0-20250203131244-80620876b7c2
@@ -100,7 +101,7 @@ require (
100101
golang.org/x/term v0.26.0 // indirect
101102
golang.org/x/text v0.20.0 // indirect
102103
google.golang.org/genproto/googleapis/api v0.0.0-20240826202546-f6391c0de4c7 // indirect
103-
google.golang.org/genproto/googleapis/rpc v0.0.0-20240826202546-f6391c0de4c7 // indirect
104+
google.golang.org/genproto/googleapis/rpc v0.0.0-20240924160255-9d4c2d233b61 // indirect
104105
google.golang.org/grpc v1.65.0 // indirect
105106
google.golang.org/protobuf v1.35.1 // indirect
106107
gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect

go.sum

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,8 @@ github.com/onsi/ginkgo/v2 v2.21.0 h1:7rg/4f3rB88pb5obDgNZrNHrQ4e6WpjonchcpuBRnZM
145145
github.com/onsi/ginkgo/v2 v2.21.0/go.mod h1:7Du3c42kxCUegi0IImZ1wUQzMBVecgIHjR1C+NkhLQo=
146146
github.com/onsi/gomega v1.35.1 h1:Cwbd75ZBPxFSuZ6T+rN/WCb/gOc6YgFBXLlZLhC7Ds4=
147147
github.com/onsi/gomega v1.35.1/go.mod h1:PvZbdDc8J6XJEpDK4HCuRBm8a6Fzp9/DmhC9C7yFlog=
148+
github.com/openshift-eng/openshift-tests-extension v0.0.0-20250220212757-b9c4d98a0c45 h1:hXpbYtP3iTh8oy/RKwKkcMziwchY3fIk95ciczf7cOA=
149+
github.com/openshift-eng/openshift-tests-extension v0.0.0-20250220212757-b9c4d98a0c45/go.mod h1:6gkP5f2HL0meusT0Aim8icAspcD1cG055xxBZ9yC68M=
148150
github.com/openshift/api v0.0.0-20250207102212-9e59a77ed2e0 h1:5n8BKML7fkmR4tz81WI0jc722rbta4t7pzT21lcd/Ec=
149151
github.com/openshift/api v0.0.0-20250207102212-9e59a77ed2e0/go.mod h1:yk60tHAmHhtVpJQo3TwVYq2zpuP70iJIFDCmeKMIzPw=
150152
github.com/openshift/client-go v0.0.0-20250131180035-f7ec47e2d87a h1:duO3JMrUOqVx50QhzxvDeOYIwTNOB8/EEuRLPyvAMBg=
@@ -297,8 +299,8 @@ google.golang.org/genproto v0.0.0-20240123012728-ef4313101c80 h1:KAeGQVN3M9nD0/b
297299
google.golang.org/genproto v0.0.0-20240123012728-ef4313101c80/go.mod h1:cc8bqMqtv9gMOr0zHg2Vzff5ULhhL2IXP4sbcn32Dro=
298300
google.golang.org/genproto/googleapis/api v0.0.0-20240826202546-f6391c0de4c7 h1:YcyjlL1PRr2Q17/I0dPk2JmYS5CDXfcdb2Z3YRioEbw=
299301
google.golang.org/genproto/googleapis/api v0.0.0-20240826202546-f6391c0de4c7/go.mod h1:OCdP9MfskevB/rbYvHTsXTtKC+3bHWajPdoKgjcYkfo=
300-
google.golang.org/genproto/googleapis/rpc v0.0.0-20240826202546-f6391c0de4c7 h1:2035KHhUv+EpyB+hWgJnaWKJOdX1E95w2S8Rr4uWKTs=
301-
google.golang.org/genproto/googleapis/rpc v0.0.0-20240826202546-f6391c0de4c7/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU=
302+
google.golang.org/genproto/googleapis/rpc v0.0.0-20240924160255-9d4c2d233b61 h1:N9BgCIAUvn/M+p4NJccWPWb3BWh88+zyL0ll9HgbEeM=
303+
google.golang.org/genproto/googleapis/rpc v0.0.0-20240924160255-9d4c2d233b61/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU=
302304
google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc=
303305
google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ=
304306
google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA=

hack/build-go.sh

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,37 @@ if [ -z "${VERSION_OVERRIDE:-}" ]; then
2020
VERSION_OVERRIDE=$(git describe --abbrev=8 --dirty --always)
2121
fi
2222

23-
GLDFLAGS+="-X ${REPO}/pkg/version.Raw=${VERSION_OVERRIDE}"
24-
2523
eval $(go env)
2624

2725
if [ -z ${BIN_PATH+a} ]; then
2826
export BIN_PATH=_output/${GOOS}/${GOARCH}
2927
fi
3028

29+
echo "Building binaries into ${BIN_PATH}"
3130
mkdir -p ${BIN_PATH}
3231

33-
echo "Building ${REPO} (${VERSION_OVERRIDE})"
32+
# Build the cluster-version-operator-tests binary and compress it
33+
OPENSHIFT_TESTS_EXTENSION_MODULE="github.com/openshift-eng/openshift-tests-extension"
34+
GIT_COMMIT=$(git rev-parse --short HEAD)
35+
BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')
36+
GIT_TREE_STATE=$(if git diff --quiet; then echo clean; else echo dirty; fi)
37+
LDFLAGS_TEST_EXTENSION=$GLDFLAGS
38+
LDFLAGS_TEST_EXTENSION+=" -X '${OPENSHIFT_TESTS_EXTENSION_MODULE}/pkg/version.CommitFromGit=${GIT_COMMIT}'"
39+
LDFLAGS_TEST_EXTENSION+=" -X '${OPENSHIFT_TESTS_EXTENSION_MODULE}/pkg/version.BuildDate=${BUILD_DATE}'"
40+
LDFLAGS_TEST_EXTENSION+=" -X '${OPENSHIFT_TESTS_EXTENSION_MODULE}/pkg/version.GitTreeState=${GIT_TREE_STATE}'"
41+
42+
echo "Building ${REPO} cluster-version-operator-tests binary (${VERSION_OVERRIDE})"
43+
GO_COMPLIANCE_POLICY="exempt_all" CGO_ENABLED=0 GOOS=${GOOS} GOARCH=${GOARCH} \
44+
go build \
45+
${GOFLAGS} \
46+
-ldflags "${LDFLAGS_TEST_EXTENSION}" \
47+
-o "${BIN_PATH}/cluster-version-operator-tests" \
48+
"${REPO}/cmd/cluster-version-operator-tests/..."
49+
50+
echo "Compressing the cluster-version-operator-tests binary"
51+
gzip --keep --force "${BIN_PATH}/cluster-version-operator-tests"
52+
53+
# Build the cluster-version-operator binary
54+
GLDFLAGS+="-X ${REPO}/pkg/version.Raw=${VERSION_OVERRIDE}"
55+
echo "Building ${REPO} cluster-version-operator binary (${VERSION_OVERRIDE})"
3456
GOOS=${GOOS} GOARCH=${GOARCH} go build ${GOFLAGS} -ldflags "${GLDFLAGS}" -o ${BIN_PATH}/cluster-version-operator ${REPO}/cmd/cluster-version-operator/...

vendor/github.com/openshift-eng/openshift-tests-extension/LICENSE

Lines changed: 201 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/openshift-eng/openshift-tests-extension/pkg/cmd/cmd.go

Lines changed: 23 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/openshift-eng/openshift-tests-extension/pkg/cmd/cmdimages/cmdimages.go

Lines changed: 36 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)