pulumi/Makefile

92 lines
5.1 KiB
Makefile
Raw Normal View History

PROJECT_NAME := Pulumi SDK
PROJECT_ROOT := $(realpath .)
SUB_PROJECTS := sdk/dotnet sdk/nodejs sdk/python sdk/go
include build/common.mk
PROJECT := github.com/pulumi/pulumi/pkg/v3/cmd/pulumi
PROJECT_PKGS := $(shell cd ./pkg && go list ./... | grep -v /vendor/)
2021-07-12 16:42:06 +02:00
TESTS_PKGS := $(shell cd ./tests && go list -tags all ./... | grep -v tests/templates | grep -v /vendor/)
VERSION := $(shell pulumictl get version)
TESTPARALLELISM := 10
# Motivation: running `make TEST_ALL_DEPS= test_all` permits running
# `test_all` without the dependencies.
TEST_ALL_DEPS = build $(SUB_PROJECTS:%=%_install)
ensure::
$(call STEP_MESSAGE)
@echo "Check for pulumictl"; [ -e "$(shell which pulumictl)" ]
@echo "cd sdk && go mod download"; cd sdk && go mod download
@echo "cd pkg && go mod download"; cd pkg && go mod download
@echo "cd tests && go mod download"; cd tests && go mod download
2018-07-12 22:29:35 +02:00
build-proto::
cd sdk/proto && ./generate.sh
Update schema-based docs generator (#4035) * Update properties.tmpl to render property comment as-is. WIP splitting out properties to lang-specific tables. * Generate the constructor dynamically from the resource per language. * Add doc functions in each language generator package for getting doc links for types..and later other functions too. * Render the constructor params in the Go code and inject into the template. * Generate nodejs types using the nodejs lang generator. * Add a templates bundler. Added a new Make target for autogenerating a static bundle for the resource docs generator. * Generate type links for all languages based on their schema type. Render the property type with a link if the underlying elements have a supporting type. Fix word-breaks for Python type names. * Various changes including the introduction of an interface type under the codegen package to help with generating some language-specific information for the resource docs generator. * Add a function to explicitly generate links for input types of nested types. Fix the resource doc link generator for Go. Don't replace the module name from the nodejs language type. * Fix bug with C# property type html encoding. * Fix some template formatting. Pass the state inputs for Python to generate the lookup function for it. * Do not generate the examples section if there are none. * Generating the property types per language. * Formatting. Rename function for readability. * Add comments. Update README. * Use relative URLs for doc links within the main site
2020-03-09 18:35:20 +01:00
.PHONY: generate
generate::
$(call STEP_MESSAGE)
echo "This command does not do anything anymore. It will be removed in a future version."
Update schema-based docs generator (#4035) * Update properties.tmpl to render property comment as-is. WIP splitting out properties to lang-specific tables. * Generate the constructor dynamically from the resource per language. * Add doc functions in each language generator package for getting doc links for types..and later other functions too. * Render the constructor params in the Go code and inject into the template. * Generate nodejs types using the nodejs lang generator. * Add a templates bundler. Added a new Make target for autogenerating a static bundle for the resource docs generator. * Generate type links for all languages based on their schema type. Render the property type with a link if the underlying elements have a supporting type. Fix word-breaks for Python type names. * Various changes including the introduction of an interface type under the codegen package to help with generating some language-specific information for the resource docs generator. * Add a function to explicitly generate links for input types of nested types. Fix the resource doc link generator for Go. Don't replace the module name from the nodejs language type. * Fix bug with C# property type html encoding. * Fix some template formatting. Pass the state inputs for Python to generate the lookup function for it. * Do not generate the examples section if there are none. * Generating the property types per language. * Formatting. Rename function for readability. * Add comments. Update README. * Use relative URLs for doc links within the main site
2020-03-09 18:35:20 +01:00
build::
cd pkg && go install -ldflags "-X github.com/pulumi/pulumi/pkg/v3/version.Version=${VERSION}" ${PROJECT}
build_debug::
cd pkg && go install -gcflags="all=-N -l" -ldflags "-X github.com/pulumi/pulumi/pkg/v3/version.Version=${VERSION}" ${PROJECT}
developer_docs::
cd developer-docs && make html
install::
cd pkg && GOBIN=$(PULUMI_BIN) go install -ldflags "-X github.com/pulumi/pulumi/pkg/v3/version.Version=${VERSION}" ${PROJECT}
install_all:: install
dist:: build
cd pkg && go install -ldflags "-X github.com/pulumi/pulumi/pkg/v3/version.Version=${VERSION}" ${PROJECT}
# NOTE: the brew target intentionally avoids the dependency on `build`, as it does not require the language SDKs.
Ensure that make brew works as expected rather than passing empty version (#6566) Fixes:#6565 As part of #6460, the logic for determing the version of the build was moved to be a dependency on pulumictl. Unfortunately, the homebrew installs use the "make dist" command to build + install Pulumi to the user maching and as that would have a dependency on pulumictl and it not existing on the user machine, it would pass an empty version to the ldflag This then manifested to the user as: ``` ▶ pulumi version warning: A new version of Pulumi is available. To upgrade from version '0.0.0' to '2.22.0', run $ brew upgrade pulumi or visit https://pulumi.com/docs/reference/install/ for manual instructions and release notes. ``` We are able to mitigate this behaviour by bringing back the get-version script and using that script as part of the make brew installation We can see that the versions are the same between the 2 different installation techniques ``` make dist <------- uses pulumict DIST: go install -ldflags "-X github.com/pulumi/pulumi/sdk/v2/go/common/version.Version=2.24.0-alpha.1616029310+787eb70a" github.com/pulumi/pulumi/sdk/v2/dotnet/cmd/pulumi-language-dotnet DIST: BUILD: ``` ``` make brew <----- uses the legacy script ▶ make brew BREW: go install -ldflags "-X github.com/pulumi/pulumi/sdk/v2/go/common/version.Version=v2.24.0-alpha.1616029310+g787eb70a2" github.com/pulumi/pulumi/sdk/v2/dotnet/cmd/pulumi-language-dotnet BREW: ``` A full post mortem will be carried out to ensure we mitigate these types of errors going forward and that we are able to better test these types of situations
2021-03-18 03:07:02 +01:00
brew:: BREW_VERSION := $(shell scripts/get-version HEAD)
brew::
cd pkg && go install -ldflags "-X github.com/pulumi/pulumi/pkg/v3/version.Version=${BREW_VERSION}" ${PROJECT}
lint::
@[ "$(shell cd pkg && golangci-lint run -c ../.golangci.yml --timeout 5m 1>&2; echo $$?)" -eq 0 ] && \
[ "$(shell cd sdk && golangci-lint run -c ../.golangci.yml --timeout 5m 1>&2; echo $$?)" -eq 0 ] && \
[ "$(shell cd tests && golangci-lint run -c ../.golangci.yml --timeout 5m 1>&2; echo $$?)" -eq 0 ]
test_fast:: build
cd pkg && $(GO_TEST_FAST) ${PROJECT_PKGS}
2017-08-06 17:52:32 +02:00
test_build:: $(TEST_ALL_DEPS)
cd tests/testprovider && go build -o pulumi-resource-testprovider
Initial support for remote component construction. (#5280) These changes add initial support for the construction of remote components. For now, this support is limited to the NodeJS SDK; follow-up changes will implement support for the other SDKs. Remote components are component resources that are constructed and managed by plugins rather than by Pulumi programs. In this sense, they are a bit like cloud resources, and are supported by the same distribution and plugin loading mechanisms and described by the same schema system. The construction of a remote component is initiated by a `RegisterResourceRequest` with the new `remote` field set to `true`. When the resource monitor receives such a request, it loads the plugin that implements the component resource and calls the `Construct` method added to the resource provider interface as part of these changes. This method accepts the information necessary to construct the component and its children: the component's name, type, resource options, inputs, and input dependencies. It is responsible for dispatching to the appropriate component factory to create the component, then returning its URN, resolved output properties, and output property dependencies. The dependency information is necessary to support features such as delete-before-replace, which rely on precise dependency information for custom resources. These changes also add initial support for more conveniently implementing resource providers in NodeJS. The interface used to implement such a provider is similar to the dynamic provider interface (and may be unified with that interface in the future). An example of a NodeJS program constructing a remote component resource also implemented in NodeJS can be found in `tests/construct_component/nodejs`. This is the core of #2430.
2020-09-08 04:33:55 +02:00
cd tests/integration/construct_component/testcomponent && yarn install && yarn link @pulumi/pulumi && yarn run tsc
cd tests/integration/construct_component/testcomponent-go && go build -o pulumi-resource-testcomponent
cd tests/integration/construct_component_output_values/testcomponent && yarn install && yarn link @pulumi/pulumi && yarn run tsc
cd tests/integration/construct_component_output_values/testcomponent-go && go build -o pulumi-resource-testcomponent
cd tests/integration/construct_component_slow/testcomponent && yarn install && yarn link @pulumi/pulumi && yarn run tsc
cd tests/integration/construct_component_plain/testcomponent && yarn install && yarn link @pulumi/pulumi && yarn run tsc
cd tests/integration/construct_component_plain/testcomponent-go && go build -o pulumi-resource-testcomponent
cd tests/integration/construct_component_unknown/testcomponent && yarn install && yarn link @pulumi/pulumi && yarn run tsc
cd tests/integration/construct_component_unknown/testcomponent-go && go build -o pulumi-resource-testcomponent
cd tests/integration/component_provider_schema/testcomponent && yarn install && yarn link @pulumi/pulumi && yarn run tsc
cd tests/integration/component_provider_schema/testcomponent-go && go build -o pulumi-resource-testcomponent
cd tests/integration/construct_component_error_apply/testcomponent && yarn install && yarn link @pulumi/pulumi && yarn run tsc
cd tests/integration/construct_component_methods/testcomponent && yarn install && yarn link @pulumi/pulumi && yarn run tsc
cd tests/integration/construct_component_methods/testcomponent-go && go build -o pulumi-resource-testcomponent
cd tests/integration/construct_component_provider/testcomponent && yarn install && yarn link @pulumi/pulumi && yarn run tsc
cd tests/integration/construct_component_provider/testcomponent-go && go build -o pulumi-resource-testcomponent
cd tests/integration/construct_component_methods_unknown/testcomponent && yarn install && yarn link @pulumi/pulumi && yarn run tsc
cd tests/integration/construct_component_methods_unknown/testcomponent-go && go build -o pulumi-resource-testcomponent
cd tests/integration/construct_component_methods_resources/testcomponent && yarn install && yarn link @pulumi/pulumi && yarn run tsc
cd tests/integration/construct_component_methods_resources/testcomponent-go && go build -o pulumi-resource-testcomponent
cd tests/integration/construct_component_methods_errors/testcomponent && yarn install && yarn link @pulumi/pulumi && yarn run tsc
cd tests/integration/construct_component_methods_errors/testcomponent-go && go build -o pulumi-resource-testcomponent
Initial support for remote component construction. (#5280) These changes add initial support for the construction of remote components. For now, this support is limited to the NodeJS SDK; follow-up changes will implement support for the other SDKs. Remote components are component resources that are constructed and managed by plugins rather than by Pulumi programs. In this sense, they are a bit like cloud resources, and are supported by the same distribution and plugin loading mechanisms and described by the same schema system. The construction of a remote component is initiated by a `RegisterResourceRequest` with the new `remote` field set to `true`. When the resource monitor receives such a request, it loads the plugin that implements the component resource and calls the `Construct` method added to the resource provider interface as part of these changes. This method accepts the information necessary to construct the component and its children: the component's name, type, resource options, inputs, and input dependencies. It is responsible for dispatching to the appropriate component factory to create the component, then returning its URN, resolved output properties, and output property dependencies. The dependency information is necessary to support features such as delete-before-replace, which rely on precise dependency information for custom resources. These changes also add initial support for more conveniently implementing resource providers in NodeJS. The interface used to implement such a provider is similar to the dynamic provider interface (and may be unified with that interface in the future). An example of a NodeJS program constructing a remote component resource also implemented in NodeJS can be found in `tests/construct_component/nodejs`. This is the core of #2430.
2020-09-08 04:33:55 +02:00
test_all:: test_build
cd pkg && $(GO_TEST) ${PROJECT_PKGS}
2020-11-12 23:45:06 +01:00
cd tests && $(GO_TEST) -p=1 ${TESTS_PKGS}