Compare commits

..

5 Commits

Author SHA1 Message Date
Bryce Lampe
76dfa088b3 Don't diff token 2024-05-28 07:36:13 -07:00
Pulumi Bot
c9e5913af1 Update GitHub Actions workflows. (#71)
This PR was automatically generated by the
update-native-provider-workflows workflow in the pulumi/ci-mgmt repo,
from commit 6ef5444d6e792b70fd2ed0791d776a6f9f77714e.
2024-05-17 11:26:21 +01:00
Pulumi Bot
1d6038bb07 Update GitHub Actions workflows. (#66)
This PR was automatically generated by the
update-native-provider-workflows workflow in the pulumi/ci-mgmt repo,
from commit 2c4960e091c66f59df2902620e003f2db1a7b063.
2024-05-16 09:46:03 +01:00
Bryce Lampe
ff71c251e1 Upgrade go-provider (#53)
This upgrades pulumi-go-provider to latest. Code was automatically
migrated using a slightly modified patch described
[here](https://github.com/pulumi/pulumi-go-provider/pull/227#issuecomment-2073962385).

---------

Co-authored-by: Ian Wahbe <ian@wahbe.com>
2024-05-13 12:23:24 -07:00
Pulumi Bot
9b789f3742 Update GitHub Actions workflows. (#56)
This PR was automatically generated by the
update-native-provider-workflows workflow in the pulumi/ci-mgmt repo,
from commit 8d27f1f4eb9d34f0b7ccf790b1d2e06b7fa92be6.

This also manually updates the makefile to add the PROVIDER_VERSION
argument.

---------

Co-authored-by: Daniel Bradley <daniel@pulumi.com>
2024-05-01 10:49:27 -04:00
17 changed files with 585 additions and 271 deletions

View File

@@ -64,14 +64,11 @@ jobs:
uses: actions/checkout@v4
with:
lfs: true
- name: Checkout Scripts Repo
uses: actions/checkout@v4
- id: version
name: Set Provider Version
uses: pulumi/provider-version-action@v1
with:
path: ci-scripts
repository: pulumi/scripts
- run: echo "ci-scripts" >> .git/info/exclude
- name: Unshallow clone for tags
run: git fetch --prune --unshallow --tags
set-env: PROVIDER_VERSION
- name: Install Go
uses: actions/setup-go@v5
with:
@@ -121,7 +118,14 @@ jobs:
- name: Build Provider
run: make provider
- name: Check worktree clean
run: ./ci-scripts/ci/check-worktree-is-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
- run: git status --porcelain
- name: Tar provider binaries
run: tar -zcf ${{ github.workspace }}/bin/provider.tar.gz -C ${{
@@ -163,14 +167,11 @@ jobs:
uses: actions/checkout@v4
with:
lfs: true
- name: Checkout Scripts Repo
uses: actions/checkout@v4
- id: version
name: Set Provider Version
uses: pulumi/provider-version-action@v1
with:
path: ci-scripts
repository: pulumi/scripts
- run: echo "ci-scripts" >> .git/info/exclude
- name: Unshallow clone for tags
run: git fetch --prune --unshallow --tags
set-env: PROVIDER_VERSION
- name: Install Go
uses: actions/setup-go@v5
with:
@@ -221,7 +222,14 @@ jobs:
- name: Build SDK
run: make build_${{ matrix.language }}
- name: Check worktree clean
run: ./ci-scripts/ci/check-worktree-is-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
- run: git status --porcelain
- name: Tar SDK folder
run: tar -zcf sdk/${{ matrix.language }}.tar.gz -C sdk/${{ matrix.language }} .
@@ -260,14 +268,11 @@ jobs:
uses: actions/checkout@v4
with:
lfs: true
- name: Checkout Scripts Repo
uses: actions/checkout@v4
- id: version
name: Set Provider Version
uses: pulumi/provider-version-action@v1
with:
path: ci-scripts
repository: pulumi/scripts
- run: echo "ci-scripts" >> .git/info/exclude
- name: Unshallow clone for tags
run: git fetch --prune --unshallow --tags
set-env: PROVIDER_VERSION
- name: Install Go
uses: actions/setup-go@v5
with:
@@ -379,8 +384,11 @@ jobs:
uses: actions/checkout@v4
with:
lfs: true
- name: Unshallow clone for tags
run: git fetch --prune --unshallow --tags
- id: version
name: Set Provider Version
uses: pulumi/provider-version-action@v1
with:
set-env: PROVIDER_VERSION
- name: Install Go
uses: actions/setup-go@v5
with:
@@ -411,11 +419,10 @@ jobs:
role-session-name: ${{ env.PROVIDER }}@githubActions
role-external-id: upload-pulumi-release
role-to-assume: ${{ secrets.AWS_UPLOAD_ROLE_ARN }}
- name: Set PreRelease Version
run: echo "GORELEASER_CURRENT_TAG=v$(pulumictl get version --language generic)"
>> $GITHUB_ENV
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
env:
GORELEASER_CURRENT_TAG: v${{ steps.version.outputs.version }}
with:
args: -p 3 -f .goreleaser.prerelease.yml --clean --skip=validate --timeout 60m0s
version: latest
@@ -435,14 +442,17 @@ jobs:
uses: actions/checkout@v4
with:
lfs: true
- id: version
name: Set Provider Version
uses: pulumi/provider-version-action@v1
with:
set-env: PROVIDER_VERSION
- name: Checkout Scripts Repo
uses: actions/checkout@v4
with:
path: ci-scripts
repository: pulumi/scripts
- run: echo "ci-scripts" >> .git/info/exclude
- name: Unshallow clone for tags
run: git fetch --prune --unshallow --tags
- name: Install Go
uses: actions/setup-go@v5
with:
@@ -515,14 +525,11 @@ jobs:
uses: actions/checkout@v4
with:
lfs: true
- name: Checkout Scripts Repo
uses: actions/checkout@v4
- id: version
name: Set Provider Version
uses: pulumi/provider-version-action@v1
with:
path: ci-scripts
repository: pulumi/scripts
- run: echo "ci-scripts" >> .git/info/exclude
- name: Unshallow clone for tags
run: git fetch --prune --unshallow --tags
set-env: PROVIDER_VERSION
- name: Install Go
uses: actions/setup-go@v5
with:
@@ -552,11 +559,10 @@ jobs:
- name: Uncompress java SDK
run: tar -zxf ${{github.workspace}}/sdk/java.tar.gz -C
${{github.workspace}}/sdk/java
- name: Set PACKAGE_VERSION to Env
run: echo "PACKAGE_VERSION=$(pulumictl get version --language generic)" >>
$GITHUB_ENV
- name: Publish Java SDK
uses: gradle/gradle-build-action@v3
env:
PACKAGE_VERSION: ${{ env.PROVIDER_VERSION }}
with:
arguments: publishToSonatype closeAndReleaseSonatypeStagingRepository
build-root-directory: ./sdk/java

View File

@@ -56,14 +56,11 @@ jobs:
uses: actions/checkout@v4
with:
lfs: true
- name: Checkout Scripts Repo
uses: actions/checkout@v4
- id: version
name: Set Provider Version
uses: pulumi/provider-version-action@v1
with:
path: ci-scripts
repository: pulumi/scripts
- run: echo "ci-scripts" >> .git/info/exclude
- name: Unshallow clone for tags
run: git fetch --prune --unshallow --tags
set-env: PROVIDER_VERSION
- name: Install Go
uses: actions/setup-go@v5
with:
@@ -113,7 +110,14 @@ jobs:
- name: Build Provider
run: make provider
- name: Check worktree clean
run: ./ci-scripts/ci/check-worktree-is-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
- run: git status --porcelain
- name: Tar provider binaries
run: tar -zcf ${{ github.workspace }}/bin/provider.tar.gz -C ${{
@@ -155,14 +159,11 @@ jobs:
uses: actions/checkout@v4
with:
lfs: true
- name: Checkout Scripts Repo
uses: actions/checkout@v4
- id: version
name: Set Provider Version
uses: pulumi/provider-version-action@v1
with:
path: ci-scripts
repository: pulumi/scripts
- run: echo "ci-scripts" >> .git/info/exclude
- name: Unshallow clone for tags
run: git fetch --prune --unshallow --tags
set-env: PROVIDER_VERSION
- name: Install Go
uses: actions/setup-go@v5
with:
@@ -213,7 +214,14 @@ jobs:
- name: Build SDK
run: make build_${{ matrix.language }}
- name: Check worktree clean
run: ./ci-scripts/ci/check-worktree-is-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
- run: git status --porcelain
- name: Tar SDK folder
run: tar -zcf sdk/${{ matrix.language }}.tar.gz -C sdk/${{ matrix.language }} .
@@ -251,14 +259,11 @@ jobs:
uses: actions/checkout@v4
with:
lfs: true
- name: Checkout Scripts Repo
uses: actions/checkout@v4
- id: version
name: Set Provider Version
uses: pulumi/provider-version-action@v1
with:
path: ci-scripts
repository: pulumi/scripts
- run: echo "ci-scripts" >> .git/info/exclude
- name: Unshallow clone for tags
run: git fetch --prune --unshallow --tags
set-env: PROVIDER_VERSION
- name: Install Go
uses: actions/setup-go@v5
with:
@@ -370,8 +375,11 @@ jobs:
uses: actions/checkout@v4
with:
lfs: true
- name: Unshallow clone for tags
run: git fetch --prune --unshallow --tags
- id: version
name: Set Provider Version
uses: pulumi/provider-version-action@v1
with:
set-env: PROVIDER_VERSION
- name: Install Go
uses: actions/setup-go@v5
with:
@@ -402,11 +410,10 @@ jobs:
role-session-name: ${{ env.PROVIDER }}@githubActions
role-external-id: upload-pulumi-release
role-to-assume: ${{ secrets.AWS_UPLOAD_ROLE_ARN }}
- name: Set PreRelease Version
run: echo "GORELEASER_CURRENT_TAG=v$(pulumictl get version --language generic)"
>> $GITHUB_ENV
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
env:
GORELEASER_CURRENT_TAG: v${{ steps.version.outputs.version }}
with:
args: -p 3 -f .goreleaser.prerelease.yml --clean --skip=validate --timeout 60m0s
version: latest
@@ -426,14 +433,17 @@ jobs:
uses: actions/checkout@v4
with:
lfs: true
- id: version
name: Set Provider Version
uses: pulumi/provider-version-action@v1
with:
set-env: PROVIDER_VERSION
- name: Checkout Scripts Repo
uses: actions/checkout@v4
with:
path: ci-scripts
repository: pulumi/scripts
- run: echo "ci-scripts" >> .git/info/exclude
- name: Unshallow clone for tags
run: git fetch --prune --unshallow --tags
- name: Install Go
uses: actions/setup-go@v5
with:
@@ -506,14 +516,11 @@ jobs:
uses: actions/checkout@v4
with:
lfs: true
- name: Checkout Scripts Repo
uses: actions/checkout@v4
- id: version
name: Set Provider Version
uses: pulumi/provider-version-action@v1
with:
path: ci-scripts
repository: pulumi/scripts
- run: echo "ci-scripts" >> .git/info/exclude
- name: Unshallow clone for tags
run: git fetch --prune --unshallow --tags
set-env: PROVIDER_VERSION
- name: Install Go
uses: actions/setup-go@v5
with:
@@ -543,12 +550,46 @@ jobs:
- name: Uncompress java SDK
run: tar -zxf ${{github.workspace}}/sdk/java.tar.gz -C
${{github.workspace}}/sdk/java
- name: Set PACKAGE_VERSION to Env
run: echo "PACKAGE_VERSION=$(pulumictl get version --language generic)" >>
$GITHUB_ENV
- name: Publish Java SDK
uses: gradle/gradle-build-action@v3
env:
PACKAGE_VERSION: ${{ env.PROVIDER_VERSION }}
with:
arguments: publishToSonatype closeAndReleaseSonatypeStagingRepository
build-root-directory: ./sdk/java
gradle-version: 7.4.1
publish_go_sdk:
runs-on: ubuntu-latest
name: publish-go-sdk
needs: publish_sdk
steps:
- name: Checkout Repo
uses: actions/checkout@v4
with:
lfs: true
- id: version
name: Set Provider Version
uses: pulumi/provider-version-action@v1
with:
set-env: PROVIDER_VERSION
- name: Download go SDK
uses: actions/download-artifact@v4
with:
name: go-sdk.tar.gz
path: ${{ github.workspace}}/sdk/
- name: Uncompress go SDK
run: tar -zxf ${{github.workspace}}/sdk/go.tar.gz -C
${{github.workspace}}/sdk/go
- name: Publish Go SDK
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
files: |-
go.*
go/**
!*.tar.gz

View File

@@ -56,14 +56,11 @@ jobs:
uses: actions/checkout@v4
with:
lfs: true
- name: Checkout Scripts Repo
uses: actions/checkout@v4
- id: version
name: Set Provider Version
uses: pulumi/provider-version-action@v1
with:
path: ci-scripts
repository: pulumi/scripts
- run: echo "ci-scripts" >> .git/info/exclude
- name: Unshallow clone for tags
run: git fetch --prune --unshallow --tags
set-env: PROVIDER_VERSION
- name: Install Go
uses: actions/setup-go@v5
with:
@@ -113,7 +110,14 @@ jobs:
- name: Build Provider
run: make provider
- name: Check worktree clean
run: ./ci-scripts/ci/check-worktree-is-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
- run: git status --porcelain
- name: Tar provider binaries
run: tar -zcf ${{ github.workspace }}/bin/provider.tar.gz -C ${{
@@ -155,14 +159,11 @@ jobs:
uses: actions/checkout@v4
with:
lfs: true
- name: Checkout Scripts Repo
uses: actions/checkout@v4
- id: version
name: Set Provider Version
uses: pulumi/provider-version-action@v1
with:
path: ci-scripts
repository: pulumi/scripts
- run: echo "ci-scripts" >> .git/info/exclude
- name: Unshallow clone for tags
run: git fetch --prune --unshallow --tags
set-env: PROVIDER_VERSION
- name: Install Go
uses: actions/setup-go@v5
with:
@@ -213,7 +214,14 @@ jobs:
- name: Build SDK
run: make build_${{ matrix.language }}
- name: Check worktree clean
run: ./ci-scripts/ci/check-worktree-is-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
- run: git status --porcelain
- name: Tar SDK folder
run: tar -zcf sdk/${{ matrix.language }}.tar.gz -C sdk/${{ matrix.language }} .
@@ -251,14 +259,11 @@ jobs:
uses: actions/checkout@v4
with:
lfs: true
- name: Checkout Scripts Repo
uses: actions/checkout@v4
- id: version
name: Set Provider Version
uses: pulumi/provider-version-action@v1
with:
path: ci-scripts
repository: pulumi/scripts
- run: echo "ci-scripts" >> .git/info/exclude
- name: Unshallow clone for tags
run: git fetch --prune --unshallow --tags
set-env: PROVIDER_VERSION
- name: Install Go
uses: actions/setup-go@v5
with:
@@ -370,8 +375,11 @@ jobs:
uses: actions/checkout@v4
with:
lfs: true
- name: Unshallow clone for tags
run: git fetch --prune --unshallow --tags
- id: version
name: Set Provider Version
uses: pulumi/provider-version-action@v1
with:
set-env: PROVIDER_VERSION
- name: Install Go
uses: actions/setup-go@v5
with:
@@ -402,11 +410,10 @@ jobs:
role-session-name: ${{ env.PROVIDER }}@githubActions
role-external-id: upload-pulumi-release
role-to-assume: ${{ secrets.AWS_UPLOAD_ROLE_ARN }}
- name: Set PreRelease Version
run: echo "GORELEASER_CURRENT_TAG=v$(pulumictl get version --language generic)"
>> $GITHUB_ENV
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
env:
GORELEASER_CURRENT_TAG: v${{ steps.version.outputs.version }}
with:
args: -p 3 release --clean --timeout 60m0s
version: latest
@@ -426,14 +433,17 @@ jobs:
uses: actions/checkout@v4
with:
lfs: true
- id: version
name: Set Provider Version
uses: pulumi/provider-version-action@v1
with:
set-env: PROVIDER_VERSION
- name: Checkout Scripts Repo
uses: actions/checkout@v4
with:
path: ci-scripts
repository: pulumi/scripts
- run: echo "ci-scripts" >> .git/info/exclude
- name: Unshallow clone for tags
run: git fetch --prune --unshallow --tags
- name: Install Go
uses: actions/setup-go@v5
with:
@@ -506,14 +516,11 @@ jobs:
uses: actions/checkout@v4
with:
lfs: true
- name: Checkout Scripts Repo
uses: actions/checkout@v4
- id: version
name: Set Provider Version
uses: pulumi/provider-version-action@v1
with:
path: ci-scripts
repository: pulumi/scripts
- run: echo "ci-scripts" >> .git/info/exclude
- name: Unshallow clone for tags
run: git fetch --prune --unshallow --tags
set-env: PROVIDER_VERSION
- name: Install Go
uses: actions/setup-go@v5
with:
@@ -543,34 +550,52 @@ jobs:
- name: Uncompress java SDK
run: tar -zxf ${{github.workspace}}/sdk/java.tar.gz -C
${{github.workspace}}/sdk/java
- name: Set PACKAGE_VERSION to Env
run: echo "PACKAGE_VERSION=$(pulumictl get version --language generic)" >>
$GITHUB_ENV
- name: Publish Java SDK
uses: gradle/gradle-build-action@v3
env:
PACKAGE_VERSION: ${{ env.PROVIDER_VERSION }}
with:
arguments: publishToSonatype closeAndReleaseSonatypeStagingRepository
build-root-directory: ./sdk/java
gradle-version: 7.4.1
tag_sdk:
publish_go_sdk:
runs-on: ubuntu-latest
name: publish-go-sdk
needs: publish_sdk
steps:
- name: Checkout Repo
uses: actions/checkout@v4
with:
lfs: true
- name: Install pulumictl
uses: jaxxstorm/action-install-gh-release@v1.11.0
- id: version
name: Set Provider Version
uses: pulumi/provider-version-action@v1
with:
repo: pulumi/pulumictl
- name: Add SDK version tag
run: git tag sdk/v$(pulumictl get version --language generic) && git push origin
sdk/v$(pulumictl get version --language generic)
name: tag_sdk
set-env: PROVIDER_VERSION
- name: Download go SDK
uses: actions/download-artifact@v4
with:
name: go-sdk.tar.gz
path: ${{ github.workspace}}/sdk/
- name: Uncompress go SDK
run: tar -zxf ${{github.workspace}}/sdk/go.tar.gz -C
${{github.workspace}}/sdk/go
- name: Publish Go SDK
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
files: |-
go.*
go/**
!*.tar.gz
dispatch_docs_build:
runs-on: ubuntu-latest
needs: tag_sdk
needs: publish_go_sdk
steps:
- name: Install pulumictl
uses: jaxxstorm/action-install-gh-release@v1.11.0

View File

@@ -81,14 +81,11 @@ jobs:
with:
lfs: true
ref: ${{ env.PR_COMMIT_SHA }}
- name: Checkout Scripts Repo
uses: actions/checkout@v4
- id: version
name: Set Provider Version
uses: pulumi/provider-version-action@v1
with:
path: ci-scripts
repository: pulumi/scripts
- run: echo "ci-scripts" >> .git/info/exclude
- name: Unshallow clone for tags
run: git fetch --prune --unshallow --tags
set-env: PROVIDER_VERSION
- name: Install Go
uses: actions/setup-go@v5
with:
@@ -138,7 +135,14 @@ jobs:
- name: Build Provider
run: make provider
- name: Check worktree clean
run: ./ci-scripts/ci/check-worktree-is-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
- run: git status --porcelain
- name: Tar provider binaries
run: tar -zcf ${{ github.workspace }}/bin/provider.tar.gz -C ${{
@@ -183,14 +187,11 @@ jobs:
with:
lfs: true
ref: ${{ env.PR_COMMIT_SHA }}
- name: Checkout Scripts Repo
uses: actions/checkout@v4
- id: version
name: Set Provider Version
uses: pulumi/provider-version-action@v1
with:
path: ci-scripts
repository: pulumi/scripts
- run: echo "ci-scripts" >> .git/info/exclude
- name: Unshallow clone for tags
run: git fetch --prune --unshallow --tags
set-env: PROVIDER_VERSION
- name: Install Go
uses: actions/setup-go@v5
with:
@@ -241,7 +242,14 @@ jobs:
- name: Build SDK
run: make build_${{ matrix.language }}
- name: Check worktree clean
run: ./ci-scripts/ci/check-worktree-is-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
- run: git status --porcelain
- name: Tar SDK folder
run: tar -zcf sdk/${{ matrix.language }}.tar.gz -C sdk/${{ matrix.language }} .
@@ -283,14 +291,11 @@ jobs:
with:
lfs: true
ref: ${{ env.PR_COMMIT_SHA }}
- name: Checkout Scripts Repo
uses: actions/checkout@v4
- id: version
name: Set Provider Version
uses: pulumi/provider-version-action@v1
with:
path: ci-scripts
repository: pulumi/scripts
- run: echo "ci-scripts" >> .git/info/exclude
- name: Unshallow clone for tags
run: git fetch --prune --unshallow --tags
set-env: PROVIDER_VERSION
- name: Install Go
uses: actions/setup-go@v5
with:

View File

@@ -54,8 +54,11 @@ jobs:
uses: actions/checkout@v4
with:
lfs: true
- name: Unshallow clone for tags
run: git fetch --prune --unshallow --tags
- id: version
name: Set Provider Version
uses: pulumi/provider-version-action@v1
with:
set-env: PROVIDER_VERSION
- name: Install Go
uses: actions/setup-go@v5
with:

12
CHANGELOG.md Normal file
View File

@@ -0,0 +1,12 @@
## Unreleased
## 0.0.2 (2024-04-25)
### Fixed
- Upgraded pulumi-go-provider to fix a panic during cancellation.
## 0.0.1 (2024-04-23)
Initial release.

View File

@@ -7,7 +7,6 @@ NODE_MODULE_NAME := @pulumi/docker-build
NUGET_PKG_NAME := Pulumi.DockerBuild
PROVIDER := pulumi-resource-${PACK}
VERSION ?= $(shell pulumictl get version)
PROVIDER_PATH := provider
VERSION_PATH := ${PROVIDER_PATH}.Version
SCHEMA_PATH := ${PROVIDER_PATH}/cmd/pulumi-resource-${PACK}/schema.json
@@ -21,6 +20,12 @@ TESTPARALLELISM := 4
PULUMI := bin/pulumi
GOGLANGCILINT := bin/golangci-lint
# Override during CI using `make [TARGET] PROVIDER_VERSION=""` or by setting a PROVIDER_VERSION environment variable
# Local & branch builds will just used this fixed default version unless specified
PROVIDER_VERSION ?= 1.0.0-alpha.0+dev
# Use this normalised version everywhere rather than the raw input to ensure consistency.
VERSION_GENERIC = $(shell pulumictl convert-version --language generic --version "$(PROVIDER_VERSION)")
.PHONY: ensure
ensure:: tidy lint test_provider examples
@@ -35,7 +40,7 @@ provider: bin/${PROVIDER} bin/pulumi-gen-${PACK} # Required by CI
local_generate: sdk # Required by CI
provider_debug::
(cd provider && go build -o $(WORKING_DIR)/bin/${PROVIDER} -gcflags="all=-N -l" -ldflags "-X ${PROJECT}/${VERSION_PATH}=${VERSION}" $(PROJECT)/${PROVIDER_PATH}/cmd/$(PROVIDER))
(cd provider && go build -o $(WORKING_DIR)/bin/${PROVIDER} -gcflags="all=-N -l" -ldflags "-X ${PROJECT}/${VERSION_PATH}=${VERSION_GENERIC}" $(PROJECT)/${PROVIDER_PATH}/cmd/$(PROVIDER))
test_provider:: # Required by CI
go test -short -v -coverprofile="coverage.txt" -coverpkg=./provider/... -timeout 2h -parallel ${TESTPARALLELISM} ./provider/...
@@ -176,7 +181,7 @@ ${SCHEMA_PATH}: bin/${PROVIDER}
pulumi package get-schema bin/${PROVIDER} > $(SCHEMA_PATH)
bin/${PROVIDER}: $(shell find ./provider -name '*.go') go.mod
(cd provider && go build -o ../bin/${PROVIDER} -ldflags "-X ${PROJECT}/${VERSION_PATH}=${VERSION}" $(PROJECT)/${PROVIDER_PATH}/cmd/$(PROVIDER))
(cd provider && go build -o ../bin/${PROVIDER} -ldflags "-X ${PROJECT}/${VERSION_PATH}=${VERSION_GENERIC}" $(PROJECT)/${PROVIDER_PATH}/cmd/$(PROVIDER))
bin/pulumi-gen-${PACK}: # Required by CI
touch bin/pulumi-gen-${PACK}
@@ -187,7 +192,7 @@ go.sum: go.mod
sdk: $(shell mkdir -p sdk)
sdk: sdk/python sdk/nodejs sdk/java sdk/python sdk/go sdk/dotnet
sdk/python: PYPI_VERSION := $(shell pulumictl get version --language python)
sdk/python: PYPI_VERSION := $(shell pulumictl convert-version --language python -v "$(VERSION_GENERIC)")
sdk/python: TMPDIR := $(shell mktemp -d)
sdk/python: $(PULUMI) bin/${PROVIDER}
rm -rf sdk/python
@@ -203,7 +208,7 @@ sdk/python: $(PULUMI) bin/${PROVIDER}
../venv/bin/python -m build .
mv -f ${TMPDIR}/python ${WORKING_DIR}/sdk/.
sdk/nodejs: NODE_VERSION := $(shell pulumictl get version --language javascript)
sdk/nodejs: NODE_VERSION := $(shell pulumictl convert-version --language javascript -v "$(VERSION_GENERIC)")
sdk/nodejs: TMPDIR := $(shell mktemp -d)
sdk/nodejs: $(PULUMI) bin/${PROVIDER}
rm -rf sdk/nodejs
@@ -228,7 +233,7 @@ sdk/go: $(PULUMI) bin/${PROVIDER}
go mod tidy
mv -f ${TMPDIR}/go ${WORKING_DIR}/sdk/go
sdk/dotnet: DOTNET_VERSION := $(shell pulumictl get version --language dotnet)
sdk/dotnet: DOTNET_VERSION := $(shell pulumictl convert-version --language dotnet -v "$(VERSION_GENERIC)")
sdk/dotnet: TMPDIR := $(shell mktemp -d)
sdk/dotnet: $(PULUMI) bin/${PROVIDER}
rm -rf sdk/dotnet
@@ -238,7 +243,7 @@ sdk/dotnet: $(PULUMI) bin/${PROVIDER}
dotnet build /p:Version=${DOTNET_VERSION}
mv -f ${TMPDIR}/dotnet ${WORKING_DIR}/sdk/.
sdk/java: PACKAGE_VERSION := $(shell pulumictl get version --language generic)
sdk/java: PACKAGE_VERSION := $(shell pulumictl convert-version --language generic -v "$(VERSION_GENERIC)")
sdk/java: TMPDIR := $(shell mktemp -d)
sdk/java: $(PULUMI) bin/${PROVIDER}
rm -rf sdk/java

View File

@@ -17,6 +17,7 @@ package internal
import (
"errors"
"fmt"
"reflect"
"strings"
controllerapi "github.com/docker/buildx/controller/pb"
@@ -460,6 +461,23 @@ func (c CacheFrom) String() string {
return join(c.Local, c.Registry, c.GHA, c.AZBlob, c.S3, c.Raw)
}
// Diff returns false if both cache entries are identical enough to ignore
// changes during diff. Differences to tokens are allowed.
func (c CacheFrom) Diff(other CacheFrom) bool {
if c.GHA != nil && other.GHA != nil {
other.GHA.Token = c.GHA.Token
}
if c.S3 != nil && other.S3 != nil {
other.S3.AccessKeyID = c.S3.AccessKeyID
other.S3.SecretAccessKey = c.S3.SecretAccessKey
other.S3.SessionToken = c.S3.SessionToken
}
if c.AZBlob != nil && other.AZBlob != nil {
other.AZBlob.SecretAccessKey = c.AZBlob.SecretAccessKey
}
return reflect.DeepEqual(c, other)
}
func (c CacheFrom) validate(preview bool) (*controllerapi.CacheOptionsEntry, error) {
if strings.Count(c.String(), "type=") > 1 {
return nil, errors.New("cacheFrom should only specify one cache type")
@@ -670,6 +688,23 @@ func (c CacheTo) String() string {
return join(c.Inline, c.Local, c.Registry, c.GHA, c.AZBlob, c.S3, c.Raw)
}
// Diff returns false if both cache entries are identical enough to ignore
// changes during diff. Differences to tokens are allowed.
func (c CacheTo) Diff(other CacheTo) bool {
if c.GHA != nil && other.GHA != nil {
other.GHA.Token = c.GHA.Token
}
if c.S3 != nil && other.S3 != nil {
other.S3.AccessKeyID = c.S3.AccessKeyID
other.S3.SecretAccessKey = c.S3.SecretAccessKey
other.S3.SessionToken = c.S3.SessionToken
}
if c.AZBlob != nil && other.AZBlob != nil {
other.AZBlob.SecretAccessKey = c.AZBlob.SecretAccessKey
}
return reflect.DeepEqual(c, other)
}
func (c CacheTo) validate(preview bool) (*controllerapi.CacheOptionsEntry, error) {
if strings.Count(c.String(), "type=") > 1 {
return nil, errors.New("cacheTo should only specify one cache type")

View File

@@ -80,7 +80,7 @@ func TestBuild(t *testing.T) {
t.Parallel()
tmpdir := t.TempDir()
max := Max
Max := Max
exampleContext := &BuildContext{Context: Context{Location: "../../examples/app"}}
@@ -122,7 +122,7 @@ func TestBuild(t *testing.T) {
Tags: []string{"cached"},
CacheTo: []CacheTo{{Local: &CacheToLocal{
Dest: filepath.Join(tmpdir, "cache"),
CacheWithMode: CacheWithMode{Mode: &max},
CacheWithMode: CacheWithMode{Mode: &Max},
}}},
CacheFrom: []CacheFrom{{Local: &CacheFromLocal{
Src: filepath.Join(tmpdir, "cache"),

View File

@@ -110,6 +110,7 @@ func (enc *ConfigEncoding) unmarshalOpts() plugin.MarshalOptions {
return plugin.MarshalOptions{
Label: "config",
KeepUnknowns: true,
KeepSecrets: true,
SkipNulls: true,
RejectAssets: true,
}
@@ -179,12 +180,11 @@ func (enc *ConfigEncoding) UnmarshalProperties(
// And now unmarshal every field it into the map.
for _, key := range keys {
pk := resource.PropertyKey(key)
v, err := enc.unmarshalPropertyValue(pk, props[key])
v, err := enc.unmarshalPropertyValue(key, props[key])
if err != nil {
return nil, err
return resource.PropertyMap{}, err
}
result[pk] = v
result[key] = v
}
return result, nil

View File

@@ -16,23 +16,23 @@ package deprecated
import (
"fmt"
"strconv"
"testing"
"github.com/stretchr/testify/assert"
structpb "google.golang.org/protobuf/types/known/structpb"
"github.com/stretchr/testify/require"
"github.com/pulumi/pulumi/pkg/v3/codegen/schema"
"github.com/pulumi/pulumi/sdk/v3/go/common/resource"
"github.com/pulumi/pulumi/sdk/v3/go/common/resource/plugin"
)
func TestConfigEncoding(t *testing.T) {
t.Parallel()
type testCase struct {
ty schema.TypeSpec
v *structpb.Value
pv resource.PropertyValue
ty schema.TypeSpec
given resource.PropertyValue
want resource.PropertyValue
}
knownKey := "mykey"
@@ -49,69 +49,64 @@ func TestConfigEncoding(t *testing.T) {
)
}
makeValue := func(x any) *structpb.Value {
vv, err := structpb.NewValue(x)
assert.NoErrorf(t, err, "structpb.NewValue failed")
return vv
}
checkUnmarshal := func(t *testing.T, tc testCase) {
enc := makeEnc(tc.ty)
pv, err := enc.unmarshalPropertyValue(resource.PropertyKey(knownKey), tc.v)
assert.NoError(t, err)
assert.NotNil(t, pv)
assert.Equal(t, tc.pv, *pv)
key := resource.PropertyKey(knownKey)
actual, err := enc.unmarshalPropertyValue(key, tc.given)
require.NoError(t, err)
assert.Equal(t, tc.want, actual)
}
turnaroundTestCases := []testCase{
{
schema.TypeSpec{Type: "boolean"},
makeValue(`true`),
resource.NewPropertyValue(`true`),
resource.NewBoolProperty(true),
},
{
schema.TypeSpec{Type: "boolean"},
makeValue(`false`),
resource.NewPropertyValue(`false`),
resource.NewBoolProperty(false),
},
{
schema.TypeSpec{Type: "integer"},
makeValue(`0`),
resource.NewPropertyValue(`0`),
resource.NewNumberProperty(0),
},
{
schema.TypeSpec{Type: "integer"},
makeValue(`42`),
resource.NewPropertyValue(`42`),
resource.NewNumberProperty(42),
},
{
schema.TypeSpec{Type: "number"},
makeValue(`0`),
resource.NewPropertyValue(`0`),
resource.NewNumberProperty(0.0),
},
{
schema.TypeSpec{Type: "number"},
makeValue(`42.5`),
resource.NewPropertyValue(`42.5`),
resource.NewNumberProperty(42.5),
},
{
schema.TypeSpec{Type: "string"},
structpb.NewStringValue(""),
resource.NewStringProperty(""),
resource.NewStringProperty(""),
},
{
schema.TypeSpec{Type: "string"},
structpb.NewStringValue("hello"),
resource.NewStringProperty("hello"),
resource.NewStringProperty("hello"),
},
{
schema.TypeSpec{Type: "array"},
makeValue(`[]`),
resource.NewPropertyValue(`[]`),
resource.NewArrayProperty([]resource.PropertyValue{}),
},
{
schema.TypeSpec{Type: "array"},
makeValue(`["hello","there"]`),
resource.NewPropertyValue(`["hello","there"]`),
resource.NewArrayProperty([]resource.PropertyValue{
resource.NewStringProperty("hello"),
resource.NewStringProperty("there"),
@@ -119,12 +114,12 @@ func TestConfigEncoding(t *testing.T) {
},
{
schema.TypeSpec{Type: "object"},
makeValue(`{}`),
resource.NewPropertyValue(`{}`),
resource.NewObjectProperty(resource.PropertyMap{}),
},
{
schema.TypeSpec{Type: "object"},
makeValue(`{"key":"value"}`),
resource.NewPropertyValue(`{"key":"value"}`),
resource.NewObjectProperty(resource.PropertyMap{
"key": resource.NewStringProperty("value"),
}),
@@ -135,7 +130,7 @@ func TestConfigEncoding(t *testing.T) {
for i, tc := range turnaroundTestCases {
tc := tc
t.Run(fmt.Sprintf("UnmarshalPropertyValue/%d", i), func(t *testing.T) {
t.Run(strconv.Itoa(i), func(t *testing.T) {
t.Parallel()
checkUnmarshal(t, tc)
})
@@ -147,32 +142,32 @@ func TestConfigEncoding(t *testing.T) {
cases := []testCase{
{
schema.TypeSpec{Type: "boolean"},
makeValue(""),
resource.NewPropertyValue(""),
resource.NewBoolProperty(false),
},
{
schema.TypeSpec{Type: "number"},
makeValue(""),
resource.NewPropertyValue(""),
resource.NewNumberProperty(0.),
},
{
schema.TypeSpec{Type: "integer"},
makeValue(""),
resource.NewPropertyValue(""),
resource.NewNumberProperty(0),
},
{
schema.TypeSpec{Type: "string"},
makeValue(""),
resource.NewPropertyValue(""),
resource.NewStringProperty(""),
},
{
schema.TypeSpec{Type: "object"},
makeValue(""),
resource.NewPropertyValue(""),
resource.NewObjectProperty(make(resource.PropertyMap)),
},
{
schema.TypeSpec{Type: "array"},
makeValue(""),
resource.NewPropertyValue(""),
resource.NewArrayProperty([]resource.PropertyValue{}),
},
}
@@ -187,18 +182,18 @@ func TestConfigEncoding(t *testing.T) {
})
t.Run("computed", func(t *testing.T) {
unk := makeValue(plugin.UnknownStringValue)
unk := resource.MakeComputed(resource.NewStringProperty(""))
for i, tc := range turnaroundTestCases {
tc := tc
t.Run(fmt.Sprintf("UnmarshalPropertyValue/%d", i), func(t *testing.T) {
t.Run(strconv.Itoa(i), func(t *testing.T) {
t.Parallel()
// Unknown sentinel unmarshals to a Computed with a type-appropriate zero value.
checkUnmarshal(t, testCase{
tc.ty,
unk,
resource.MakeComputed(makeEnc(tc.ty).zeroValue(tc.ty.Type)),
ty: tc.ty,
given: unk,
want: resource.MakeComputed(makeEnc(tc.ty).zeroValue(tc.ty.Type)),
})
})
}
@@ -215,46 +210,30 @@ func TestConfigEncoding(t *testing.T) {
var secretCases []testCase
pbSecret := func(v *structpb.Value) *structpb.Value {
return structpb.NewStructValue(&structpb.Struct{Fields: map[string]*structpb.Value{
"4dabf18193072939515e22adb298388d": makeValue("1b47061264138c4ac30d75fd1eb44270"),
"value": v,
}})
}
for _, tc := range turnaroundTestCases {
secretCases = append(secretCases, testCase{
tc.ty,
pbSecret(tc.v),
resource.MakeSecret(tc.pv),
ty: tc.ty,
given: resource.MakeSecret(tc.given),
want: resource.MakeSecret(tc.want),
})
}
for i, tc := range secretCases {
tc := tc
t.Run(fmt.Sprintf("secret/UnmarshalPropertyValue/%d", i), func(t *testing.T) {
t.Run(strconv.Itoa(i), func(t *testing.T) {
t.Parallel()
// Unmarshallin will remove secrts, so the expected value needs to be modified.
tc.pv = tc.pv.SecretValue().Element
checkUnmarshal(t, tc)
})
}
t.Run("tolerate secrets in Configure", func(t *testing.T) {
// This is a bit of a histirocal quirk: the engine may send secrets to Configure before
// receiving the response from Configure indicating that the provider does not want to receive
// secrets. These are simply ignored. The engine does not currently send secrets to CheckConfig.
// The engine does take care of making sure the secrets are stored as such in the statefile.
//
// Check here that unmarshalilng such values removes the secrets.
t.Run("nested secrets", func(t *testing.T) {
checkUnmarshal(t, testCase{
schema.TypeSpec{Type: "object"},
pbSecret(makeValue(`{"key":"val"}`)),
resource.NewObjectProperty(resource.PropertyMap{
resource.MakeSecret(resource.NewPropertyValue(`{"key":"val"}`)),
resource.MakeSecret(resource.NewObjectProperty(resource.PropertyMap{
"key": resource.NewStringProperty("val"),
}),
})),
})
})
})
@@ -262,7 +241,7 @@ func TestConfigEncoding(t *testing.T) {
regressUnmarshalTestCases := []testCase{
{
schema.TypeSpec{Type: "array"},
makeValue(`
resource.NewPropertyValue(`
[
{
"address": "somewhere.org",
@@ -276,7 +255,7 @@ func TestConfigEncoding(t *testing.T) {
resource.NewArrayProperty([]resource.PropertyValue{
resource.NewObjectProperty(resource.PropertyMap{
"address": resource.NewStringProperty("somewhere.org"),
"password": resource.NewStringProperty("some-password"),
"password": resource.MakeSecret(resource.NewStringProperty("some-password")),
"username": resource.NewStringProperty("some-user"),
}),
}),
@@ -286,7 +265,7 @@ func TestConfigEncoding(t *testing.T) {
t.Run("regress-unmarshal", func(t *testing.T) {
for i, tc := range regressUnmarshalTestCases {
tc := tc
t.Run(fmt.Sprintf("UnmarshalPropertyValue/%d", i), func(t *testing.T) {
t.Run(strconv.Itoa(i), func(t *testing.T) {
t.Parallel()
checkUnmarshal(t, tc)
})

View File

@@ -328,8 +328,8 @@ func (is *ImageState) Annotate(a infer.Annotator) {
`))
}
// client produces a CLI client with scoped to this resource and layered on top
// of any host-level credentials.
// client produces a CLI client scoped to this resource and layered on top of
// any host-level credentials.
func (i *Image) client(ctx context.Context, state ImageState, args ImageArgs) (Client, error) {
cfg := infer.GetConfig[Config](ctx)
@@ -889,12 +889,6 @@ func (*Image) Diff(
if !reflect.DeepEqual(olds.Builder, news.Builder) {
diff["builder"] = update
}
if !reflect.DeepEqual(olds.CacheFrom, news.CacheFrom) {
diff["cacheFrom"] = update
}
if !reflect.DeepEqual(olds.CacheTo, news.CacheTo) {
diff["cacheTo"] = update
}
if olds.Context.Location != news.Context.Location {
diff["context.location"] = update
}
@@ -975,6 +969,31 @@ func (*Image) Diff(
break
}
}
// The GHA cache needs similar handling to ignore changes to the token.
if len(olds.CacheFrom) != len(news.CacheFrom) {
diff["cacheFrom"] = update
} else {
for idx, oldc := range olds.CacheFrom {
newc := news.CacheFrom[idx]
if newc.Diff(oldc) {
continue
}
diff[fmt.Sprintf("cacheFrom[%d]", idx)] = update
break
}
}
if len(olds.CacheTo) != len(news.CacheTo) {
diff["cacheTo"] = update
} else {
for idx, oldc := range olds.CacheTo {
newc := news.CacheTo[idx]
if !newc.Diff(oldc) {
continue
}
diff[fmt.Sprintf("cacheTo[%d]", idx)] = update
break
}
}
return provider.DiffResponse{
HasChanges: len(diff) > 0,

View File

@@ -370,7 +370,7 @@ func TestRead(t *testing.T) {
}
func TestImageDiff(t *testing.T) {
t.Parallel()
// t.Parallel()
emptyDir := t.TempDir()
host := Host
@@ -419,6 +419,106 @@ func TestImageDiff(t *testing.T) {
},
wantChanges: false,
},
{
name: "no diff if cache tokens change",
olds: func(_ *testing.T, s ImageState) ImageState {
s.CacheTo = []CacheTo{
{
GHA: &CacheToGitHubActions{
CacheFromGitHubActions: CacheFromGitHubActions{
URL: "unchanged-cacheto-url",
Token: "old-cacheto-token",
},
},
},
{
S3: &CacheToS3{
CacheFromS3: CacheFromS3{
AccessKeyID: "old-cacheto-access-key-id",
SecretAccessKey: "old-cacheto-secret-access-key",
SessionToken: "old-cacheto-session-token",
},
},
},
{
AZBlob: &CacheToAzureBlob{
CacheFromAzureBlob: CacheFromAzureBlob{
SecretAccessKey: "old-cacheto-secret-access-key",
},
},
},
}
s.CacheFrom = []CacheFrom{
{
GHA: &CacheFromGitHubActions{
URL: "unchanged-cachefrom-url",
Token: "old-cachefrom-token",
},
},
{
S3: &CacheFromS3{
AccessKeyID: "old-cachefrom-access-key-id",
SecretAccessKey: "old-cachefrom-secret-access-key",
SessionToken: "old-cachefrom-session-token",
},
},
{
AZBlob: &CacheFromAzureBlob{
SecretAccessKey: "old-cachefrom-secret-access-key",
},
},
}
return s
},
news: func(_ *testing.T, a ImageArgs) ImageArgs {
a.CacheTo = []CacheTo{
{
GHA: &CacheToGitHubActions{
CacheFromGitHubActions: CacheFromGitHubActions{
URL: "unchanged-cacheto-url",
Token: "new-cacheto-token",
},
},
},
{
S3: &CacheToS3{
CacheFromS3: CacheFromS3{
AccessKeyID: "new-cacheto-access-key-id",
SecretAccessKey: "new-cacheto-secret-access-key",
SessionToken: "new-cacheto-session-token",
},
},
},
{
AZBlob: &CacheToAzureBlob{
CacheFromAzureBlob: CacheFromAzureBlob{
SecretAccessKey: "new-cacheto-secret-access-key",
},
},
},
}
a.CacheFrom = []CacheFrom{
{
GHA: &CacheFromGitHubActions{
URL: "unchanged-cachefrom-url",
Token: "new-cachefrom-token",
},
}, {
S3: &CacheFromS3{
AccessKeyID: "new-cachefrom-access-key-id",
SecretAccessKey: "new-cachefrom-secret-access-key",
SessionToken: "new-cachefrom-session-token",
},
}, {
AZBlob: &CacheFromAzureBlob{
SecretAccessKey: "new-cachefrom-secret-access-key",
},
},
}
return a
},
wantChanges: false,
},
{
name: "no diff if pull=true but no exports",
olds: func(_ *testing.T, is ImageState) ImageState {
@@ -431,6 +531,108 @@ func TestImageDiff(t *testing.T) {
},
wantChanges: false,
},
{
name: "diff if gha cache parameters change",
olds: func(_ *testing.T, s ImageState) ImageState {
s.CacheTo = []CacheTo{{
GHA: &CacheToGitHubActions{
CacheFromGitHubActions: CacheFromGitHubActions{
Scope: "old-cacheto-scope",
},
},
}}
s.CacheFrom = []CacheFrom{{
GHA: &CacheFromGitHubActions{
Scope: "old-cachefrom-scope",
},
}}
return s
},
news: func(_ *testing.T, a ImageArgs) ImageArgs {
a.CacheTo = []CacheTo{{
GHA: &CacheToGitHubActions{
CacheFromGitHubActions: CacheFromGitHubActions{
Scope: "new-cacheto-scope",
},
},
}}
a.CacheFrom = []CacheFrom{{
GHA: &CacheFromGitHubActions{
Scope: "new-cachefrom-scope",
},
}}
return a
},
wantChanges: true,
},
{
name: "diff if s3 cache parameters change",
olds: func(_ *testing.T, s ImageState) ImageState {
s.CacheTo = []CacheTo{{
S3: &CacheToS3{
CacheFromS3: CacheFromS3{
Region: "old-cacheto-region",
},
},
}}
s.CacheFrom = []CacheFrom{{
S3: &CacheFromS3{
Region: "old-cachefrom-region",
},
}}
return s
},
news: func(_ *testing.T, a ImageArgs) ImageArgs {
a.CacheTo = []CacheTo{{
S3: &CacheToS3{
CacheFromS3: CacheFromS3{
Region: "new-cacheto-region",
},
},
}}
a.CacheFrom = []CacheFrom{{
S3: &CacheFromS3{
Region: "new-cachefrom-region",
},
}}
return a
},
wantChanges: true,
},
{
name: "diff if azblob cache parameters change",
olds: func(_ *testing.T, s ImageState) ImageState {
s.CacheTo = []CacheTo{{
AZBlob: &CacheToAzureBlob{
CacheFromAzureBlob: CacheFromAzureBlob{
Name: "old-cacheto-name",
},
},
}}
s.CacheFrom = []CacheFrom{{
AZBlob: &CacheFromAzureBlob{
Name: "old-cachefrom-name",
},
}}
return s
},
news: func(_ *testing.T, a ImageArgs) ImageArgs {
a.CacheTo = []CacheTo{{
AZBlob: &CacheToAzureBlob{
CacheFromAzureBlob: CacheFromAzureBlob{
Name: "new-cacheto-name",
},
},
}}
a.CacheFrom = []CacheFrom{{
AZBlob: &CacheFromAzureBlob{
Name: "new-cachefrom-name",
},
}}
return a
},
wantChanges: true,
},
{
name: "diff if pull=true with exports",
olds: func(_ *testing.T, is ImageState) ImageState {
@@ -961,14 +1163,14 @@ func TestBuildable(t *testing.T) {
func TestToBuild(t *testing.T) {
t.Parallel()
max := Max
Max := Max
ia := ImageArgs{
Tags: []string{"foo", "bar"},
Platforms: []Platform{"linux/amd64"},
Context: &BuildContext{Context: Context{Location: "testdata/noop"}},
CacheTo: []CacheTo{
{GHA: &CacheToGitHubActions{CacheWithMode: CacheWithMode{&max}}},
{GHA: &CacheToGitHubActions{CacheWithMode: CacheWithMode{&Max}}},
{
Registry: &CacheToRegistry{
CacheFromRegistry: CacheFromRegistry{Ref: "docker.io/foo/bar"},

View File

@@ -151,7 +151,7 @@ func (i *Index) Update(
return state, nil
}
provider.GetLogger(ctx).Debug(fmt.Sprintf("creating index with tag %s and sources %s", input.Tag, input.Sources))
provider.GetLogger(ctx).Debugf("creating index with tag %s and sources %s", input.Tag, input.Sources)
err = cli.ManifestCreate(ctx, input.Push, input.Tag, input.Sources...)
if err != nil {
@@ -309,8 +309,8 @@ func (i *Index) Diff(
}, nil
}
// client produces a CLI client with scoped to this resource and layered on top
// of any host-level credentials.
// client produces a CLI client scoped to this resource and layered on top of
// any host-level credentials.
func (i *Index) client(
ctx context.Context,
_ IndexState,

View File

@@ -1 +0,0 @@
{}

View File

@@ -18,13 +18,12 @@ import (
"context"
"encoding/json"
"github.com/pulumi/pulumi-docker-build/provider/internal"
"github.com/pulumi/pulumi-docker-build/provider/internal/deprecated"
gp "github.com/pulumi/pulumi-go-provider"
"github.com/pulumi/pulumi/pkg/v3/codegen/schema"
"github.com/pulumi/pulumi/pkg/v3/resource/provider"
rpc "github.com/pulumi/pulumi/sdk/v3/proto/go"
"github.com/pulumi/pulumi-docker-build/provider/internal"
"github.com/pulumi/pulumi-docker-build/provider/internal/deprecated"
)
// Version is initialized by the Go linker to contain the semver of this build.

View File

@@ -24,10 +24,10 @@ import (
emptypb "google.golang.org/protobuf/types/known/emptypb"
"google.golang.org/protobuf/types/known/structpb"
"github.com/pulumi/pulumi-docker-build/provider/internal"
provider "github.com/pulumi/pulumi-go-provider"
"github.com/pulumi/pulumi-go-provider/integration"
"github.com/pulumi/pulumi/sdk/v3/go/common/resource/plugin"
rpc "github.com/pulumi/pulumi/sdk/v3/proto/go"
)
// TestConfigure checks backwards-compatibility with SDKs that still send
@@ -37,35 +37,19 @@ import (
func TestConfigure(t *testing.T) {
t.Parallel()
p, err := New(nil)
require.NoError(t, err)
p := configurableProvider(internal.NewBuildxProvider())
args, err := structpb.NewStruct(map[string]any{
"registries": `[{"address": "docker.io"}]`,
})
require.NoError(t, err)
// Ideally we would just call p.Configure directly, but we need the
// integration server to inject runtime info for us.
argsMap, err := plugin.UnmarshalProperties(args, plugin.MarshalOptions{})
require.NoError(t, err)
s := integration.NewServer("docker-build", semver.Version{Major: 0}, provider.Provider{
// Roundabout way to get the integration server to invoke our outermost
// Configure RPC endpoint.
Configure: func(ctx context.Context, req provider.ConfigureRequest) error {
args, err := plugin.MarshalProperties(req.Args, plugin.MarshalOptions{})
require.NoError(t, err)
_, err = p.Configure(ctx, &rpc.ConfigureRequest{
Variables: req.Variables,
Args: args,
})
return err
},
})
s := integration.NewServer("docker-build", semver.Version{Major: 0}, p)
err = s.Configure(provider.ConfigureRequest{
Args: argsMap,
})
assert.NoError(t, err)
}