Skip to content

Commit

Permalink
make os_arch_seen a local variable in sh
Browse files Browse the repository at this point in the history
  • Loading branch information
mauriciopoppe committed May 13, 2021
1 parent cccfaef commit e617165
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions release-tools/build.make
Expand Up @@ -78,11 +78,14 @@ FULL_LDFLAGS = $(LDFLAGS) $(IMPORTPATH_LDFLAGS) $(EXT_LDFLAGS)
# defined by BUILD_PLATFORMS.
$(CMDS:%=build-%): build-%: check-go-version-go
mkdir -p bin
# OS_ARCH_SEEN captures all of the $os-$arch seen for the current binary
# os_arch_seen captures all of the $os-$arch seen for the current binary
# that we want to build, if we've seen an $os-$arch before it means that
# we don't need to build it again, this is done to avoid building
# the windows binary multiple times (see the default value of $BUILD_PLATFORMS)
export OS_ARCH_SEEN="" && echo '$(BUILD_PLATFORMS)' | tr ';' '\n' | while read -r os arch suffix base_image addon_image; do \
echo '$(BUILD_PLATFORMS)' | tr ';' '\n' | while read -r os arch suffix base_image addon_image; do \
if ! [ -z $$os_arch_seen ]; then \
os_arch_seen=""; \
fi; \
os_arch_seen_pre=$${OS_ARCH_SEEN%%$$os-$$arch*}; \
if ! [ $${#os_arch_seen_pre} = $${#OS_ARCH_SEEN} ]; then \
continue; \
Expand All @@ -91,7 +94,7 @@ $(CMDS:%=build-%): build-%: check-go-version-go
echo "Building $* for GOOS=$$os GOARCH=$$arch failed, see error(s) above."; \
exit 1; \
fi; \
OS_ARCH_SEEN+=";$$os-$$arch"; \
os_arch_seen+=";$$os-$$arch"; \
done

$(CMDS:%=container-%): container-%: build-%
Expand Down

0 comments on commit e617165

Please sign in to comment.