Skip to content

Commit

Permalink
BuildProviderPre hook
Browse files Browse the repository at this point in the history
  • Loading branch information
t0yv0 committed Jan 16, 2025
1 parent 3b4cfa3 commit 07fac7a
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 4 deletions.
3 changes: 3 additions & 0 deletions provider-ci/internal/pkg/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,9 @@ type Config struct {
// Customizing this value allows providers implemented in Node or other languages.
BuildProviderCmd string `yaml:"buildProviderCmd"`

// Customizes a hook to run right before BuildProviderCmd.
BuildProviderPre string `yaml:"buildProviderPre"`

// Customizes the Make function test_provider_cmd.
//
// This function is called without arguments to run unit tests for the provider binary.
Expand Down
10 changes: 8 additions & 2 deletions provider-ci/internal/pkg/templates/bridged-provider/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,15 @@ lint_provider.fix:
.PHONY: lint_provider lint_provider.fix

#{{- if .Config.BuildProviderCmd }}#
build_provider_cmd = #{{ .Config.BuildProviderCmd }}#
build_provider_cmd = #{{ if .Config.BuildProviderPre -}}#
#{{ .Config.BuildProviderPre }}#;
#{{- end -}}#
#{{ .Config.BuildProviderCmd }}#
#{{- else }}#
build_provider_cmd = cd provider && GOOS=$(1) GOARCH=$(2) CGO_ENABLED=0 go build $(PULUMI_PROVIDER_BUILD_PARALLELISM) -o "$(3)" -ldflags "$(LDFLAGS)" $(PROJECT)/$(PROVIDER_PATH)/cmd/$(PROVIDER)
build_provider_cmd = #{{ if .Config.BuildProviderPre -}}#
#{{ .Config.BuildProviderPre }}#;
#{{- end -}}#
cd provider && GOOS=$(1) GOARCH=$(2) CGO_ENABLED=0 go build $(PULUMI_PROVIDER_BUILD_PARALLELISM) -o "$(3)" -ldflags "$(LDFLAGS)" $(PROJECT)/$(PROVIDER_PATH)/cmd/$(PROVIDER)
#{{- end }}#

provider: bin/$(PROVIDER)
Expand Down
2 changes: 1 addition & 1 deletion provider-ci/test-providers/aws/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ test_provider:
.PHONY: test_provider

tfgen: schema
schema: .make/schema
schema: .make/schema
# This does actually have dependencies, but we're keeping it around for backwards compatibility for now
tfgen_no_deps: .make/schema
.make/schema: export PULUMI_HOME := $(WORKING_DIR)/.pulumi
Expand Down
1 change: 1 addition & 0 deletions provider-ci/test-providers/eks/.ci-mgmt.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ env:
PULUMI_LOCAL_NUGET: ${{ github.workspace }}/nuget
template: generic
freeDiskSpaceBeforeTest: true # TODO: https://github.com/pulumi/pulumi/issues/17718
buildProviderPre: echo building-provider
2 changes: 1 addition & 1 deletion provider-ci/test-providers/eks/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ lint_provider: provider
lint_provider.fix:
cd provider && golangci-lint run --path-prefix provider -c ../.golangci.yml --fix
.PHONY: lint_provider lint_provider.fix
build_provider_cmd = cd provider && GOOS=$(1) GOARCH=$(2) CGO_ENABLED=0 go build $(PULUMI_PROVIDER_BUILD_PARALLELISM) -o "$(3)" -ldflags "$(LDFLAGS)" $(PROJECT)/$(PROVIDER_PATH)/cmd/$(PROVIDER)
build_provider_cmd = echo building-provider;cd provider && GOOS=$(1) GOARCH=$(2) CGO_ENABLED=0 go build $(PULUMI_PROVIDER_BUILD_PARALLELISM) -o "$(3)" -ldflags "$(LDFLAGS)" $(PROJECT)/$(PROVIDER_PATH)/cmd/$(PROVIDER)

provider: bin/$(PROVIDER)

Expand Down

0 comments on commit 07fac7a

Please sign in to comment.