-
Notifications
You must be signed in to change notification settings - Fork 193
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
OTA-1403: Create minimal openshift tests extension #1168
base: main
Are you sure you want to change the base?
Changes from all commits
9529697
8757fbb
76bf74c
91e1eb9
3fa9dbf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package main | ||
|
||
import ( | ||
"os" | ||
|
||
"github.com/spf13/cobra" | ||
|
||
"github.com/openshift-eng/openshift-tests-extension/pkg/cmd" | ||
"github.com/openshift-eng/openshift-tests-extension/pkg/extension" | ||
"github.com/openshift-eng/openshift-tests-extension/pkg/extension/extensiontests" | ||
) | ||
|
||
func main() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Based on the https://github.com/openshift-eng/openshift-tests-extension/blob/main/cmd/example-tests/main.go example extension |
||
registry := extension.NewRegistry() | ||
ext := extension.NewExtension("openshift", "payload", "cluster-version-operator") | ||
|
||
var specs []*extensiontests.ExtensionTestSpec | ||
ext.AddSpecs(specs) | ||
registry.Register(ext) | ||
|
||
root := &cobra.Command{ | ||
Long: "OpenShift Tests Extension for Cluster Version Operator", | ||
} | ||
root.AddCommand(cmd.DefaultExtensionCommands(registry)...) | ||
|
||
if err := func() error { | ||
return root.Execute() | ||
}(); err != nil { | ||
os.Exit(1) | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,8 +20,6 @@ if [ -z "${VERSION_OVERRIDE:-}" ]; then | |
VERSION_OVERRIDE=$(git describe --abbrev=8 --dirty --always) | ||
fi | ||
|
||
GLDFLAGS+="-X ${REPO}/pkg/version.Raw=${VERSION_OVERRIDE}" | ||
|
||
eval $(go env) | ||
|
||
if [ -z ${BIN_PATH+a} ]; then | ||
|
@@ -30,5 +28,19 @@ fi | |
|
||
mkdir -p ${BIN_PATH} | ||
|
||
echo "Building ${REPO} (${VERSION_OVERRIDE})" | ||
GOOS=${GOOS} GOARCH=${GOARCH} go build ${GOFLAGS} -ldflags "${GLDFLAGS}" -o ${BIN_PATH}/cluster-version-operator ${REPO}/cmd/... | ||
# Build the openshift-tests-extension and compress it | ||
echo "Building ${REPO} openshift-tests-extension binary (${VERSION_OVERRIDE})" | ||
GO_COMPLIANCE_POLICY="exempt_all" CGO_ENABLED=0 GOOS=${GOOS} GOARCH=${GOARCH} \ | ||
go build \ | ||
${GOFLAGS} \ | ||
-ldflags "${GLDFLAGS}" \ | ||
-o "${BIN_PATH}/openshift-tests-extension" \ | ||
"${REPO}/cmd/openshift-tests-extension/..." | ||
Comment on lines
+32
to
+38
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not a skillful go builder. Suggestions and tips are welcomed. |
||
|
||
echo "Compressing the openshift-tests-extension binary" | ||
gzip --keep --force "${BIN_PATH}/openshift-tests-extension" | ||
|
||
# Build the cluster-version-operator binary | ||
GLDFLAGS+="-X ${REPO}/pkg/version.Raw=${VERSION_OVERRIDE}" | ||
echo "Building ${REPO} cluster-version-operator binary (${VERSION_OVERRIDE})" | ||
GOOS=${GOOS} GOARCH=${GOARCH} go build ${GOFLAGS} -ldflags "${GLDFLAGS}" -o ${BIN_PATH}/cluster-version-operator ${REPO}/cmd/cluster-version-operator/... |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The movement of the files could be considered an overkill. I am interested in opinions and suggestions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a fan actually - but would do it in a separate PR that does nothing else