Skip to content

Commit cdf477d

Browse files
committed
build: drop vsphereprivate build workaround
Initially we were using the provider's module version in the go.sum file to determine if a provider needed to be rebuilt. Since vsphereprivate is locally developed, not an imported module, it required special treatment. Now that we are using the `go.mod` git hash to check if a terraform provider needs to be rebuilt, we don't need to give vsphereprivate special treatment. Unfortunately, this implementation detail slipped through even though we changed the approach. If we don't drop the workaround, the build script will think `vsphereprivate` always needs to be rebuilt since it's comparing values that will never match.
1 parent ba66fc6 commit cdf477d

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

hack/build.sh

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,18 +34,9 @@ copy_terraform_to_mirror() {
3434
check_module_changes() {
3535
binpath="$1"
3636
srcpath="$2"
37-
build_hash="$(go version -m "${binpath}" | grep 'vcs.revision' | cut -f2 -d'=')"
38-
# If it's a locally developed provider
39-
if test -n "${build_hash}"; then
40-
# Check if a provider has changed based on git changes since the
41-
# revision the provider was last built
42-
git diff --name-only --exit-code "${build_hash}.." -- "${srcpath}"
43-
# If it's an imported module
44-
else
45-
# Check if a provider has changed based on its go.mod git hash
46-
version_info="$(go version -m "${binpath}" | grep -Eo 'main.builtGoModHash=[a-fA-F0-9]+' | cut -f2 -d'=')"
47-
test "${version_info}" == "$(git hash-object "${srcpath}/go.mod")"
48-
fi
37+
# Check if a provider has changed based on its go.mod git hash
38+
version_info="$(go version -m "${binpath}" | grep -Eo 'main.builtGoModHash=[a-fA-F0-9]+' | cut -f2 -d'=')"
39+
test "${version_info}" == "$(git hash-object "${srcpath}/go.mod")"
4940
}
5041

5142
# Build terraform and providers only if needed

0 commit comments

Comments
 (0)