Skip to content

Commit

Permalink
Embed version in SDKs (#410)
Browse files Browse the repository at this point in the history
Part of pulumi/ci-mgmt#915

1. Enable embedding version number in each language.
2. Configure CI to allow changes to files which include the version
number and use new push-based Go SDK publishing.
3. Remove explicit dependencies (defer to the languages's defaults).
  • Loading branch information
danielrbradley authored May 9, 2024
2 parents 6ab9e70 + cfa99c5 commit 3dad44a
Show file tree
Hide file tree
Showing 14 changed files with 76 additions and 32 deletions.
12 changes: 12 additions & 0 deletions .ci-mgmt.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,15 @@ plugins:
- name: terraform
version: "1.0.16"
kind: converter

# These files are updated with the real version number
worktreeAllowedChanges: |-
sdk/**/pulumi-plugin.json
sdk/dotnet/Pulumi.*.csproj
sdk/go/*/internal/pulumiUtilities.go
sdk/nodejs/package.json
sdk/python/pyproject.toml
publish:
goSdk:
usePush: true
7 changes: 7 additions & 0 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,13 @@ jobs:
run: make build_${{ matrix.language }}
- name: Check worktree clean
uses: pulumi/git-status-check-action@v1
with:
allowed-changes: |
sdk/**/pulumi-plugin.json
sdk/dotnet/Pulumi.*.csproj
sdk/go/*/internal/pulumiUtilities.go
sdk/nodejs/package.json
sdk/python/pyproject.toml
- name: Compress SDK folder
run: tar -zcf sdk/${{ matrix.language }}.tar.gz -C sdk/${{ matrix.language }} .
- name: Upload artifacts
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/prerelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,13 @@ jobs:
run: make build_${{ matrix.language }}
- name: Check worktree clean
uses: pulumi/git-status-check-action@v1
with:
allowed-changes: |
sdk/**/pulumi-plugin.json
sdk/dotnet/Pulumi.*.csproj
sdk/go/*/internal/pulumiUtilities.go
sdk/nodejs/package.json
sdk/python/pyproject.toml
- name: Compress SDK folder
run: tar -zcf sdk/${{ matrix.language }}.tar.gz -C sdk/${{ matrix.language }} .
- name: Upload artifacts
Expand Down
18 changes: 15 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,13 @@ jobs:
run: make build_${{ matrix.language }}
- name: Check worktree clean
uses: pulumi/git-status-check-action@v1
with:
allowed-changes: |
sdk/**/pulumi-plugin.json
sdk/dotnet/Pulumi.*.csproj
sdk/go/*/internal/pulumiUtilities.go
sdk/nodejs/package.json
sdk/python/pyproject.toml
- name: Compress SDK folder
run: tar -zcf sdk/${{ matrix.language }}.tar.gz -C sdk/${{ matrix.language }} .
- name: Upload artifacts
Expand Down Expand Up @@ -332,9 +339,14 @@ jobs:
repo: pulumi/pulumictl
- id: version
uses: pulumi/provider-version-action@v1
- name: Add SDK version tag
run: git tag "sdk/v${{ steps.version.outputs.version }}" && git push origin
"sdk/v${{ steps.version.outputs.version }}"
- uses: pulumi/publish-go-sdk-action@v1
with:
repository: ${{ github.repository }}
base-ref: ${{ github.sha }}
source: sdk
path: sdk
version: ${{ steps.version.outputs.version }}
additive: false

clean_up_release_labels:
name: Clean up release labels
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/run-acceptance-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,13 @@ jobs:
run: make build_${{ matrix.language }}
- name: Check worktree clean
uses: pulumi/git-status-check-action@v1
with:
allowed-changes: |
sdk/**/pulumi-plugin.json
sdk/dotnet/Pulumi.*.csproj
sdk/go/*/internal/pulumiUtilities.go
sdk/nodejs/package.json
sdk/python/pyproject.toml
- name: Compress SDK folder
run: tar -zcf sdk/${{ matrix.language }}.tar.gz -C sdk/${{ matrix.language }} .
- name: Upload artifacts
Expand Down
17 changes: 7 additions & 10 deletions provider/cmd/pulumi-resource-kafka/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,32 +20,29 @@
"namespaces": {
"kafka": "Kafka"
},
"compatibility": "tfbridge20"
"compatibility": "tfbridge20",
"respectSchemaVersion": true
},
"go": {
"importBasePath": "github.com/pulumi/pulumi-kafka/sdk/v3/go/kafka",
"generateResourceContainerTypes": true,
"generateExtraInputTypes": true
"generateExtraInputTypes": true,
"respectSchemaVersion": true
},
"nodejs": {
"packageDescription": "A Pulumi package for creating and managing Kafka.",
"readme": "\u003e This provider is a derived work of the [Terraform Provider](https://github.com/Mongey/terraform-provider-kafka)\n\u003e distributed under [MIT](https://mit-license.org/). If you encounter a bug or missing feature,\n\u003e first check the [`pulumi-kafka` repo](https://github.com/pulumi/pulumi-kafka/issues); however, if that doesn't turn up anything,\n\u003e please consult the source [`terraform-provider-kafka` repo](https://github.com/Mongey/terraform-provider-kafka/issues).",
"dependencies": {
"@pulumi/pulumi": "^3.0.0"
},
"devDependencies": {
"@types/mime": "^2.0.0",
"@types/node": "^10.0.0"
},
"compatibility": "tfbridge20",
"disableUnionOutputTypes": true
"disableUnionOutputTypes": true,
"respectSchemaVersion": true
},
"python": {
"requires": {
"pulumi": "\u003e=3.0.0,\u003c4.0.0"
},
"readme": "\u003e This provider is a derived work of the [Terraform Provider](https://github.com/Mongey/terraform-provider-kafka)\n\u003e distributed under [MIT](https://mit-license.org/). If you encounter a bug or missing feature,\n\u003e first check the [`pulumi-kafka` repo](https://github.com/pulumi/pulumi-kafka/issues); however, if that doesn't turn up anything,\n\u003e please consult the source [`terraform-provider-kafka` repo](https://github.com/Mongey/terraform-provider-kafka/issues).",
"compatibility": "tfbridge20",
"respectSchemaVersion": true,
"pyproject": {
"enabled": true
}
Expand Down
14 changes: 6 additions & 8 deletions provider/resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,19 +103,15 @@ func Provider() tfbridge.ProviderInfo {
"kafka_topic": {Docs: noDocs},
},
JavaScript: &tfbridge.JavaScriptInfo{
Dependencies: map[string]string{
"@pulumi/pulumi": "^3.0.0",
},
DevDependencies: map[string]string{
"@types/node": "^10.0.0", // so we can access strongly typed node definitions.
"@types/mime": "^2.0.0",
},
RespectSchemaVersion: true,
},
Python: (func() *tfbridge.PythonInfo {
i := &tfbridge.PythonInfo{
RespectSchemaVersion: true,
Requires: map[string]string{
"pulumi": ">=3.0.0,<4.0.0",
}}
},
}
i.PyProject.Enabled = true
return i
})(),
Expand All @@ -128,8 +124,10 @@ func Provider() tfbridge.ProviderInfo {
mainPkg,
),
GenerateResourceContainerTypes: true,
RespectSchemaVersion: true,
},
CSharp: &tfbridge.CSharpInfo{
RespectSchemaVersion: true,
PackageReferences: map[string]string{
"Pulumi": "3.*",
},
Expand Down
1 change: 1 addition & 0 deletions sdk/dotnet/Pulumi.Kafka.csproj

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion sdk/dotnet/pulumi-plugin.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions sdk/go/kafka/internal/pulumiUtilities.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion sdk/go/kafka/pulumi-plugin.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions sdk/nodejs/package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion sdk/python/pulumi_kafka/pulumi-plugin.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion sdk/python/pyproject.toml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 3dad44a

Please sign in to comment.