Skip to content

Commit

Permalink
Merge branch 'master' into fraser/getMappingTf
Browse files Browse the repository at this point in the history
  • Loading branch information
Frassle committed Sep 1, 2023
2 parents 1e78c5b + d90452c commit b7c6dc4
Show file tree
Hide file tree
Showing 17 changed files with 90 additions and 622 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,9 @@ jobs:
run: ./ci-scripts/ci/publish-tfgen-package ${{ github.workspace }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
# See https://github.com/pulumi/scripts/pull/138/files
# Possible values: "all", "wheel".
PYPI_PUBLISH_ARTIFACTS: all
- if: failure() && github.event_name == 'push'
name: Notify Slack
uses: 8398a7/action-slack@v3
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/prerelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,9 @@ jobs:
run: ./ci-scripts/ci/publish-tfgen-package ${{ github.workspace }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
# See https://github.com/pulumi/scripts/pull/138/files
# Possible values: "all", "wheel".
PYPI_PUBLISH_ARTIFACTS: all
- if: failure() && github.event_name == 'push'
name: Notify Slack
uses: 8398a7/action-slack@v3
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,9 @@ jobs:
run: ./ci-scripts/ci/publish-tfgen-package ${{ github.workspace }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
# See https://github.com/pulumi/scripts/pull/138/files
# Possible values: "all", "wheel".
PYPI_PUBLISH_ARTIFACTS: all
- if: failure() && github.event_name == 'push'
name: Notify Slack
uses: 8398a7/action-slack@v3
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@ sdk/java/.gradle
sdk/java/gradle
sdk/java/gradlew
sdk/java/gradlew.bat

sdk/python/venv
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
## Unreleased

- Reintroduce switching builds to pyproject.toml; when publishing the package to PyPI both
source-based and wheel distributions are now published. For most users the installs will now favor
the wheel distribution, but users invoking pip with `--no-binary :all:` will continue having
installs based on the source distribution.

- Return mapping information for terraform conversions (https://github.com/pulumi/pulumi-kubernetes/pull/2457)

## 4.1.1 (August 23, 2023)
Expand Down
12 changes: 4 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -82,16 +82,12 @@ nodejs_sdk::
python_sdk:: PYPI_VERSION := $(shell pulumictl get version --language python)
python_sdk::
# Delete only files and folders that are generated.
rm -r sdk/python/pulumi_kubernetes/*/ sdk/python/pulumi_kubernetes/__init__.py
rm -rf sdk/python/pulumi_kubernetes/*/ sdk/python/pulumi_kubernetes/__init__.py
# Delete files not tracked in Git
cd ${PACKDIR}/python/ && git clean -fxd
$(WORKING_DIR)/bin/$(CODEGEN) -version=${VERSION} python $(SCHEMA_FILE) $(CURDIR)
cp README.md ${PACKDIR}/python/
cd ${PACKDIR}/python/ && \
echo "module fake_python_module // Exclude this directory from Go tools\n\ngo 1.17" > go.mod && \
python3 setup.py clean --all 2>/dev/null && \
rm -rf ./bin/ ../python.bin/ && cp -R . ../python.bin && mv ../python.bin ./bin && \
sed -i.bak -e 's/^VERSION = .*/VERSION = "$(PYPI_VERSION)"/g' -e 's/^PLUGIN_VERSION = .*/PLUGIN_VERSION = "$(VERSION)"/g' ./bin/setup.py && \
rm ./bin/setup.py.bak && \
cd ./bin && python3 setup.py build sdist
PYPI_VERSION=$(PYPI_VERSION) ./scripts/build_python_sdk.sh

java_sdk:: PACKAGE_VERSION := $(shell pulumictl get version --language generic)
java_sdk:: bin/pulumi-java-gen
Expand Down
3 changes: 3 additions & 0 deletions provider/cmd/pulumi-resource-kubernetes/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,9 @@
"storage.k8s.io/v1alpha1": "storage/v1alpha1",
"storage.k8s.io/v1beta1": "storage/v1beta1"
},
"pyproject": {
"enabled": true
},
"readme": "The Kubernetes provider package offers support for all Kubernetes resources and their properties.\nResources are exposed as types from modules based on Kubernetes API groups such as 'apps', 'core',\n'rbac', and 'storage', among many others. Additionally, support for deploying Helm charts ('helm')\nand YAML files ('yaml') is available in this package. Using this package allows you to\nprogrammatically declare instances of any Kubernetes resources and any supported resource version\nusing infrastructure as code, which Pulumi then uses to drive the Kubernetes API.\n\nIf this is your first time using this package, these two resources may be helpful:\n\n* [Kubernetes Getting Started Guide](https://www.pulumi.com/docs/quickstart/kubernetes/): Get up and running quickly.\n* [Kubernetes Pulumi Setup Documentation](https://www.pulumi.com/docs/quickstart/kubernetes/configure/): How to configure Pulumi\n for use with your Kubernetes cluster.\n",
"requires": {
"pulumi": ">=3.25.0,<4.0.0",
Expand Down
3 changes: 3 additions & 0 deletions provider/pkg/gen/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,9 @@ Use the navigation below to see detailed documentation for each of the supported
"pulumi": ">=3.25.0,<4.0.0",
"requests": ">=2.21,<3.0",
},
"pyproject": map[string]bool{
"enabled": true,
},
"moduleNameOverrides": modToPkg,
"compatibility": kubernetes20,
"usesIOClasses": true,
Expand Down
51 changes: 51 additions & 0 deletions scripts/build_python_sdk.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/usr/bin/env bash
#
# Builds source and binary Python SDK distributions.
#
# Inputs: ./sdk/python sources generated by the SDK generator; PYPI_VERSION env var set.
# Outputs: ./sdk/python/bin/dist/{*.tar.gz,*.whl} packages

set -euo pipefail

: ${PYPI_VERSION:?"PYPI_VERSION env var needs to be set and cannot be empty"}

cd ./sdk/python

# Removing auto-generated setup.py; this is needed until there is an option on the SDK generator to
# opt out of generating this file.
rm setup.py

cat << EOF > go.mod
module fake_python_module // Exclude this directory from Go tools
go 1.17
EOF

rm -rf ./bin/ ../python.bin/
cp -R . ../python.bin
mv ../python.bin ./bin

sed -i.bak -e "s/^ version = .*/ version = \"$PYPI_VERSION\"/g" ./bin/pyproject.toml
rm ./bin/pyproject.toml.bak

# Modifying generated pyproject.toml until there is an option to populate these settings.
cat << EOF >> ./bin/pyproject.toml
[build-system]
requires = ["setuptools>=61.0"]
build-backend = "setuptools.build_meta"
[tool]
[tool.setuptools]
[tool.setuptools.package-data]
pulumi_kubernetes = ["py.typed", "pulumi-plugin.json"]
EOF

# Creating an isolated venv for the bulid.
python3 -m venv venv

source ./venv/bin/activate

python -m pip install build

cd ./bin

python -m build .
238 changes: 0 additions & 238 deletions sdk/python/pulumi_kubernetes.egg-info/PKG-INFO

This file was deleted.

Loading

0 comments on commit b7c6dc4

Please sign in to comment.