From e62b0988476875a3da486460537e7f0d04594047 Mon Sep 17 00:00:00 2001 From: Kat Morgan Date: Mon, 13 Nov 2023 21:35:06 -0800 Subject: [PATCH 01/22] add example code coverage support --- .devcontainer | 1 + .gitmodules | 3 +++ Makefile | 39 +++++++++++++++++++++++++++++++++++++-- examples/yaml/Pulumi.yaml | 16 ++++++++++++++++ 4 files changed, 57 insertions(+), 2 deletions(-) create mode 160000 .devcontainer create mode 100644 .gitmodules create mode 100644 examples/yaml/Pulumi.yaml diff --git a/.devcontainer b/.devcontainer new file mode 160000 index 0000000..95a001f --- /dev/null +++ b/.devcontainer @@ -0,0 +1 @@ +Subproject commit 95a001fc7005b4389068edde1cdd64e518945a44 diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..caa22b6 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule ".devcontainer"] + path = .devcontainer + url = https://github.com/pulumi/devcontainer diff --git a/Makefile b/Makefile index c82fc8b..c5327a9 100644 --- a/Makefile +++ b/Makefile @@ -65,7 +65,44 @@ python_sdk:: rm ./bin/setup.py.bak && \ cd ./bin && python3 setup.py build sdist +gen_examples:: + cd ${WORKING_DIR}/examples/yaml && \ + rm -rf ${WORKING_DIR}/examples/{go,nodejs,python,dotnet} && \ + cd ${WORKING_DIR}/examples/yaml && pulumi convert --logtostderr --generate-only --non-interactive --language go --out ${WORKING_DIR}/examples/go 2>&1 && \ + cd ${WORKING_DIR}/examples/yaml && pulumi convert --logtostderr --generate-only --non-interactive --language nodejs --out ${WORKING_DIR}/examples/nodejs 2>&1 && \ + cd ${WORKING_DIR}/examples/yaml && pulumi convert --logtostderr --generate-only --non-interactive --language python --out ${WORKING_DIR}/examples/python 2>&1 && \ + cd ${WORKING_DIR}/examples/yaml && pulumi convert --logtostderr --generate-only --non-interactive --language dotnet --out ${WORKING_DIR}/examples/dotnet 2>&1 + +pulumi_login:: + export PULUMI_CONFIG_PASSPHRASE="asdfqwerty1234" && \ + pulumi login + +pulumi_up:: + cd ${WORKING_DIR}/examples/yaml && \ + pulumi stack init dev && \ + pulumi stack select dev && \ + pulumi config set name dev && \ + pulumi up -y + +pulumi_down:: + cd ${WORKING_DIR}/examples/yaml && \ + pulumi destroy -y && \ + pulumi stack select dev && \ + pulumi stack rm dev -y + +devcontainer:: + git submodule update --init --recursive .devcontainer && \ + git submodule update --remote --merge .devcontainer && \ + cp -f .devcontainer/devcontainer.json .devcontainer.json + .PHONY: build + +up:: pulumi_login pulumi_up + +down:: pulumi_login pulumi_down + +deploy:: pulumi_login pulumi_up pulumi_down + build:: provider dotnet_sdk go_sdk nodejs_sdk python_sdk # Required for the codegen action that runs in pulumi/pulumi @@ -76,11 +113,9 @@ lint:: pushd $$DIR && golangci-lint run -c ../.golangci.yml --timeout 10m && popd ; \ done - install:: install_nodejs_sdk install_dotnet_sdk cp $(WORKING_DIR)/bin/${PROVIDER} ${GOPATH}/bin - GO_TEST := go test -v -count=1 -cover -timeout 2h -parallel ${TESTPARALLELISM} test_all:: test_provider diff --git a/examples/yaml/Pulumi.yaml b/examples/yaml/Pulumi.yaml new file mode 100644 index 0000000..e28c728 --- /dev/null +++ b/examples/yaml/Pulumi.yaml @@ -0,0 +1,16 @@ +name: provider-xyz-native +runtime: yaml +plugins: + providers: + - name: xyz + path: ../../bin # Adjust this path to point to your xyz provider binary + +resources: + myRandomResource: + type: xyz:Random + properties: + length: 24 + +outputs: + output: + value: ${myRandomResource.result} \ No newline at end of file From fb335e2156e7a7581933273855ffec1730f65333 Mon Sep 17 00:00:00 2001 From: Kat Morgan Date: Mon, 13 Nov 2023 21:36:09 -0800 Subject: [PATCH 02/22] make generate all language example code --- .devcontainer.json | 62 ++++ examples/dotnet/.gitignore | 353 +++++++++++++++++++ examples/dotnet/Program.cs | 21 ++ examples/dotnet/Pulumi.yaml | 6 + examples/dotnet/provider-xyz-native.csproj | 14 + examples/go/Pulumi.yaml | 6 + examples/go/go.mod | 7 + examples/go/main.go | 21 ++ examples/nodejs/.gitignore | 2 + examples/nodejs/Pulumi.yaml | 6 + examples/nodejs/index.ts | 7 + examples/nodejs/package.json | 11 + examples/nodejs/tsconfig.json | 18 + examples/python/.gitignore | 2 + examples/python/Pulumi.yaml | 6 + examples/python/__main__.py | 7 + examples/python/requirements.txt | 2 + examples/simple/Pulumi.yaml | 3 - examples/simple/index.ts | 5 - examples/simple/package.json | 10 - provider/go.mod | 6 +- sdk/dotnet/Pulumi.Xyz.csproj | 7 +- sdk/dotnet/version.txt | 2 +- sdk/go/xyz/init.go | 8 +- sdk/go/xyz/{ => internal}/pulumiUtilities.go | 44 ++- sdk/go/xyz/internal/pulumiVersion.go | 11 + sdk/go/xyz/provider.go | 4 +- sdk/go/xyz/random.go | 6 +- sdk/nodejs/index.ts | 2 +- sdk/nodejs/package.json | 3 +- sdk/nodejs/provider.ts | 4 +- sdk/nodejs/random.ts | 2 +- sdk/nodejs/scripts/install-pulumi-plugin.js | 26 -- sdk/nodejs/utilities.ts | 2 +- sdk/python/README.md | 118 +------ sdk/python/pulumi_xyz/__init__.py | 2 +- sdk/python/pulumi_xyz/_utilities.py | 2 +- sdk/python/pulumi_xyz/provider.py | 2 +- sdk/python/pulumi_xyz/random.py | 2 +- sdk/python/setup.py | 26 +- tests/go.mod | 2 +- 41 files changed, 639 insertions(+), 211 deletions(-) create mode 100644 .devcontainer.json create mode 100644 examples/dotnet/.gitignore create mode 100644 examples/dotnet/Program.cs create mode 100644 examples/dotnet/Pulumi.yaml create mode 100644 examples/dotnet/provider-xyz-native.csproj create mode 100644 examples/go/Pulumi.yaml create mode 100644 examples/go/go.mod create mode 100644 examples/go/main.go create mode 100644 examples/nodejs/.gitignore create mode 100644 examples/nodejs/Pulumi.yaml create mode 100644 examples/nodejs/index.ts create mode 100644 examples/nodejs/package.json create mode 100644 examples/nodejs/tsconfig.json create mode 100644 examples/python/.gitignore create mode 100644 examples/python/Pulumi.yaml create mode 100644 examples/python/__main__.py create mode 100644 examples/python/requirements.txt delete mode 100644 examples/simple/Pulumi.yaml delete mode 100644 examples/simple/index.ts delete mode 100644 examples/simple/package.json rename sdk/go/xyz/{ => internal}/pulumiUtilities.go (56%) create mode 100644 sdk/go/xyz/internal/pulumiVersion.go delete mode 100644 sdk/nodejs/scripts/install-pulumi-plugin.js diff --git a/.devcontainer.json b/.devcontainer.json new file mode 100644 index 0000000..91070b1 --- /dev/null +++ b/.devcontainer.json @@ -0,0 +1,62 @@ +// Reference: +// - https://containers.dev/features +// - https://containers.dev/implementors/features +// - https://code.visualstudio.com/docs/getstarted/settings +{ + // NOTE: remove `image` and uncomment `build` to build the image locally + //"build": { + // "dockerfile": "Dockerfile", + // "context": "." + //}, + "name": "pulumi", + "image": "ghcr.io/pulumi/devcontainer", + "settings": { + "terminal.integrated.shell.linux": "/usr/bin/zsh" + }, + "customizations": { + "vscode": { + "settings": [ + "go.testTags", "all", + "go.buildTags", "all", + "editor.minimap.enabled", false, + "explorer.openEditors.visible", 1, + "editor.quickSuggestionsDelay", 0, + "editor.suggestSelection", "first", + "editor.snippetSuggestions", "top", + "editor.gotoLocation.multipleReferences", "goto", + "editor.gotoLocation.multipleDefinitions", "goto", + "editor.gotoLocation.multipleDeclarations", "goto", + "editor.gotoLocation.multipleImplementations", "goto", + "editor.gotoLocation.multipleTypeDefinitions", "goto", + "files.trimTrailingWhitespace", true, + "files.trimFinalNewlines", true + ], + "extensions": [ + "golang.go", + "vscodevim.vim", + "github.copilot", + "ms-python.python", + "jetpack-io.devbox", + "redhat.vscode-yaml", + "esbenp.prettier-vscode", + "ms-vscode.makefile-tools", + "ms-azuretools.vscode-docker", + "github.vscode-pull-request-github", + "ms-vscode-remote.remote-containers", + "visualstudioexptteam.vscodeintellicode", + "bierner.markdown-preview-github-styles" + ] + } + }, + "features": { + "ghcr.io/devcontainers/features/common-utils:2": {}, + "ghcr.io/devcontainers/features/docker-outside-of-docker:1": { + "version": "latest", + "installDockerBuildx": true, + "moby": false + } + }, + "postCreateCommand": "git submodule update --init --recursive", + "remoteUser": "vscode", + "runArgs": ["--network=host"] +} diff --git a/examples/dotnet/.gitignore b/examples/dotnet/.gitignore new file mode 100644 index 0000000..e645270 --- /dev/null +++ b/examples/dotnet/.gitignore @@ -0,0 +1,353 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore + +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Mono auto generated files +mono_crash.* + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ +[Ll]ogs/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUnit +*.VisualState.xml +TestResult.xml +nunit-*.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# JustCode is a .NET coding add-in +.JustCode + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# NuGet Symbol Packages +*.snupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx +*.appxbundle +*.appxupload + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser +*- [Bb]ackup.rdl +*- [Bb]ackup ([0-9]).rdl +*- [Bb]ackup ([0-9][0-9]).rdl + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + +# BeatPulse healthcheck temp database +healthchecksdb + +# Backup folder for Package Reference Convert tool in Visual Studio 2017 +MigrationBackup/ + +# Ionide (cross platform F# VS Code tools) working folder +.ionide/ diff --git a/examples/dotnet/Program.cs b/examples/dotnet/Program.cs new file mode 100644 index 0000000..3b7565d --- /dev/null +++ b/examples/dotnet/Program.cs @@ -0,0 +1,21 @@ +using System.Collections.Generic; +using System.Linq; +using Pulumi; +using Xyz = Pulumi.Xyz; + +return await Deployment.RunAsync(() => +{ + var myRandomResource = new Xyz.Random("myRandomResource", new() + { + Length = 24, + }); + + return new Dictionary + { + ["output"] = + { + { "value", myRandomResource.Result }, + }, + }; +}); + diff --git a/examples/dotnet/Pulumi.yaml b/examples/dotnet/Pulumi.yaml new file mode 100644 index 0000000..11dee29 --- /dev/null +++ b/examples/dotnet/Pulumi.yaml @@ -0,0 +1,6 @@ +name: provider-xyz-native +runtime: dotnet +plugins: + providers: + - name: xyz + path: ../../bin # Adjust this path to point to your xyz provider binary diff --git a/examples/dotnet/provider-xyz-native.csproj b/examples/dotnet/provider-xyz-native.csproj new file mode 100644 index 0000000..2f3773a --- /dev/null +++ b/examples/dotnet/provider-xyz-native.csproj @@ -0,0 +1,14 @@ + + + + Exe + net6.0 + enable + + + + + + + + \ No newline at end of file diff --git a/examples/go/Pulumi.yaml b/examples/go/Pulumi.yaml new file mode 100644 index 0000000..66f6183 --- /dev/null +++ b/examples/go/Pulumi.yaml @@ -0,0 +1,6 @@ +name: provider-xyz-native +runtime: go +plugins: + providers: + - name: xyz + path: ../../bin diff --git a/examples/go/go.mod b/examples/go/go.mod new file mode 100644 index 0000000..723aae8 --- /dev/null +++ b/examples/go/go.mod @@ -0,0 +1,7 @@ +module provider-xyz-native + +go 1.20 + +require ( + github.com/pulumi/pulumi/sdk/v3 v3.30.0 +) \ No newline at end of file diff --git a/examples/go/main.go b/examples/go/main.go new file mode 100644 index 0000000..8833de4 --- /dev/null +++ b/examples/go/main.go @@ -0,0 +1,21 @@ +package main + +import ( + "github.com/pulumi/pulumi-xyz/sdk/go/xyz" + "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +) + +func main() { + pulumi.Run(func(ctx *pulumi.Context) error { + myRandomResource, err := xyz.NewRandom(ctx, "myRandomResource", &xyz.RandomArgs{ + Length: pulumi.Int(24), + }) + if err != nil { + return err + } + ctx.Export("output", map[string]interface{}{ + "value": myRandomResource.Result, + }) + return nil + }) +} diff --git a/examples/nodejs/.gitignore b/examples/nodejs/.gitignore new file mode 100644 index 0000000..dc902b5 --- /dev/null +++ b/examples/nodejs/.gitignore @@ -0,0 +1,2 @@ +/bin/ +/node_modules/ \ No newline at end of file diff --git a/examples/nodejs/Pulumi.yaml b/examples/nodejs/Pulumi.yaml new file mode 100644 index 0000000..901c000 --- /dev/null +++ b/examples/nodejs/Pulumi.yaml @@ -0,0 +1,6 @@ +name: provider-xyz-native +runtime: nodejs +plugins: + providers: + - name: xyz + path: ../../bin diff --git a/examples/nodejs/index.ts b/examples/nodejs/index.ts new file mode 100644 index 0000000..4fc98a8 --- /dev/null +++ b/examples/nodejs/index.ts @@ -0,0 +1,7 @@ +import * as pulumi from "@pulumi/pulumi"; +import * as xyz from "@pulumi/xyz"; + +const myRandomResource = new xyz.Random("myRandomResource", {length: 24}); +export const output = { + value: myRandomResource.result, +}; diff --git a/examples/nodejs/package.json b/examples/nodejs/package.json new file mode 100644 index 0000000..f778a81 --- /dev/null +++ b/examples/nodejs/package.json @@ -0,0 +1,11 @@ +{ + "name": "provider-xyz-native", + "devDependencies": { + "@types/node": "^14" + }, + "dependencies": { + "typescript": "^4.0.0", + "@pulumi/pulumi": "^3.0.0", + "@pulumi/xyz": "0.0.1-alpha.1697100443+869a6651.dirty" + } +} \ No newline at end of file diff --git a/examples/nodejs/tsconfig.json b/examples/nodejs/tsconfig.json new file mode 100644 index 0000000..11fc69a --- /dev/null +++ b/examples/nodejs/tsconfig.json @@ -0,0 +1,18 @@ +{ + "compilerOptions": { + "strict": true, + "outDir": "bin", + "target": "es2016", + "module": "commonjs", + "moduleResolution": "node", + "sourceMap": true, + "experimentalDecorators": true, + "pretty": true, + "noFallthroughCasesInSwitch": true, + "noImplicitReturns": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.ts", + ] +} \ No newline at end of file diff --git a/examples/python/.gitignore b/examples/python/.gitignore new file mode 100644 index 0000000..b664ab4 --- /dev/null +++ b/examples/python/.gitignore @@ -0,0 +1,2 @@ +*.pyc +venv/ \ No newline at end of file diff --git a/examples/python/Pulumi.yaml b/examples/python/Pulumi.yaml new file mode 100644 index 0000000..074e6c2 --- /dev/null +++ b/examples/python/Pulumi.yaml @@ -0,0 +1,6 @@ +name: provider-xyz-native +runtime: python +plugins: + providers: + - name: xyz + path: ../../bin diff --git a/examples/python/__main__.py b/examples/python/__main__.py new file mode 100644 index 0000000..880fc71 --- /dev/null +++ b/examples/python/__main__.py @@ -0,0 +1,7 @@ +import pulumi +import pulumi_xyz as xyz + +my_random_resource = xyz.Random("myRandomResource", length=24) +pulumi.export("output", { + "value": my_random_resource.result, +}) diff --git a/examples/python/requirements.txt b/examples/python/requirements.txt new file mode 100644 index 0000000..0d5229d --- /dev/null +++ b/examples/python/requirements.txt @@ -0,0 +1,2 @@ +pulumi>=3.0.0,<4.0.0 +pulumi-xyz==0.0.1-alpha.1697100443+869a6651.dirty diff --git a/examples/simple/Pulumi.yaml b/examples/simple/Pulumi.yaml deleted file mode 100644 index 4aec8e8..0000000 --- a/examples/simple/Pulumi.yaml +++ /dev/null @@ -1,3 +0,0 @@ -name: simple -runtime: nodejs -description: A simple xyz example diff --git a/examples/simple/index.ts b/examples/simple/index.ts deleted file mode 100644 index 9a62eb3..0000000 --- a/examples/simple/index.ts +++ /dev/null @@ -1,5 +0,0 @@ -import * as xyz from "@pulumi/xyz"; - -const random = new xyz.Random("my-random", { length: 24 }); - -export const output = random.result; \ No newline at end of file diff --git a/examples/simple/package.json b/examples/simple/package.json deleted file mode 100644 index 455f049..0000000 --- a/examples/simple/package.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "name": "xyz-typescript", - "version": "0.1.0", - "devDependencies": { - "@types/node": "latest" - }, - "dependencies": { - "@pulumi/pulumi": "latest" - } -} diff --git a/provider/go.mod b/provider/go.mod index 1686dab..41334da 100644 --- a/provider/go.mod +++ b/provider/go.mod @@ -2,7 +2,10 @@ module github.com/pulumi/pulumi-xyz/provider go 1.21 -require github.com/pulumi/pulumi-go-provider v0.11.1 +require ( + github.com/pulumi/pulumi-go-provider v0.11.1 + github.com/pulumi/pulumi/sdk/v3 v3.79.0 +) require ( dario.cat/mergo v1.0.0 // indirect @@ -44,7 +47,6 @@ require ( github.com/pkg/errors v0.9.1 // indirect github.com/pkg/term v1.1.0 // indirect github.com/pulumi/pulumi/pkg/v3 v3.79.0 // indirect - github.com/pulumi/pulumi/sdk/v3 v3.79.0 // indirect github.com/rivo/uniseg v0.4.4 // indirect github.com/rogpeppe/go-internal v1.11.0 // indirect github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06 // indirect diff --git a/sdk/dotnet/Pulumi.Xyz.csproj b/sdk/dotnet/Pulumi.Xyz.csproj index c4ef888..7095d2e 100644 --- a/sdk/dotnet/Pulumi.Xyz.csproj +++ b/sdk/dotnet/Pulumi.Xyz.csproj @@ -10,9 +10,8 @@ logo.png - netcoreapp3.1 + net6.0 enable - false @@ -39,13 +38,13 @@ - + - + diff --git a/sdk/dotnet/version.txt b/sdk/dotnet/version.txt index bf7af00..07ae644 100644 --- a/sdk/dotnet/version.txt +++ b/sdk/dotnet/version.txt @@ -1 +1 @@ -0.0.1-alpha.1670615019+ffcf0ad3 +0.0.1-alpha.1697100443+869a6651.dirty diff --git a/sdk/go/xyz/init.go b/sdk/go/xyz/init.go index 7fbf94d..dca5cdf 100644 --- a/sdk/go/xyz/init.go +++ b/sdk/go/xyz/init.go @@ -1,4 +1,4 @@ -// Code generated by pulumi DO NOT EDIT. +// Code generated by pulumi-language-go DO NOT EDIT. // *** WARNING: Do not edit by hand unless you're certain you know what you are doing! *** package xyz @@ -8,6 +8,7 @@ import ( "github.com/blang/semver" "github.com/pulumi/pulumi/sdk/v3/go/pulumi" + "internal" ) type module struct { @@ -49,7 +50,10 @@ func (p *pkg) ConstructProvider(ctx *pulumi.Context, name, typ, urn string) (pul } func init() { - version, _ := PkgVersion() + version, err := internal.PkgVersion() + if err != nil { + version = semver.Version{Major: 1} + } pulumi.RegisterResourceModule( "xyz", "index", diff --git a/sdk/go/xyz/pulumiUtilities.go b/sdk/go/xyz/internal/pulumiUtilities.go similarity index 56% rename from sdk/go/xyz/pulumiUtilities.go rename to sdk/go/xyz/internal/pulumiUtilities.go index 163f7cd..be958d6 100644 --- a/sdk/go/xyz/pulumiUtilities.go +++ b/sdk/go/xyz/internal/pulumiUtilities.go @@ -1,7 +1,7 @@ -// Code generated by pulumi DO NOT EDIT. +// Code generated by pulumi-language-go DO NOT EDIT. // *** WARNING: Do not edit by hand unless you're certain you know what you are doing! *** -package xyz +package internal import ( "fmt" @@ -17,7 +17,7 @@ import ( type envParser func(v string) interface{} -func parseEnvBool(v string) interface{} { +func ParseEnvBool(v string) interface{} { b, err := strconv.ParseBool(v) if err != nil { return nil @@ -25,7 +25,7 @@ func parseEnvBool(v string) interface{} { return b } -func parseEnvInt(v string) interface{} { +func ParseEnvInt(v string) interface{} { i, err := strconv.ParseInt(v, 0, 0) if err != nil { return nil @@ -33,7 +33,7 @@ func parseEnvInt(v string) interface{} { return int(i) } -func parseEnvFloat(v string) interface{} { +func ParseEnvFloat(v string) interface{} { f, err := strconv.ParseFloat(v, 64) if err != nil { return nil @@ -41,7 +41,7 @@ func parseEnvFloat(v string) interface{} { return f } -func parseEnvStringArray(v string) interface{} { +func ParseEnvStringArray(v string) interface{} { var result pulumi.StringArray for _, item := range strings.Split(v, ";") { result = append(result, pulumi.String(item)) @@ -49,9 +49,9 @@ func parseEnvStringArray(v string) interface{} { return result } -func getEnvOrDefault(def interface{}, parser envParser, vars ...string) interface{} { +func GetEnvOrDefault(def interface{}, parser envParser, vars ...string) interface{} { for _, v := range vars { - if value := os.Getenv(v); value != "" { + if value, ok := os.LookupEnv(v); ok { if parser != nil { return parser(value) } @@ -65,6 +65,10 @@ func getEnvOrDefault(def interface{}, parser envParser, vars ...string) interfac // If a version cannot be determined, v1 will be assumed. The second return // value is always nil. func PkgVersion() (semver.Version, error) { + // emptyVersion defaults to v0.0.0 + if !SdkVersion.Equals(semver.Version{}) { + return SdkVersion, nil + } type sentinal struct{} pkgPath := reflect.TypeOf(sentinal{}).PkgPath() re := regexp.MustCompile("^.*/pulumi-xyz/sdk(/v\\d+)?") @@ -79,9 +83,31 @@ func PkgVersion() (semver.Version, error) { } // isZero is a null safe check for if a value is it's types zero value. -func isZero(v interface{}) bool { +func IsZero(v interface{}) bool { if v == nil { return true } return reflect.ValueOf(v).IsZero() } + +// PkgResourceDefaultOpts provides package level defaults to pulumi.OptionResource. +func PkgResourceDefaultOpts(opts []pulumi.ResourceOption) []pulumi.ResourceOption { + defaults := []pulumi.ResourceOption{} + + version := SdkVersion + if !version.Equals(semver.Version{}) { + defaults = append(defaults, pulumi.Version(version.String())) + } + return append(defaults, opts...) +} + +// PkgInvokeDefaultOpts provides package level defaults to pulumi.OptionInvoke. +func PkgInvokeDefaultOpts(opts []pulumi.InvokeOption) []pulumi.InvokeOption { + defaults := []pulumi.InvokeOption{} + + version := SdkVersion + if !version.Equals(semver.Version{}) { + defaults = append(defaults, pulumi.Version(version.String())) + } + return append(defaults, opts...) +} diff --git a/sdk/go/xyz/internal/pulumiVersion.go b/sdk/go/xyz/internal/pulumiVersion.go new file mode 100644 index 0000000..4ad7cb8 --- /dev/null +++ b/sdk/go/xyz/internal/pulumiVersion.go @@ -0,0 +1,11 @@ +// Code generated by pulumi-language-go DO NOT EDIT. +// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! *** + +package internal + +import ( + "github.com/blang/semver" +) + +var SdkVersion semver.Version = semver.Version{} +var pluginDownloadURL string = "" diff --git a/sdk/go/xyz/provider.go b/sdk/go/xyz/provider.go index 6c74cef..10557b4 100644 --- a/sdk/go/xyz/provider.go +++ b/sdk/go/xyz/provider.go @@ -1,4 +1,4 @@ -// Code generated by pulumi DO NOT EDIT. +// Code generated by pulumi-language-go DO NOT EDIT. // *** WARNING: Do not edit by hand unless you're certain you know what you are doing! *** package xyz @@ -8,6 +8,7 @@ import ( "reflect" "github.com/pulumi/pulumi/sdk/v3/go/pulumi" + "internal" ) type Provider struct { @@ -21,6 +22,7 @@ func NewProvider(ctx *pulumi.Context, args = &ProviderArgs{} } + opts = internal.PkgResourceDefaultOpts(opts) var resource Provider err := ctx.RegisterResource("pulumi:providers:xyz", name, args, &resource, opts...) if err != nil { diff --git a/sdk/go/xyz/random.go b/sdk/go/xyz/random.go index 8c0b00e..c7d9130 100644 --- a/sdk/go/xyz/random.go +++ b/sdk/go/xyz/random.go @@ -1,4 +1,4 @@ -// Code generated by pulumi DO NOT EDIT. +// Code generated by pulumi-language-go DO NOT EDIT. // *** WARNING: Do not edit by hand unless you're certain you know what you are doing! *** package xyz @@ -7,8 +7,9 @@ import ( "context" "reflect" - "github.com/pkg/errors" + "errors" "github.com/pulumi/pulumi/sdk/v3/go/pulumi" + "internal" ) type Random struct { @@ -28,6 +29,7 @@ func NewRandom(ctx *pulumi.Context, if args.Length == nil { return nil, errors.New("invalid value for required argument 'Length'") } + opts = internal.PkgResourceDefaultOpts(opts) var resource Random err := ctx.RegisterResource("xyz:index:Random", name, args, &resource, opts...) if err != nil { diff --git a/sdk/nodejs/index.ts b/sdk/nodejs/index.ts index 6bdaf58..db72e0d 100644 --- a/sdk/nodejs/index.ts +++ b/sdk/nodejs/index.ts @@ -1,4 +1,4 @@ -// *** WARNING: this file was generated by pulumi. *** +// *** WARNING: this file was generated by pulumi-language-nodejs. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** import * as pulumi from "@pulumi/pulumi"; diff --git a/sdk/nodejs/package.json b/sdk/nodejs/package.json index 7d4df8e..ab20a8c 100644 --- a/sdk/nodejs/package.json +++ b/sdk/nodejs/package.json @@ -2,8 +2,7 @@ "name": "@pulumi/xyz", "version": "${VERSION}", "scripts": { - "build": "tsc", - "install": "node scripts/install-pulumi-plugin.js resource xyz ${VERSION}" + "build": "tsc" }, "dependencies": { "@pulumi/pulumi": "^3.42.0" diff --git a/sdk/nodejs/provider.ts b/sdk/nodejs/provider.ts index 38c4ba6..f914268 100644 --- a/sdk/nodejs/provider.ts +++ b/sdk/nodejs/provider.ts @@ -1,4 +1,4 @@ -// *** WARNING: this file was generated by pulumi. *** +// *** WARNING: this file was generated by pulumi-language-nodejs. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** import * as pulumi from "@pulumi/pulumi"; @@ -16,7 +16,7 @@ export class Provider extends pulumi.ProviderResource { if (obj === undefined || obj === null) { return false; } - return obj['__pulumiType'] === Provider.__pulumiType; + return obj['__pulumiType'] === "pulumi:providers:" + Provider.__pulumiType; } diff --git a/sdk/nodejs/random.ts b/sdk/nodejs/random.ts index 7a4d40d..e2bc017 100644 --- a/sdk/nodejs/random.ts +++ b/sdk/nodejs/random.ts @@ -1,4 +1,4 @@ -// *** WARNING: this file was generated by pulumi. *** +// *** WARNING: this file was generated by pulumi-language-nodejs. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** import * as pulumi from "@pulumi/pulumi"; diff --git a/sdk/nodejs/scripts/install-pulumi-plugin.js b/sdk/nodejs/scripts/install-pulumi-plugin.js deleted file mode 100644 index fefc6e0..0000000 --- a/sdk/nodejs/scripts/install-pulumi-plugin.js +++ /dev/null @@ -1,26 +0,0 @@ -"use strict"; -var childProcess = require("child_process"); - -var args = process.argv.slice(2); - -if (args.indexOf("${VERSION}") !== -1) { - process.exit(0); -} - -var res = childProcess.spawnSync("pulumi", ["plugin", "install"].concat(args), { - stdio: ["ignore", "inherit", "inherit"] -}); - -if (res.error && res.error.code === "ENOENT") { - console.error("\nThere was an error installing the resource provider plugin. " + - "It looks like `pulumi` is not installed on your system. " + - "Please visit https://pulumi.com/ to install the Pulumi CLI.\n" + - "You may try manually installing the plugin by running " + - "`pulumi plugin install " + args.join(" ") + "`"); -} else if (res.error || res.status !== 0) { - console.error("\nThere was an error installing the resource provider plugin. " + - "You may try to manually installing the plugin by running " + - "`pulumi plugin install " + args.join(" ") + "`"); -} - -process.exit(0); diff --git a/sdk/nodejs/utilities.ts b/sdk/nodejs/utilities.ts index 652bf69..0fcb777 100644 --- a/sdk/nodejs/utilities.ts +++ b/sdk/nodejs/utilities.ts @@ -1,4 +1,4 @@ -// *** WARNING: this file was generated by pulumi. *** +// *** WARNING: this file was generated by pulumi-language-nodejs. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** diff --git a/sdk/python/README.md b/sdk/python/README.md index 643bb75..3dec72e 100644 --- a/sdk/python/README.md +++ b/sdk/python/README.md @@ -2,28 +2,8 @@ This repository is a boilerplate showing how to create a native Pulumi provider. -### Background - -This repository is part of the [guide for authoring and publishing a Pulumi Package](https://www.pulumi.com/docs/guides/pulumi-packages/how-to-author). - -Learn about the concepts behind [Pulumi Packages](https://www.pulumi.com/docs/guides/pulumi-packages/#pulumi-packages). - -Follow this link to see [an architecture diagram for Pulumi](https://www.pulumi.com/docs/intro/concepts/how-pulumi-works/#how-pulumi-works). - -A Pulumi Resource Provider: -- is a gRPC server which allows for the Pulumi engine to create resources in a specific cloud -- holds the lifecycle logic for these cloud resources -- holds a pulumi JSON schema that describes the provider -- provides language-specific SDKs so resources can be created in whichever language you prefer - -When we speak of a "native" provider, we mean that all implementation is native to Pulumi, as opposed -to [Terraform based providers](https://github.com/pulumi/pulumi-tf-provider-boilerplate). - ## Authoring a Pulumi Native Provider -The following instructions assume that the provider is written for the Pulumi organisation. -In the future, we will add instruction for providers published and maintained by the Pulumi community, referred to as "third-party" providers. - This boilerplate creates a working Pulumi-owned provider named `xyz`. It implements a random number generator that you can [build and test out for yourself](#test-against-the-example) and then replace the Random code with code specific to your provider. @@ -33,7 +13,7 @@ It implements a random number generator that you can [build and test out for you Ensure the following tools are installed and present in your `$PATH`: * [`pulumictl`](https://github.com/pulumi/pulumictl#installation) -* [Go 1.17](https://golang.org/dl/) or 1.latest +* [Go 1.21](https://golang.org/dl/) or 1.latest * [NodeJS](https://nodejs.org/en/) 14.x. We recommend using [nvm](https://github.com/nvm-sh/nvm) to manage NodeJS installations. * [Yarn](https://yarnpkg.com/) * [TypeScript](https://www.typescriptlang.org/) @@ -87,92 +67,16 @@ Now that you have completed all of the above steps, you have a working provider You now have: 1. A `provider/` folder containing the building and implementation logic - 1. `cmd/` - 1. `pulumi-gen-xyz/` - generates language SDKs from the schema - 2. `pulumi-resource-xyz/` - holds the package schema, injects the package version, and starts the gRPC server - 2. `pkg` - 1. `provider` - holds the gRPC methods (and for now, the sample implementation logic) required by the Pulumi engine - 2. `version` - semver package to be consumed by build processes + 1. `cmd/pulumi-resource-xyz/main.go` - holds the provider's sample implementation logic. 2. `deployment-templates` - a set of files to help you around deployment and publication 3. `sdk` - holds the generated code libraries created by `pulumi-gen-xyz/main.go` 4. `examples` a folder of Pulumi programs to try locally and/or use in CI. 5. A `Makefile` and this `README`. -### Writing the schema - -The [JSON schema file](https://www.pulumi.com/docs/guides/pulumi-packages/schema) is used by `pulumi-gen-xyz` to create language-specific SDKs. -It is, therefore, a central requirement for any resource provider. -Provider schemas can be handwritten, or alternatively machine-generated by combining API specification with pulumi-specific logic. - -When writing the schema by hand, it is helpful to associate the JSON schema in your IDE for completion or Intellisense features to work: - -* Visual Studio Code: the easiest option is to [map the schema file](https://code.visualstudio.com/Docs/languages/json#_mapping-in-the-user-settings) - in your User Settings which enables it for all your provider projects: - ```json - "json.schemas": [ - { - "fileMatch": [ - "/provider/cmd/pulumi-*/schema.json" - ], - "url": "https://raw.githubusercontent.com/pulumi/pulumi/master/pkg/codegen/schema/pulumi.json" - } - ] - ``` - -This repository provides the [xyz example schema](./provider/cmd/pulumi-resource-xyz/schema.json) to get you started. -[The AWS Native Provider schema](https://github.com/pulumi/pulumi-aws-native/blob/master/provider/cmd/pulumi-resource-aws-native/schema.json) provides a much larger example. -Refer to the [package schema documentation](https://www.pulumi.com/docs/guides/pulumi-packages/schema/#pulumi-package-schema) for additional details when writing the schema. - -### Implementing the gRPC methods - -Once you have a schema that describes all the resources and metadata for your provider, you will need to implement the desired gRPC methods. -You will find a mostly blank implementation of these in `pkg/provider/provider.go`. -Note that these methods do not link 1:1 to the Pulumi CLI commands. - -#### Basic Functionality - -The struct and creation of the provider are implemented already: - -```go -// provider/pkg/provider.go -type xyzProvider struct { - host *provider.HostClient - name string - version string - schema []byte -} - -func makeProvider(host *provider.HostClient, name, version string, pulumiSchema []byte) (pulumirpc.ResourceProviderServer, error) { - // Return the new provider - return &xyzProvider{ - host: host, - name: name, - version: version, - schema: pulumiSchema, - }, nil -} -``` - -You need to provide the following methods: +#### Additional Details -1. Check - validates resource Inputs -2. Diff - calculates the differences between the actual and the desired state of a resource -3. Create - creates a new instance of a resource from an Input -4. Update - updates a resource in-place (i.e. without deleting/recreating) -5. Read - reads current inputs and state for a resource -6. Delete - deletes a resource and its corresponding state - -[Resource lifecycle methods are documented here](https://pulumi-developer-docs.readthedocs.io/en/stable/providers/implementers-guide.html#custom-resource-lifecycle). - -The following methods are necessary for every provider and are already implemented: - -1. GetPluginInfo - returns generic information about this plugin, like its version -2. GetSchema - returns the Pulumi schema to the provider - - -#### Additional Methods - -The [resource provider service](https://github.com/pulumi/pulumi/blob/master/sdk/proto/provider.proto) includes a few more gRPC methods that you may need to implement and can read more about. +This repository depends on the pulumi-go-provider library. For more details on building providers, please check +the [Pulumi Go Provider docs](https://github.com/pulumi/pulumi-go-provider). ### Build Examples @@ -180,18 +84,12 @@ Create an example program using the resources defined in your provider, and plac You can now repeat the steps for [build, install, and test](#test-against-the-example). - -## Documentation - -Please [follow this guide to add documentation to your provider](https://www.pulumi.com/docs/guides/pulumi-packages/how-to-author/#write-documentation). - ## Configuring CI and releases 1. Follow the instructions laid out in the [deployment templates](./deployment-templates/README-DEPLOYMENT.md). ## References -Other resources for learning about the Pulumi resource model: -* [Pulumi Kubernetes provider](https://github.com/pulumi/pulumi-kubernetes/blob/master/provider/pkg/provider/provider.go) -* [Pulumi Terraform Remote State provider](https://github.com/pulumi/pulumi-terraform/blob/master/provider/cmd/pulumi-resource-terraform/provider.go) -* [Dynamic Providers](https://www.pulumi.com/docs/intro/concepts/programming-model/#dynamicproviders) +Other resources/examples for implementing providers: +* [Pulumi Command provider](https://github.com/pulumi/pulumi-command/blob/master/provider/pkg/provider/provider.go) +* [Pulumi Go Provider repository](https://github.com/pulumi/pulumi-go-provider) diff --git a/sdk/python/pulumi_xyz/__init__.py b/sdk/python/pulumi_xyz/__init__.py index d070830..eb28ec6 100644 --- a/sdk/python/pulumi_xyz/__init__.py +++ b/sdk/python/pulumi_xyz/__init__.py @@ -1,5 +1,5 @@ # coding=utf-8 -# *** WARNING: this file was generated by pulumi. *** +# *** WARNING: this file was generated by pulumi-language-python. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** from . import _utilities diff --git a/sdk/python/pulumi_xyz/_utilities.py b/sdk/python/pulumi_xyz/_utilities.py index 9961774..af7b197 100644 --- a/sdk/python/pulumi_xyz/_utilities.py +++ b/sdk/python/pulumi_xyz/_utilities.py @@ -1,5 +1,5 @@ # coding=utf-8 -# *** WARNING: this file was generated by pulumi. *** +# *** WARNING: this file was generated by pulumi-language-python. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** diff --git a/sdk/python/pulumi_xyz/provider.py b/sdk/python/pulumi_xyz/provider.py index dc1b1c1..f78d199 100644 --- a/sdk/python/pulumi_xyz/provider.py +++ b/sdk/python/pulumi_xyz/provider.py @@ -1,5 +1,5 @@ # coding=utf-8 -# *** WARNING: this file was generated by pulumi. *** +# *** WARNING: this file was generated by pulumi-language-python. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import copy diff --git a/sdk/python/pulumi_xyz/random.py b/sdk/python/pulumi_xyz/random.py index 6ecea40..bf8a5a9 100644 --- a/sdk/python/pulumi_xyz/random.py +++ b/sdk/python/pulumi_xyz/random.py @@ -1,5 +1,5 @@ # coding=utf-8 -# *** WARNING: this file was generated by pulumi. *** +# *** WARNING: this file was generated by pulumi-language-python. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import copy diff --git a/sdk/python/setup.py b/sdk/python/setup.py index 4833dc4..b8fa991 100644 --- a/sdk/python/setup.py +++ b/sdk/python/setup.py @@ -1,5 +1,5 @@ # coding=utf-8 -# *** WARNING: this file was generated by pulumi. *** +# *** WARNING: this file was generated by pulumi-language-python. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import errno @@ -9,26 +9,6 @@ VERSION = "0.0.0" -PLUGIN_VERSION = "0.0.0" - -class InstallPluginCommand(install): - def run(self): - install.run(self) - try: - check_call(['pulumi', 'plugin', 'install', 'resource', 'xyz', PLUGIN_VERSION]) - except OSError as error: - if error.errno == errno.ENOENT: - print(f""" - There was an error installing the xyz resource provider plugin. - It looks like `pulumi` is not installed on your system. - Please visit https://pulumi.com/ to install the Pulumi CLI. - You may try manually installing the plugin by running - `pulumi plugin install resource xyz {PLUGIN_VERSION}` - """) - else: - raise - - def readme(): try: with open('README.md', encoding='utf-8') as f: @@ -38,12 +18,10 @@ def readme(): setup(name='pulumi_xyz', + python_requires='>=3.7', version=VERSION, long_description=readme(), long_description_content_type='text/markdown', - cmdclass={ - 'install': InstallPluginCommand, - }, packages=find_packages(), package_data={ 'pulumi_xyz': [ diff --git a/tests/go.mod b/tests/go.mod index ac27975..8072c5b 100644 --- a/tests/go.mod +++ b/tests/go.mod @@ -10,6 +10,7 @@ require ( github.com/pulumi/pulumi-go-provider/integration v0.10.0 github.com/pulumi/pulumi-xyz/provider v0.0.0-00010101000000-000000000000 github.com/pulumi/pulumi/sdk/v3 v3.79.0 + github.com/stretchr/testify v1.8.3 ) require ( @@ -62,7 +63,6 @@ require ( github.com/skeema/knownhosts v1.2.0 // indirect github.com/spf13/cobra v1.7.0 // indirect github.com/spf13/pflag v1.0.5 // indirect - github.com/stretchr/testify v1.8.3 // indirect github.com/texttheater/golang-levenshtein v1.0.1 // indirect github.com/tweekmonster/luser v0.0.0-20161003172636-3fa38070dbd7 // indirect github.com/uber/jaeger-client-go v2.30.0+incompatible // indirect From c346f0035f88565c814115ae56d4689b00246b32 Mon Sep 17 00:00:00 2001 From: Kat Morgan Date: Mon, 13 Nov 2023 22:00:02 -0800 Subject: [PATCH 03/22] devcontainer workflow --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index c5327a9..56a9752 100644 --- a/Makefile +++ b/Makefile @@ -75,7 +75,7 @@ gen_examples:: pulumi_login:: export PULUMI_CONFIG_PASSPHRASE="asdfqwerty1234" && \ - pulumi login + pulumi login --local pulumi_up:: cd ${WORKING_DIR}/examples/yaml && \ @@ -86,8 +86,8 @@ pulumi_up:: pulumi_down:: cd ${WORKING_DIR}/examples/yaml && \ - pulumi destroy -y && \ pulumi stack select dev && \ + pulumi destroy -y && \ pulumi stack rm dev -y devcontainer:: From 0b9127ad789c00cd81d95889a369f4ec26fc06b7 Mon Sep 17 00:00:00 2001 From: Kat Morgan Date: Mon, 13 Nov 2023 22:01:32 -0800 Subject: [PATCH 04/22] devcontainer workflow add passphrase --- Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Makefile b/Makefile index 56a9752..566d075 100644 --- a/Makefile +++ b/Makefile @@ -78,6 +78,7 @@ pulumi_login:: pulumi login --local pulumi_up:: + export PULUMI_CONFIG_PASSPHRASE="asdfqwerty1234" && \ cd ${WORKING_DIR}/examples/yaml && \ pulumi stack init dev && \ pulumi stack select dev && \ @@ -85,6 +86,7 @@ pulumi_up:: pulumi up -y pulumi_down:: + export PULUMI_CONFIG_PASSPHRASE="asdfqwerty1234" && \ cd ${WORKING_DIR}/examples/yaml && \ pulumi stack select dev && \ pulumi destroy -y && \ From d48ccc52e040acd15d196260f593854372b087cc Mon Sep 17 00:00:00 2001 From: Kat Morgan Date: Mon, 13 Nov 2023 22:14:44 -0800 Subject: [PATCH 05/22] add CI coverage for basic Makefile usage --- .github/workflows/makefile.yaml | 63 +++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 .github/workflows/makefile.yaml diff --git a/.github/workflows/makefile.yaml b/.github/workflows/makefile.yaml new file mode 100644 index 0000000..9b002e9 --- /dev/null +++ b/.github/workflows/makefile.yaml @@ -0,0 +1,63 @@ +name: Makefile + +on: + workflow_dispatch: + push: + branches: + - main + pull_request: + branches: + - main + schedule: + - cron: '0 0 * * *' + +jobs: + build: + runs-on: ubuntu-latest + container: + image: docker://ghcr.io/pulumi/devcontainer:latest + options: --user root + permissions: + contents: read + packages: read + actions: read + steps: + - + name: Checkout repository + uses: actions/checkout@v4 + id: git + with: + submodules: 'recursive' + - + name: Unshallow clone for tags + id: tags + run: | + set -ex + sudo chown -R $(whoami) /__w/pulumi-provider-boilerplate/pulumi-provider-boilerplate + git config --global --add safe.directory /__w/pulumi-provider-boilerplate/pulumi-provider-boilerplate + git fetch --prune --unshallow --tags + - + name: Build + id: build + run: | + set -ex + git config --global --add safe.directory /__w/pulumi-provider-boilerplate/pulumi-provider-boilerplate + make build + - + name: Install + id: install + run: | + set -ex + make install + - + name: PulumiUp + id: deploy + run: | + set -ex + make deploy + - + name: Generate multi-language examples from yaml IaC program + id: examples + run: | + set -ex + make gen_examples From d0f13c49ab22a2bdef12c1b40e269bb7c3b8313f Mon Sep 17 00:00:00 2001 From: Kat Morgan Date: Mon, 13 Nov 2023 22:46:30 -0800 Subject: [PATCH 06/22] add example program yaml source readme --- examples/yaml/README.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 examples/yaml/README.md diff --git a/examples/yaml/README.md b/examples/yaml/README.md new file mode 100644 index 0000000..99a99c1 --- /dev/null +++ b/examples/yaml/README.md @@ -0,0 +1,15 @@ +# YAML Example Program + +Test Pulumi program written in YAML for testing this provider locally. + +Edit this yaml program to test features of your provider locally. You can run this program using the following command: + +```bash +pulumi login +pulumi stack init local +pulumi up +``` + +Note that unlike the rest of the auto-generated examples in the ./examples directory, this example is not automatically generated. It is intended to be a place for you to test your provider locally. + +The remaining examples are language specific examples derived from the `make gen_examples` command supported in this provider's Makefile. These examples are automatically generated and should not be edited directly. To regenerate these examples, run `make gen_examples` in the root of this provider's repository. From 97b0e04c83bf549177cf71602cf45e0f67d757d2 Mon Sep 17 00:00:00 2001 From: Kat Morgan Date: Mon, 13 Nov 2023 22:56:53 -0800 Subject: [PATCH 07/22] steps for building and testing xyz provider boilerplate --- README.md | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 3dec72e..e69bf69 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Pulumi Native Provider Boilerplate -This repository is a boilerplate showing how to create a native Pulumi provider. +This repository is a boilerplate showing how to create and locally test a native Pulumi provider. ## Authoring a Pulumi Native Provider @@ -10,7 +10,9 @@ It implements a random number generator that you can [build and test out for you ### Prerequisites -Ensure the following tools are installed and present in your `$PATH`: +Prerequisites for this repository are already satisfied by the [Pulumi Devcontainer](https://github.com/pulumi/devcontainer) if you are using Github Codespaces, or VSCode. + +If you are not using VSCode, you will need to ensure the following tools are installed and present in your `$PATH`: * [`pulumictl`](https://github.com/pulumi/pulumictl#installation) * [Go 1.21](https://golang.org/dl/) or 1.latest @@ -21,7 +23,16 @@ Ensure the following tools are installed and present in your `$PATH`: * [.NET](https://dotnet.microsoft.com/download) -### Creating and Initializing the Repository +### Test the boilerplate XYZ provider before making changes + +1. Create a new Github CodeSpaces environment using this repository. +1. Open a terminal in the CodeSpaces environment. +1. Run `make build install` to build and install the provider. +1. Run `make gen_examples` to generate the example programs in `examples/` off of the source `examples/yaml` example program. +1. Run `make up` to run the example program in `examples/yaml`. +1. Run `make down` to tear down the example program. + +### Creating a new provider repository Pulumi offers this repository as a [GitHub template repository](https://docs.github.com/en/repositories/creating-and-managing-repositories/creating-a-repository-from-a-template) for convenience. From this repository: From 8d4dad6b4fcf199c8588a345ec322d2eeebe000b Mon Sep 17 00:00:00 2001 From: Kat Morgan Date: Mon, 13 Nov 2023 22:59:58 -0800 Subject: [PATCH 08/22] regen --- examples/dotnet/provider-xyz-native.csproj | 2 +- examples/nodejs/package.json | 2 +- examples/python/requirements.txt | 2 +- sdk/dotnet/version.txt | 2 +- sdk/python/README.md | 17 ++++++++++++++--- 5 files changed, 18 insertions(+), 7 deletions(-) diff --git a/examples/dotnet/provider-xyz-native.csproj b/examples/dotnet/provider-xyz-native.csproj index 2f3773a..7201ba8 100644 --- a/examples/dotnet/provider-xyz-native.csproj +++ b/examples/dotnet/provider-xyz-native.csproj @@ -8,7 +8,7 @@ - + \ No newline at end of file diff --git a/examples/nodejs/package.json b/examples/nodejs/package.json index f778a81..8c0491d 100644 --- a/examples/nodejs/package.json +++ b/examples/nodejs/package.json @@ -6,6 +6,6 @@ "dependencies": { "typescript": "^4.0.0", "@pulumi/pulumi": "^3.0.0", - "@pulumi/xyz": "0.0.1-alpha.1697100443+869a6651.dirty" + "@pulumi/xyz": "0.0.1-alpha.1699945013+97b0e04c" } } \ No newline at end of file diff --git a/examples/python/requirements.txt b/examples/python/requirements.txt index 0d5229d..32f5fd5 100644 --- a/examples/python/requirements.txt +++ b/examples/python/requirements.txt @@ -1,2 +1,2 @@ pulumi>=3.0.0,<4.0.0 -pulumi-xyz==0.0.1-alpha.1697100443+869a6651.dirty +pulumi-xyz==0.0.1-alpha.1699945013+97b0e04c diff --git a/sdk/dotnet/version.txt b/sdk/dotnet/version.txt index 07ae644..430b07f 100644 --- a/sdk/dotnet/version.txt +++ b/sdk/dotnet/version.txt @@ -1 +1 @@ -0.0.1-alpha.1697100443+869a6651.dirty +0.0.1-alpha.1699945013+97b0e04c diff --git a/sdk/python/README.md b/sdk/python/README.md index 3dec72e..e69bf69 100644 --- a/sdk/python/README.md +++ b/sdk/python/README.md @@ -1,6 +1,6 @@ # Pulumi Native Provider Boilerplate -This repository is a boilerplate showing how to create a native Pulumi provider. +This repository is a boilerplate showing how to create and locally test a native Pulumi provider. ## Authoring a Pulumi Native Provider @@ -10,7 +10,9 @@ It implements a random number generator that you can [build and test out for you ### Prerequisites -Ensure the following tools are installed and present in your `$PATH`: +Prerequisites for this repository are already satisfied by the [Pulumi Devcontainer](https://github.com/pulumi/devcontainer) if you are using Github Codespaces, or VSCode. + +If you are not using VSCode, you will need to ensure the following tools are installed and present in your `$PATH`: * [`pulumictl`](https://github.com/pulumi/pulumictl#installation) * [Go 1.21](https://golang.org/dl/) or 1.latest @@ -21,7 +23,16 @@ Ensure the following tools are installed and present in your `$PATH`: * [.NET](https://dotnet.microsoft.com/download) -### Creating and Initializing the Repository +### Test the boilerplate XYZ provider before making changes + +1. Create a new Github CodeSpaces environment using this repository. +1. Open a terminal in the CodeSpaces environment. +1. Run `make build install` to build and install the provider. +1. Run `make gen_examples` to generate the example programs in `examples/` off of the source `examples/yaml` example program. +1. Run `make up` to run the example program in `examples/yaml`. +1. Run `make down` to tear down the example program. + +### Creating a new provider repository Pulumi offers this repository as a [GitHub template repository](https://docs.github.com/en/repositories/creating-and-managing-repositories/creating-a-repository-from-a-template) for convenience. From this repository: From aa66a32534a0e352c74b5b83f5faf5674eb7a2cb Mon Sep 17 00:00:00 2001 From: Kat Morgan Date: Wed, 15 Nov 2023 12:37:14 -0800 Subject: [PATCH 09/22] Update .github/workflows/makefile.yaml Co-authored-by: Ian Wahbe --- .github/workflows/makefile.yaml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/makefile.yaml b/.github/workflows/makefile.yaml index 9b002e9..dbd2374 100644 --- a/.github/workflows/makefile.yaml +++ b/.github/workflows/makefile.yaml @@ -52,9 +52,7 @@ jobs: - name: PulumiUp id: deploy - run: | - set -ex - make deploy + run: make deploy - name: Generate multi-language examples from yaml IaC program id: examples From faa5437e98f18c93ddf7671cddaee3848c269e30 Mon Sep 17 00:00:00 2001 From: Kat Morgan Date: Wed, 15 Nov 2023 12:39:41 -0800 Subject: [PATCH 10/22] Update Makefile Co-authored-by: Ian Wahbe --- Makefile | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 566d075..4549bc1 100644 --- a/Makefile +++ b/Makefile @@ -65,13 +65,20 @@ python_sdk:: rm ./bin/setup.py.bak && \ cd ./bin && python3 setup.py build sdist -gen_examples:: - cd ${WORKING_DIR}/examples/yaml && \ - rm -rf ${WORKING_DIR}/examples/{go,nodejs,python,dotnet} && \ - cd ${WORKING_DIR}/examples/yaml && pulumi convert --logtostderr --generate-only --non-interactive --language go --out ${WORKING_DIR}/examples/go 2>&1 && \ - cd ${WORKING_DIR}/examples/yaml && pulumi convert --logtostderr --generate-only --non-interactive --language nodejs --out ${WORKING_DIR}/examples/nodejs 2>&1 && \ - cd ${WORKING_DIR}/examples/yaml && pulumi convert --logtostderr --generate-only --non-interactive --language python --out ${WORKING_DIR}/examples/python 2>&1 && \ - cd ${WORKING_DIR}/examples/yaml && pulumi convert --logtostderr --generate-only --non-interactive --language dotnet --out ${WORKING_DIR}/examples/dotnet 2>&1 +gen_examples: gen_go_example \ + gen_nodejs_example \ + gen_python_example \ + gen_dotnet_example + +gen_%_example: + rm -rf ${WORKING_DIR}/examples/$* + pulumi convert \ + --cwd ${WORKING_DIR}/examples/yaml \ + --logtostderr \ + --generate-only \ + --non-interactive \ + --language $* \ + --out ${WORKING_DIR}/examples/go pulumi_login:: export PULUMI_CONFIG_PASSPHRASE="asdfqwerty1234" && \ From f9b1c7b8fa6e5f09d55ad617c14c38d1105f4b69 Mon Sep 17 00:00:00 2001 From: Kat Morgan Date: Wed, 15 Nov 2023 12:40:12 -0800 Subject: [PATCH 11/22] Update Makefile Co-authored-by: Ian Wahbe --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 4549bc1..0bc350b 100644 --- a/Makefile +++ b/Makefile @@ -100,8 +100,8 @@ pulumi_down:: pulumi stack rm dev -y devcontainer:: - git submodule update --init --recursive .devcontainer && \ - git submodule update --remote --merge .devcontainer && \ + git submodule update --init --recursive .devcontainer + git submodule update --remote --merge .devcontainer cp -f .devcontainer/devcontainer.json .devcontainer.json .PHONY: build From 6ba14402d7dfa7f309448cdd7395adf16e8a6306 Mon Sep 17 00:00:00 2001 From: Kat Morgan Date: Wed, 15 Nov 2023 12:40:33 -0800 Subject: [PATCH 12/22] Update Makefile Co-authored-by: Ian Wahbe --- Makefile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 0bc350b..7f1c5b5 100644 --- a/Makefile +++ b/Makefile @@ -80,8 +80,9 @@ gen_%_example: --language $* \ --out ${WORKING_DIR}/examples/go -pulumi_login:: - export PULUMI_CONFIG_PASSPHRASE="asdfqwerty1234" && \ +local_password: export PULUMI_CONFIG_PASSPHRASE = asdfqwerty1234 + +pulumi_login: local_password pulumi login --local pulumi_up:: From cf48af22aa0e5913d3a5fa54c2b30d309df7abc9 Mon Sep 17 00:00:00 2001 From: Kat Morgan Date: Wed, 15 Nov 2023 14:01:32 -0800 Subject: [PATCH 13/22] test and cleanup after merging suggestions --- Makefile | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 7f1c5b5..610ce08 100644 --- a/Makefile +++ b/Makefile @@ -80,22 +80,22 @@ gen_%_example: --language $* \ --out ${WORKING_DIR}/examples/go -local_password: export PULUMI_CONFIG_PASSPHRASE = asdfqwerty1234 - -pulumi_login: local_password - pulumi login --local +define pulumi_login + @export PULUMI_CONFIG_PASSPHRASE=asdfqwerty1234; \ + pulumi login --local; +endef pulumi_up:: - export PULUMI_CONFIG_PASSPHRASE="asdfqwerty1234" && \ - cd ${WORKING_DIR}/examples/yaml && \ + $(call pulumi_login) \ + cd $(EXAMPLES_DIR) && \ pulumi stack init dev && \ pulumi stack select dev && \ pulumi config set name dev && \ pulumi up -y pulumi_down:: - export PULUMI_CONFIG_PASSPHRASE="asdfqwerty1234" && \ - cd ${WORKING_DIR}/examples/yaml && \ + $(call pulumi_login) \ + cd $(EXAMPLES_DIR) && \ pulumi stack select dev && \ pulumi destroy -y && \ pulumi stack rm dev -y From 1ea1736d061ac57fa6ea7ee69311977061f45c10 Mon Sep 17 00:00:00 2001 From: Kat Morgan Date: Wed, 15 Nov 2023 14:09:45 -0800 Subject: [PATCH 14/22] remove outdated targets after simplifying new up/down targets --- Makefile | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 610ce08..668770f 100644 --- a/Makefile +++ b/Makefile @@ -85,7 +85,7 @@ define pulumi_login pulumi login --local; endef -pulumi_up:: +up:: $(call pulumi_login) \ cd $(EXAMPLES_DIR) && \ pulumi stack init dev && \ @@ -93,7 +93,7 @@ pulumi_up:: pulumi config set name dev && \ pulumi up -y -pulumi_down:: +down:: $(call pulumi_login) \ cd $(EXAMPLES_DIR) && \ pulumi stack select dev && \ @@ -107,12 +107,6 @@ devcontainer:: .PHONY: build -up:: pulumi_login pulumi_up - -down:: pulumi_login pulumi_down - -deploy:: pulumi_login pulumi_up pulumi_down - build:: provider dotnet_sdk go_sdk nodejs_sdk python_sdk # Required for the codegen action that runs in pulumi/pulumi From 99977e08fe797a63a23e852bc566f475aea4cbf7 Mon Sep 17 00:00:00 2001 From: Kat Morgan Date: Wed, 15 Nov 2023 14:12:33 -0800 Subject: [PATCH 15/22] section title relevance edit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e69bf69..4a0b457 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ If you are not using VSCode, you will need to ensure the following tools are ins * [.NET](https://dotnet.microsoft.com/download) -### Test the boilerplate XYZ provider before making changes +### Build & test the boilerplate XYZ provider 1. Create a new Github CodeSpaces environment using this repository. 1. Open a terminal in the CodeSpaces environment. From d35b093c1e0b16b62e35951015a218ca1fe8b324 Mon Sep 17 00:00:00 2001 From: Kat Morgan Date: Wed, 15 Nov 2023 14:14:44 -0800 Subject: [PATCH 16/22] update devcontainer submodule --- .devcontainer | 2 +- .devcontainer.json | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.devcontainer b/.devcontainer index 95a001f..dafd71e 160000 --- a/.devcontainer +++ b/.devcontainer @@ -1 +1 @@ -Subproject commit 95a001fc7005b4389068edde1cdd64e518945a44 +Subproject commit dafd71e01422b0f9bf2ade6c47f111377f84ec9f diff --git a/.devcontainer.json b/.devcontainer.json index 91070b1..6cd190f 100644 --- a/.devcontainer.json +++ b/.devcontainer.json @@ -4,12 +4,12 @@ // - https://code.visualstudio.com/docs/getstarted/settings { // NOTE: remove `image` and uncomment `build` to build the image locally - //"build": { - // "dockerfile": "Dockerfile", - // "context": "." - //}, "name": "pulumi", "image": "ghcr.io/pulumi/devcontainer", + "build": { + "dockerfile": "Dockerfile", + "context": "." + }, "settings": { "terminal.integrated.shell.linux": "/usr/bin/zsh" }, From d080fec48ddcf294d5a2ce5291e773e1160046b3 Mon Sep 17 00:00:00 2001 From: Kat Morgan Date: Wed, 15 Nov 2023 14:24:49 -0800 Subject: [PATCH 17/22] update devcontainer --- .devcontainer | 2 +- .devcontainer.json | 5 ----- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/.devcontainer b/.devcontainer index dafd71e..78cb374 160000 --- a/.devcontainer +++ b/.devcontainer @@ -1 +1 @@ -Subproject commit dafd71e01422b0f9bf2ade6c47f111377f84ec9f +Subproject commit 78cb3743635bd0e4ef665e8708097bce85801598 diff --git a/.devcontainer.json b/.devcontainer.json index 6cd190f..2d4948a 100644 --- a/.devcontainer.json +++ b/.devcontainer.json @@ -3,13 +3,8 @@ // - https://containers.dev/implementors/features // - https://code.visualstudio.com/docs/getstarted/settings { - // NOTE: remove `image` and uncomment `build` to build the image locally "name": "pulumi", "image": "ghcr.io/pulumi/devcontainer", - "build": { - "dockerfile": "Dockerfile", - "context": "." - }, "settings": { "terminal.integrated.shell.linux": "/usr/bin/zsh" }, From 7229eb7620f6549e662c1d30aaf9636032e7b742 Mon Sep 17 00:00:00 2001 From: Kat Morgan Date: Wed, 15 Nov 2023 14:37:53 -0800 Subject: [PATCH 18/22] fix hardcoded path --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 668770f..a024521 100644 --- a/Makefile +++ b/Makefile @@ -78,7 +78,7 @@ gen_%_example: --generate-only \ --non-interactive \ --language $* \ - --out ${WORKING_DIR}/examples/go + --out ${WORKING_DIR}/examples/$* define pulumi_login @export PULUMI_CONFIG_PASSPHRASE=asdfqwerty1234; \ From f5dd366d5e46fc11e9606e5b5097b8729381189e Mon Sep 17 00:00:00 2001 From: Kat Morgan Date: Wed, 15 Nov 2023 14:45:23 -0800 Subject: [PATCH 19/22] retest & fix --- Makefile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index a024521..21215bc 100644 --- a/Makefile +++ b/Makefile @@ -14,6 +14,7 @@ VERSION_PATH := ${PROVIDER_PATH}.Version GOPATH := $(shell go env GOPATH) WORKING_DIR := $(shell pwd) +EXAMPLES_DIR := ${WORKING_DIR}/examples/yaml TESTPARALLELISM := 4 ensure:: @@ -81,13 +82,13 @@ gen_%_example: --out ${WORKING_DIR}/examples/$* define pulumi_login - @export PULUMI_CONFIG_PASSPHRASE=asdfqwerty1234; \ + export PULUMI_CONFIG_PASSPHRASE=asdfqwerty1234; \ pulumi login --local; endef up:: $(call pulumi_login) \ - cd $(EXAMPLES_DIR) && \ + cd ${EXAMPLES_DIR} && \ pulumi stack init dev && \ pulumi stack select dev && \ pulumi config set name dev && \ @@ -95,7 +96,7 @@ up:: down:: $(call pulumi_login) \ - cd $(EXAMPLES_DIR) && \ + cd ${EXAMPLES_DIR} && \ pulumi stack select dev && \ pulumi destroy -y && \ pulumi stack rm dev -y From a0202e24f4e8fdff5cc853ae1df864e8be4bb869 Mon Sep 17 00:00:00 2001 From: Kat Morgan Date: Thu, 16 Nov 2023 07:35:32 -0800 Subject: [PATCH 20/22] update devcontainer --- .devcontainer | 2 +- .devcontainer.json | 25 ++++++++++++++++++------- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/.devcontainer b/.devcontainer index 78cb374..dce1e31 160000 --- a/.devcontainer +++ b/.devcontainer @@ -1 +1 @@ -Subproject commit 78cb3743635bd0e4ef665e8708097bce85801598 +Subproject commit dce1e316309882a657bcc1e32e562706db56a15d diff --git a/.devcontainer.json b/.devcontainer.json index 2d4948a..6a46e60 100644 --- a/.devcontainer.json +++ b/.devcontainer.json @@ -5,9 +5,6 @@ { "name": "pulumi", "image": "ghcr.io/pulumi/devcontainer", - "settings": { - "terminal.integrated.shell.linux": "/usr/bin/zsh" - }, "customizations": { "vscode": { "settings": [ @@ -23,6 +20,7 @@ "editor.gotoLocation.multipleDeclarations", "goto", "editor.gotoLocation.multipleImplementations", "goto", "editor.gotoLocation.multipleTypeDefinitions", "goto", + "editor.terminal.integrated.shell.linux", "/usr/bin/zsh", "files.trimTrailingWhitespace", true, "files.trimFinalNewlines", true ], @@ -44,14 +42,27 @@ } }, "features": { - "ghcr.io/devcontainers/features/common-utils:2": {}, + "ghcr.io/devcontainers/features/common-utils:2": { + "installZsh": true, + "configureZshAsDefaultShell": true, + "installOhMyZsh": true, + "installOhMyZshConfig": true, + "upgradePackages": true, + "nonFreePackages": true, + "username": "vscode", + "userUid": "automatic", + "userGid": "automatic" + }, "ghcr.io/devcontainers/features/docker-outside-of-docker:1": { - "version": "latest", - "installDockerBuildx": true, - "moby": false + "moby": false, + "installDockerBuildx": true, + "version": "latest", + "dockerDashComposeVersion": "v2" } }, "postCreateCommand": "git submodule update --init --recursive", "remoteUser": "vscode", + "forwardPorts": [1313], "runArgs": ["--network=host"] } + From 5a5266ef7c443345cc5b7ba793e44d77a0b89e66 Mon Sep 17 00:00:00 2001 From: Kat Morgan Date: Thu, 16 Nov 2023 07:38:57 -0800 Subject: [PATCH 21/22] fix missing make target --- .github/workflows/makefile.yaml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/makefile.yaml b/.github/workflows/makefile.yaml index dbd2374..a91c29a 100644 --- a/.github/workflows/makefile.yaml +++ b/.github/workflows/makefile.yaml @@ -32,7 +32,6 @@ jobs: name: Unshallow clone for tags id: tags run: | - set -ex sudo chown -R $(whoami) /__w/pulumi-provider-boilerplate/pulumi-provider-boilerplate git config --global --add safe.directory /__w/pulumi-provider-boilerplate/pulumi-provider-boilerplate git fetch --prune --unshallow --tags @@ -40,8 +39,6 @@ jobs: name: Build id: build run: | - set -ex - git config --global --add safe.directory /__w/pulumi-provider-boilerplate/pulumi-provider-boilerplate make build - name: Install @@ -51,8 +48,12 @@ jobs: make install - name: PulumiUp - id: deploy - run: make deploy + id: up + run: make up + - + name: PulumiDown + id: down + run: make down - name: Generate multi-language examples from yaml IaC program id: examples From fbe3f61f95d8cc26991983ed42d44c6459780161 Mon Sep 17 00:00:00 2001 From: Kat Morgan Date: Fri, 17 Nov 2023 19:11:19 +0000 Subject: [PATCH 22/22] rm comment --- examples/dotnet/Pulumi.yaml | 2 +- examples/yaml/Pulumi.yaml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/dotnet/Pulumi.yaml b/examples/dotnet/Pulumi.yaml index 11dee29..8ec1814 100644 --- a/examples/dotnet/Pulumi.yaml +++ b/examples/dotnet/Pulumi.yaml @@ -3,4 +3,4 @@ runtime: dotnet plugins: providers: - name: xyz - path: ../../bin # Adjust this path to point to your xyz provider binary + path: ../../bin diff --git a/examples/yaml/Pulumi.yaml b/examples/yaml/Pulumi.yaml index e28c728..d49b8ee 100644 --- a/examples/yaml/Pulumi.yaml +++ b/examples/yaml/Pulumi.yaml @@ -3,7 +3,7 @@ runtime: yaml plugins: providers: - name: xyz - path: ../../bin # Adjust this path to point to your xyz provider binary + path: ../../bin resources: myRandomResource: @@ -13,4 +13,4 @@ resources: outputs: output: - value: ${myRandomResource.result} \ No newline at end of file + value: ${myRandomResource.result}