Skip to content

Commit 4e5d752

Browse files
committed
HACK: Ensure all staging directories have populated nested vendor trees
Signed-off-by: timflannagan <[email protected]>
1 parent eb665f6 commit 4e5d752

File tree

1 file changed

+18
-16
lines changed

1 file changed

+18
-16
lines changed

scripts/unit.sh

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,24 @@ TARGET_NAME=${TARGET_NAME:="unit"}
1212
# TODO(tflannag): Do we need to trap anything here? Maybe remove staging/*/vendor during SIGINT?
1313
pushd "${ROOT_DIR}/staging/${WHAT}"
1414

15-
if [[ ! -d ${ROOT_DIR}/staging/${WHAT}/vendor ]]; then
16-
# Note(tflannag): We don't introduce nested vendor packages into source control,
17-
# and this script will fail when attempting to populate a vendor directory using
18-
# `go test ...`, so vendor first, then run unit tests.
19-
#
20-
# This is likely a poor strategy to maintain going forward as there's a chance we're testing
21-
# against dependencies that don't match what we build with but that should be fine for now.
22-
# We'll likely want to migrate towards having a dedicated test/e2e package that
23-
# runs downstream-specific OLM and registry tests instead of relying on the test packages that
24-
# we pull in from the staging equivalent. In the case of OSBS, where we can't `go get ...` packages from
25-
# external sources, so this should be fine in the testing scenario, but we need the vendor/ when building
26-
# binaries due to the restricted environment. Fortunately, it looks we're able to build from the root directory,
27-
# so it's sufficient for now.
28-
echo "Populating nested staging vendor directory"
29-
go mod vendor && go mod tidy
30-
fi
15+
for remote in "${UPSTREAM_REMOTES[@]}"; do
16+
if [[ ! -d ${ROOT_DIR}/staging/${remote}/vendor ]]; then
17+
# Note(tflannag): We don't introduce nested vendor packages into source control,
18+
# and this script will fail when attempting to populate a vendor directory using
19+
# `go test ...`, so vendor first, then run unit tests.
20+
#
21+
# This is likely a poor strategy to maintain going forward as there's a chance we're testing
22+
# against dependencies that don't match what we build with but that should be fine for now.
23+
# We'll likely want to migrate towards having a dedicated test/e2e package that
24+
# runs downstream-specific OLM and registry tests instead of relying on the test packages that
25+
# we pull in from the staging equivalent. In the case of OSBS, where we can't `go get ...` packages from
26+
# external sources, so this should be fine in the testing scenario, but we need the vendor/ when building
27+
# binaries due to the restricted environment. Fortunately, it looks we're able to build from the root directory,
28+
# so it's sufficient for now.
29+
echo "Populating nested staging vendor directory"
30+
go mod vendor && go mod tidy
31+
fi
32+
done
3133

3234
make ${TARGET_NAME}
3335
popd

0 commit comments

Comments
 (0)