Skip to content

Commit aae6381

Browse files
describe provider metadata with infer
1 parent 8d1865e commit aae6381

File tree

12 files changed

+446
-163
lines changed

12 files changed

+446
-163
lines changed

Makefile

Lines changed: 6 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,6 @@ provider: $(WORKING_DIR)/bin/$(PROVIDER)
5353
$(WORKING_DIR)/bin/$(PROVIDER): $(shell find . -name "*.go")
5454
go build -o $(WORKING_DIR)/bin/${PROVIDER} -ldflags "-X ${PROJECT}/${VERSION_PATH}=${VERSION}" $(PROJECT)/${PROVIDER_PATH}/cmd/$(PROVIDER)
5555

56-
schema: ${PROVIDER_PATH}/cmd/$(PROVIDER)/schema.json
57-
${PROVIDER_PATH}/cmd/$(PROVIDER)/schema.json: metadata.json provider
58-
pulumi package get-schema $(WORKING_DIR)/bin/${PROVIDER} > ${PROVIDER_PATH}/cmd/$(PROVIDER)/schema.json
59-
jq -s '.[0] * .[1]' ${PROVIDER_PATH}/cmd/$(PROVIDER)/schema.json metadata.json > ${PROVIDER_PATH}/cmd/$(PROVIDER)/schema.json.tmp
60-
mv ${PROVIDER_PATH}/cmd/$(PROVIDER)/schema.json.tmp ${PROVIDER_PATH}/cmd/$(PROVIDER)/schema.json
61-
6256
.PHONY: provider_debug
6357
provider_debug:
6458
(cd provider && go build -o $(WORKING_DIR)/bin/${PROVIDER} -gcflags="all=-N -l" -ldflags "-X ${PROJECT}/${VERSION_PATH}=${VERSION}" $(PROJECT)/${PROVIDER_PATH}/cmd/$(PROVIDER))
@@ -68,42 +62,37 @@ test_provider:
6862
cd tests && go test -short -v -count=1 -cover -timeout 5m -parallel ${TESTPARALLELISM} ./...
6963

7064
dotnet_sdk: DOTNET_VERSION := $(shell pulumictl get version --language dotnet)
71-
dotnet_sdk: $(WORKING_DIR)/bin/$(PROVIDER) schema
65+
dotnet_sdk: provider
7266
rm -rf sdk/dotnet
7367
pulumi package gen-sdk $(WORKING_DIR)/bin/$(PROVIDER) --language dotnet
7468
cd ${PACKDIR}/dotnet/&& \
7569
echo "${DOTNET_VERSION}" >version.txt && \
7670
dotnet build /p:Version=${DOTNET_VERSION}
7771

7872
.PHONY: go_sdk
79-
go_sdk: $(WORKING_DIR)/bin/$(PROVIDER) schema
73+
go_sdk: provider
8074
rm -rf sdk/go
8175
pulumi package gen-sdk $(WORKING_DIR)/bin/$(PROVIDER) --language go
8276

8377
.PHONY: nodejs_sdk
8478
nodejs_sdk: VERSION := $(shell pulumictl get version --language javascript)
85-
nodejs_sdk: $(WORKING_DIR)/bin/$(PROVIDER) schema
79+
nodejs_sdk: provider
8680
rm -rf sdk/nodejs
8781
pulumi package gen-sdk $(WORKING_DIR)/bin/$(PROVIDER) --language nodejs
8882
cd ${PACKDIR}/nodejs/ && \
89-
sed -i.bak 's/$${VERSION}/$(VERSION)/g' package.json && \
90-
sed -i.bak 's|@pulumi/defang|${NODE_MODULE_NAME}|g' package.json && \
9183
yarn install && \
9284
yarn run tsc && \
93-
cp ../../README.md ../../LICENSE package.json yarn.lock bin/ && \
94-
rm ./package.json.bak
85+
cp ../../README.md ../../LICENSE package.json yarn.lock bin/
9586

9687
.PHONY: python_sdk
9788
python_sdk: PYPI_VERSION := $(shell pulumictl get version --language python)
98-
python_sdk: $(WORKING_DIR)/bin/$(PROVIDER) schema
89+
python_sdk: provider
9990
rm -rf sdk/python
10091
pulumi package gen-sdk $(WORKING_DIR)/bin/$(PROVIDER) --language python
10192
cp README.md ${PACKDIR}/python/
10293
cd ${PACKDIR}/python/ && \
10394
python3 setup.py clean --all 2>/dev/null && \
10495
rm -rf ./bin/ ../python.bin/ && cp -R . ../python.bin && mv ../python.bin ./bin && \
105-
sed -i.bak -e 's/^VERSION = .*/VERSION = "$(PYPI_VERSION)"/g' -e 's/^PLUGIN_VERSION = .*/PLUGIN_VERSION = "$(VERSION)"/g' ./bin/setup.py && \
106-
rm ./bin/setup.py.bak && \
10796
cd ./bin && python3 setup.py build sdist
10897

10998
.PHONY: examples
@@ -112,21 +101,7 @@ examples: go_example \
112101
python_example \
113102
dotnet_example
114103

115-
go_example: clean_go_example
116-
clean_go_example: build_go_example
117-
# intentionally blank
118-
nodejs_example: clean_nodejs_example
119-
clean_nodejs_example: build_nodejs_example
120-
sed -i -e 's|@pulumi/defang|@defang-io/pulumi-defang|' examples/nodejs/package.json examples/nodejs/index.ts
121-
python_example: clean_python_example
122-
clean_python_example: build_python_example
123-
# intentionally blank
124-
dotnet_example: clean_dotnet_example
125-
clean_dotnet_example: build_dotnet_example
126-
# intentionally blank
127-
128-
.PHONY: build_go_example build_nodejs_example build_python_example build_dotnet_example
129-
build_%_example:
104+
%_example:
130105
rm -rf ${WORKING_DIR}/examples/$*
131106
pulumi convert \
132107
--cwd ${WORKING_DIR}/examples/yaml \

examples/dotnet/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using System.Collections.Generic;
22
using System.Linq;
33
using Pulumi;
4-
using Defang = Pulumi.Defang;
4+
using Defang = DefangLabs.Defang;
55

66
return await Deployment.RunAsync(() =>
77
{

examples/dotnet/provider-defang.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
</PropertyGroup>
88
<ItemGroup>
99
<PackageReference Include="Pulumi" Version="3.*" />
10-
<PackageReference Include="Pulumi.Defang" Version="1.1.0-alpha.1741220968+0411d9f3" />
10+
<PackageReference Include="DefangLabs.Defang" Version="1.1.0-alpha.1741714232+8d1865e8" />
1111
</ItemGroup>
1212

1313
</Project>

examples/go/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ go 1.20
44

55
require (
66
github.com/pulumi/pulumi/sdk/v3 v3.30.0
7-
example.com/pulumi-defang/sdk v1.1.0-alpha.1741220968+0411d9f3
7+
github.com/DefangLabs/pulumi-defang/sdk v1.1.0-alpha.1741714232+8d1865e8
88
)

examples/go/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package main
22

33
import (
4-
"example.com/pulumi-defang/sdk/go/defang"
4+
"github.com/DefangLabs/pulumi-defang/sdk/go/defang"
55
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
66
)
77

examples/nodejs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66
"dependencies": {
77
"typescript": "^4.0.0",
88
"@pulumi/pulumi": "^3.0.0",
9-
"@defang-io/pulumi-defang": "1.1.0-alpha.1741220968+0411d9f3"
9+
"@defang-io/pulumi-defang": "1.1.0-alpha.1741714232+8d1865e8"
1010
}
1111
}

examples/python/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
pulumi-defang==1.1.0-alpha.1741220968+0411d9f3
1+
pulumi-defang==1.1.0-alpha.1741714232+8d1865e8
22
pulumi>=3.0.0,<4.0.0

go.mod

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@ require (
66
github.com/DefangLabs/defang/src v0.0.0-20250311052902-1d12330e66fe
77
github.com/blang/semver v3.5.1+incompatible
88
github.com/pulumi/pulumi-go-provider v0.24.1
9-
github.com/pulumi/pulumi-random/sdk/v4 v4.17.0
10-
github.com/pulumi/pulumi/sdk/v3 v3.150.0
9+
github.com/pulumi/pulumi/pkg/v3 v3.154.0
10+
github.com/pulumi/pulumi/sdk/v3 v3.154.0
1111
github.com/stretchr/testify v1.10.0
12+
google.golang.org/protobuf v1.35.1
1213
)
1314

1415
require (
@@ -79,6 +80,7 @@ require (
7980
github.com/containerd/console v1.0.4-0.20230313162750-1ae8d489ac81 // indirect
8081
github.com/cyphar/filepath-securejoin v0.3.6 // indirect
8182
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
83+
github.com/deckarep/golang-set/v2 v2.5.0 // indirect
8284
github.com/digitalocean/godo v1.131.1 // indirect
8385
github.com/distribution/reference v0.5.0 // indirect
8486
github.com/djherbis/times v1.5.0 // indirect
@@ -112,6 +114,7 @@ require (
112114
github.com/hashicorp/go-multierror v1.1.1 // indirect
113115
github.com/hashicorp/go-retryablehttp v0.7.7 // indirect
114116
github.com/hashicorp/hcl/v2 v2.22.0 // indirect
117+
github.com/iancoleman/strcase v0.3.0 // indirect
115118
github.com/inconshreveable/mousetrap v1.1.0 // indirect
116119
github.com/inhies/go-bytesize v0.0.0-20220417184213-4913239db9cf // indirect
117120
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
@@ -148,7 +151,7 @@ require (
148151
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
149152
github.com/pulumi/appdash v0.0.0-20231130102222-75f619a67231 // indirect
150153
github.com/pulumi/esc v0.10.0 // indirect
151-
github.com/pulumi/pulumi/pkg/v3 v3.142.0 // indirect
154+
github.com/pulumi/inflector v0.1.1 // indirect
152155
github.com/rivo/uniseg v0.4.4 // indirect
153156
github.com/rogpeppe/go-internal v1.12.0 // indirect
154157
github.com/ross96D/cancelreader v0.2.6 // indirect
@@ -159,6 +162,7 @@ require (
159162
github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 // indirect
160163
github.com/sirupsen/logrus v1.9.3 // indirect
161164
github.com/skeema/knownhosts v1.3.0 // indirect
165+
github.com/spf13/afero v1.10.0 // indirect
162166
github.com/spf13/cobra v1.8.0 // indirect
163167
github.com/spf13/pflag v1.0.5 // indirect
164168
github.com/texttheater/golang-levenshtein v1.0.1 // indirect
@@ -196,7 +200,6 @@ require (
196200
google.golang.org/genproto/googleapis/rpc v0.0.0-20241021214115-324edc3d5d38 // indirect
197201
google.golang.org/grpc v1.68.0 // indirect
198202
google.golang.org/grpc/stats/opentelemetry v0.0.0-20240907200651-3ffb98b2c93a // indirect
199-
google.golang.org/protobuf v1.35.1 // indirect
200203
gopkg.in/ini.v1 v1.66.2 // indirect
201204
gopkg.in/warnings.v0 v0.1.2 // indirect
202205
gopkg.in/yaml.v3 v3.0.1 // indirect

0 commit comments

Comments
 (0)