Skip to content

OTA-1403: Update and Verify Test Metadata Using Makefile #1179

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The .openshift-tests-extension/openshift_payload_cluster-version-operator.json path here diverges from the hack/.openshift-tests-exension/product/type/component/* pattern claimed by the extension you'd linked from the pull-request opening comment. Is the extension text stale? Is our cluster-version-operator-tests binary feeding the wrong location? Other? I guess the update logic living in a vendored directory tips us towards "enhancement text is stale"?

{
"name": "[cvo-testing] cluster-version-operator-tests should support passing tests",
"labels": {},
"resources": {
"isolation": {}
},
"source": "openshift:payload:cluster-version-operator",
"lifecycle": "blocking",
"environmentSelector": {}
}
]
10 changes: 9 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,25 @@ integration-test:
./hack/integration-test.sh
.PHONY: integration-test

update: build
hack/update-test-metadata.sh
.PHONY: update

format:
go fmt ./...
.PHONY: format

verify: verify-yaml
verify: verify-yaml verify-update
.PHONY: verify

verify-yaml:
hack/verify-yaml.sh
.PHONY: verify-yaml

verify-update: update
git diff --exit-code HEAD
.PHONY: verify-update

clean:
rm -rf _output/
rm -rf bin
Expand Down
22 changes: 2 additions & 20 deletions hack/build-go.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,11 @@

set -eu

REPO=github.com/openshift/cluster-version-operator
GOFLAGS=${GOFLAGS:--mod=vendor}
GLDFLAGS=${GLDFLAGS:-}

eval $(go env | grep -e "GOHOSTOS" -e "GOHOSTARCH")

GOOS=${GOOS:-${GOHOSTOS}}
GOARCH=${GOARCH:-${GOHOSTARCH}}

# Go to the root of the repo
cd "$(git rev-parse --show-cdup)"

VERSION_OVERRIDE=${VERSION_OVERRIDE:-${OS_GIT_VERSION:-}}
if [ -z "${VERSION_OVERRIDE:-}" ]; then
echo "Using version from git..."
VERSION_OVERRIDE=$(git describe --abbrev=8 --dirty --always)
fi

eval $(go env)

if [ -z ${BIN_PATH+a} ]; then
export BIN_PATH=_output/${GOOS}/${GOARCH}
fi
# Source build variables
source hack/build-info.sh
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was wondering if there was a way to set up this import without relying on "assume build-go.sh is being called from the repository's root directory". But it seems like there may not be, so probably fine to stick with that assumption and not worry about the BASH_SOURCE and similar semi-reliable approaches.


echo "Building binaries into ${BIN_PATH}"
mkdir -p ${BIN_PATH}
Expand Down
24 changes: 24 additions & 0 deletions hack/build-info.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/env bash

set -eu

REPO=github.com/openshift/cluster-version-operator
GOFLAGS=${GOFLAGS:--mod=vendor}
GLDFLAGS=${GLDFLAGS:-}

eval $(go env | grep -e "GOHOSTOS" -e "GOHOSTARCH")

GOOS=${GOOS:-${GOHOSTOS}}
GOARCH=${GOARCH:-${GOHOSTARCH}}

VERSION_OVERRIDE=${VERSION_OVERRIDE:-${OS_GIT_VERSION:-}}
if [ -z "${VERSION_OVERRIDE:-}" ]; then
echo "Using version from git..."
VERSION_OVERRIDE=$(git describe --abbrev=8 --dirty --always)
fi

eval $(go env)

if [ -z ${BIN_PATH+a} ]; then
export BIN_PATH=_output/${GOOS}/${GOARCH}
fi
8 changes: 8 additions & 0 deletions hack/update-test-metadata.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash

set -eu

source hack/build-info.sh

# Update test metadata
eval "${BIN_PATH}/cluster-version-operator-tests" "update"