Skip to content

Commit

Permalink
Customizable build_provider_cmd
Browse files Browse the repository at this point in the history
  • Loading branch information
t0yv0 committed Jan 13, 2025
1 parent 50e1cd5 commit d16b7f2
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
15 changes: 15 additions & 0 deletions provider-ci/internal/pkg/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,21 @@ type Config struct {
// MakeTemplate has no effect but is set by 78 providers.
// https://github.com/search?q=org%3Apulumi+path%3A.ci-mgmt.yaml+%22makeTemplate%3A%22&type=code
MakeTemplate string `yaml:"makeTemplate"`

// Customizes the Make function build_provider_cmd.
//
// This function is responsible for creating a provider binary for the desired platform.
//
// Use "$(1)" to refer to the desired output location.
//
// If a cross-compiling build is requested, the environment will have GOOS and GOARCH set.
//
// The default value uses go build:
//
// cd provider && go build -o "$(1)" ...
//
// Customizing this value allows providers implemented in Node or other languages.
BuildProviderCmd string `yaml:"buildProviderCmd"`
}

// LoadLocalConfig loads the provider configuration at the given path with
Expand Down
4 changes: 4 additions & 0 deletions provider-ci/internal/pkg/templates/bridged-provider/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,11 @@ lint_provider.fix:
# `make provider_no_deps` builds the provider binary directly, without ensuring that
# `cmd/pulumi-resource-#{{ .Config.Provider }}#/schema.json` is valid and up to date.
# To create a release ready binary, you should use `make provider`.
#{{- if .Config.BuildProviderCmd }}#
build_provider_cmd = #{{ .Config.BuildProviderCmd }}#
#{{- else }}#
build_provider_cmd = cd provider && CGO_ENABLED=0 go build $(PULUMI_PROVIDER_BUILD_PARALLELISM) -o "$(1)" -ldflags "$(LDFLAGS)" $(PROJECT)/$(PROVIDER_PATH)/cmd/$(PROVIDER)
#{{- end }}#
provider: bin/$(PROVIDER)
provider_no_deps:
$(call build_provider_cmd,$(WORKING_DIR)/bin/$(PROVIDER))
Expand Down

0 comments on commit d16b7f2

Please sign in to comment.