Skip to content

Commit

Permalink
make
Browse files Browse the repository at this point in the history
  • Loading branch information
t0yv0 committed Jan 13, 2025
1 parent 3628d3b commit 5ac256d
Showing 1 changed file with 15 additions and 16 deletions.
31 changes: 15 additions & 16 deletions provider-ci/test-providers/eks/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -212,12 +212,12 @@ lint_provider.fix:
# `make provider_no_deps` builds the provider binary directly, without ensuring that
# `cmd/pulumi-resource-eks/schema.json` is valid and up to date.
# To create a release ready binary, you should use `make provider`.
build_provider_cmd = cd provider && go build $(PULUMI_PROVIDER_BUILD_PARALLELISM) -o $(WORKING_DIR)/bin/$(PROVIDER) -ldflags "$(LDFLAGS)" $(PROJECT)/$(PROVIDER_PATH)/cmd/$(PROVIDER)
build_provider_cmd = cd provider && CGO_ENABLED=0 go build $(PULUMI_PROVIDER_BUILD_PARALLELISM) -o "$(1)" -ldflags "$(LDFLAGS)" $(PROJECT)/$(PROVIDER_PATH)/cmd/$(PROVIDER)
provider: bin/$(PROVIDER)
provider_no_deps:
$(call build_provider_cmd)
$(call build_provider_cmd,$(WORKING_DIR)/bin/$(PROVIDER))
bin/$(PROVIDER): .make/schema
$(call build_provider_cmd)
$(call build_provider_cmd,$(WORKING_DIR)/bin/$(PROVIDER))
.PHONY: provider provider_no_deps

test: export PATH := $(WORKING_DIR)/bin:$(PATH)
Expand Down Expand Up @@ -304,25 +304,24 @@ SKIP_SIGNING ?=

# These targets assume that the schema-embed.json exists - it's generated by tfgen.
# We disable CGO to ensure that the binary is statically linked.
bin/linux-amd64/$(PROVIDER): TARGET := linux-amd64
bin/linux-arm64/$(PROVIDER): TARGET := linux-arm64
bin/darwin-amd64/$(PROVIDER): TARGET := darwin-amd64
bin/darwin-arm64/$(PROVIDER): TARGET := darwin-arm64
bin/windows-amd64/$(PROVIDER).exe: TARGET := windows-amd64
bin/linux-amd64/$(PROVIDER): export GOOS := linux
bin/linux-amd64/$(PROVIDER): export GOARCH := amd64
bin/linux-arm64/$(PROVIDER): export GOOS := linux
bin/linux-arm64/$(PROVIDER): export GOARCH := arm64
bin/darwin-amd64/$(PROVIDER): export GOOS := darwin
bin/darwin-amd64/$(PROVIDER): export GOARCH := amd64
bin/darwin-arm64/$(PROVIDER): export GOOS := darwin
bin/darwin-arm64/$(PROVIDER): export GOARCH := arm64
bin/windows-amd64/$(PROVIDER).exe: export GOOS := windows
bin/windows-amd64/$(PROVIDER).exe: export GOARCH := amd64
bin/%/$(PROVIDER) bin/%/$(PROVIDER).exe: bin/jsign-6.0.jar
@# check the TARGET is set
@test $(TARGET)
@cd provider && \
export GOOS=$$(echo "$(TARGET)" | cut -d "-" -f 1) && \
export GOARCH=$$(echo "$(TARGET)" | cut -d "-" -f 2) && \
export CGO_ENABLED=0 && \
go build -o "${WORKING_DIR}/$@" $(PULUMI_PROVIDER_BUILD_PARALLELISM) -ldflags "$(LDFLAGS)" "$(PROJECT)/$(PROVIDER_PATH)/cmd/$(PROVIDER)"
$(call build_provider_cmd,$(WORKING_DIR)/$@)

@# Only sign windows binary if fully configured.
@# Test variables set by joining with | between and looking for || showing at least one variable is empty.
@# Move the binary to a temporary location and sign it there to avoid the target being up-to-date if signing fails.
@set -e; \
if [[ "${TARGET}" = "windows-amd64" && "${SKIP_SIGNING}" != "true" ]]; then \
if [[ "${GOOS}-${GOARCH}" = "windows-amd64" && "${SKIP_SIGNING}" != "true" ]]; then \
if [[ "|${AZURE_SIGNING_CLIENT_ID}|${AZURE_SIGNING_CLIENT_SECRET}|${AZURE_SIGNING_TENANT_ID}|${AZURE_SIGNING_KEY_VAULT_URI}|" == *"||"* ]]; then \
echo "Can't sign windows binaries as required configuration not set: AZURE_SIGNING_CLIENT_ID, AZURE_SIGNING_CLIENT_SECRET, AZURE_SIGNING_TENANT_ID, AZURE_SIGNING_KEY_VAULT_URI"; \
echo "To rebuild with signing delete the unsigned $@ and rebuild with the fixed configuration"; \
Expand Down

0 comments on commit 5ac256d

Please sign in to comment.