diff --git a/.github/workflows/community-moderation.yml b/.github/workflows/community-moderation.yml index 647c712d..68eb7f6d 100644 --- a/.github/workflows/community-moderation.yml +++ b/.github/workflows/community-moderation.yml @@ -38,7 +38,6 @@ name: warn-codegen on: pull_request_target: branches: - - main - master types: - opened diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml deleted file mode 100644 index e60b5e94..00000000 --- a/.github/workflows/main.yml +++ /dev/null @@ -1,467 +0,0 @@ -# WARNING: This file is autogenerated - changes will be overwritten if not made via https://github.com/pulumi/ci-mgmt - -env: - PROVIDER: wavefront - DOTNETVERSION: | - 6.0.x - 3.1.301 - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - GOVERSION: 1.21.x - JAVAVERSION: "11" - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - NODEVERSION: 16.x - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - NUGET_PUBLISH_KEY: ${{ secrets.NUGET_PUBLISH_KEY }} - PUBLISH_REPO_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} - PUBLISH_REPO_USERNAME: ${{ secrets.OSSRH_USERNAME }} - PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }} - PULUMI_API: https://api.pulumi-staging.io - PULUMI_GO_DEP_ROOT: ${{ github.workspace }}/.. - PULUMI_LOCAL_NUGET: ${{ github.workspace }}/nuget - PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }} - PYTHONVERSION: "3.9" - SIGNING_KEY: ${{ secrets.JAVA_SIGNING_KEY }} - SIGNING_KEY_ID: ${{ secrets.JAVA_SIGNING_KEY_ID }} - SIGNING_PASSWORD: ${{ secrets.JAVA_SIGNING_PASSWORD }} - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} - TF_APPEND_USER_AGENT: pulumi - TRAVIS_OS_NAME: linux - WAVEFRONT_ADDRESS: ${{ secrets.WAVEFRONT_ADDRESS }} - WAVEFRONT_TOKEN: ${{ secrets.WAVEFRONT_TOKEN }} -jobs: - build_sdk: - name: build_sdk - needs: prerequisites - runs-on: ubuntu-latest - steps: - - name: Checkout Repo - uses: actions/checkout@v3 - - name: Checkout Scripts Repo - uses: actions/checkout@v3 - with: - path: ci-scripts - repository: pulumi/scripts - - name: Unshallow clone for tags - run: git fetch --prune --unshallow --tags - - name: Install Go - uses: actions/setup-go@v4 - with: - cache-dependency-path: | - sdk/go.sum - go-version: 1.21.x - - name: Install pulumictl - uses: jaxxstorm/action-install-gh-release@v1.5.0 - with: - repo: pulumi/pulumictl - - name: Install Pulumi CLI - uses: pulumi/action-install-pulumi-cli@v2 - - name: Setup Node - uses: actions/setup-node@v2 - with: - node-version: ${{ env.NODEVERSION }} - registry-url: https://registry.npmjs.org - - name: Setup DotNet - uses: actions/setup-dotnet@v1 - with: - dotnet-version: ${{ env.DOTNETVERSION }} - - name: Setup Python - uses: actions/setup-python@v2 - with: - python-version: ${{ env.PYTHONVERSION }} - - name: Setup Java - uses: actions/setup-java@v3 - with: - cache: gradle - distribution: temurin - java-version: ${{ env.JAVAVERSION }} - - name: Setup Gradle - uses: gradle/gradle-build-action@v2 - with: - gradle-version: "7.6" - - name: Download provider + tfgen binaries - uses: actions/download-artifact@v2 - with: - name: ${{ env.PROVIDER }}-provider.tar.gz - path: ${{ github.workspace }}/bin - - name: Untar provider binaries - run: >- - tar -zxf ${{ github.workspace }}/bin/provider.tar.gz -C ${{ - github.workspace}}/bin - - find ${{ github.workspace }} -name "pulumi-*-${{ env.PROVIDER }}" -print -exec chmod +x {} \; - - name: Install plugins - run: make install_plugins - - name: Update path - run: echo "${{ github.workspace }}/bin" >> "$GITHUB_PATH" - - name: Set PACKAGE_VERSION to Env - run: echo "PACKAGE_VERSION=$(pulumictl get version --language generic)" >> - "$GITHUB_ENV" - - name: Build SDK - run: make build_${{ matrix.language }} - - name: Check worktree clean - run: ./ci-scripts/ci/check-worktree-is-clean - - name: Compress SDK folder - run: tar -zcf sdk/${{ matrix.language }}.tar.gz -C sdk/${{ matrix.language }} . - - name: Upload artifacts - uses: actions/upload-artifact@v2 - with: - name: ${{ matrix.language }}-sdk.tar.gz - path: ${{ github.workspace}}/sdk/${{ matrix.language }}.tar.gz - retention-days: 30 - - if: failure() && github.event_name == 'push' - name: Notify Slack - uses: 8398a7/action-slack@v3 - with: - author_name: Failure in building ${{ matrix.language }} sdk - fields: repo,commit,author,action - status: ${{ job.status }} - strategy: - fail-fast: true - matrix: - language: - - nodejs - - python - - dotnet - - go - - java - generate_coverage_data: - continue-on-error: true - env: - COVERAGE_OUTPUT_DIR: ${{ secrets.COVERAGE_OUTPUT_DIR }} - name: generate_coverage_data - needs: prerequisites - runs-on: ubuntu-latest - steps: - - name: Checkout Repo - uses: actions/checkout@v3 - - name: Configure AWS Credentials - uses: aws-actions/configure-aws-credentials@v1 - with: - aws-access-key-id: ${{ secrets.AWS_CORP_S3_UPLOAD_ACCESS_KEY_ID }} - aws-region: us-west-2 - aws-secret-access-key: ${{ secrets.AWS_CORP_S3_UPLOAD_SECRET_ACCESS_KEY }} - - name: Checkout Scripts Repo - uses: actions/checkout@v3 - with: - path: ci-scripts - repository: pulumi/scripts - - name: Unshallow clone for tags - run: git fetch --prune --unshallow --tags - - name: Install Go - uses: actions/setup-go@v4 - with: - cache-dependency-path: | - sdk/go.sum - go-version: 1.21.x - - name: Install pulumictl - uses: jaxxstorm/action-install-gh-release@v1.5.0 - with: - repo: pulumi/pulumictl - - name: Install Pulumi CLI - uses: pulumi/action-install-pulumi-cli@v2 - - if: github.event_name == 'pull_request' - name: Install Schema Tools - uses: jaxxstorm/action-install-gh-release@v1.5.0 - with: - repo: pulumi/schema-tools - - name: Echo Coverage Output Dir - run: 'echo "Coverage output directory: ${{ env.COVERAGE_OUTPUT_DIR }}"' - - name: Generate Coverage Data - run: make tfgen - - name: Summarize Provider Coverage Results - run: cat ${{ env.COVERAGE_OUTPUT_DIR }}/shortSummary.txt - - name: Upload coverage data to S3 - run: >- - summaryName="${PROVIDER}_summary_$(date +"%Y-%m-%d_%H-%M-%S").json" - - s3FullURI="s3://${{ secrets.S3_COVERAGE_BUCKET_NAME }}/summaries/${summaryName}" - - aws s3 cp "${{ env.COVERAGE_OUTPUT_DIR }}/summary.json" "${s3FullURI}" --acl bucket-owner-full-control - lint: - container: golangci/golangci-lint:v1.54.1 - name: lint - runs-on: ubuntu-latest - steps: - - name: Checkout Repo - uses: actions/checkout@v3 - - name: Checkout Scripts Repo - uses: actions/checkout@v3 - with: - path: ci-scripts - repository: pulumi/scripts - - name: Mark repo as safe directory - run: git config --global --add safe.directory /__w/pulumi-${{ env.PROVIDER }}/pulumi-${{ env.PROVIDER }} - - name: Unshallow clone for tags - run: git fetch --prune --unshallow --tags - - name: Install Go - uses: actions/setup-go@v4 - with: - cache-dependency-path: | - sdk/go.sum - go-version: 1.21.x - - name: Install pulumictl - uses: jaxxstorm/action-install-gh-release@v1.5.0 - with: - repo: pulumi/pulumictl - - name: Install Pulumi CLI - uses: pulumi/action-install-pulumi-cli@v2 - - run: make lint_provider - - if: failure() && github.event_name == 'push' - name: Notify Slack - uses: 8398a7/action-slack@v3 - with: - author_name: Failure in linting provider - fields: repo,commit,author,action - status: ${{ job.status }} - prerequisites: - name: prerequisites - runs-on: ubuntu-latest - steps: - - name: Checkout Repo - uses: actions/checkout@v3 - - name: Checkout Scripts Repo - uses: actions/checkout@v3 - with: - path: ci-scripts - repository: pulumi/scripts - - name: Unshallow clone for tags - run: git fetch --prune --unshallow --tags - - name: Install Go - uses: actions/setup-go@v4 - with: - cache-dependency-path: | - sdk/go.sum - go-version: 1.21.x - - name: Install pulumictl - uses: jaxxstorm/action-install-gh-release@v1.5.0 - with: - repo: pulumi/pulumictl - - name: Install Pulumi CLI - uses: pulumi/action-install-pulumi-cli@v2 - - if: github.event_name == 'pull_request' - name: Install Schema Tools - uses: jaxxstorm/action-install-gh-release@v1.5.0 - with: - repo: pulumi/schema-tools - - name: Build tfgen & provider binaries - run: make provider - - if: github.event_name == 'pull_request' - name: Check Schema is Valid - run: | - EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64) - { - echo "SCHEMA_CHANGES<<$EOF"; - schema-tools compare -p ${{ env.PROVIDER }} -o ${{ github.event.repository.default_branch }} -n --local-path=provider/cmd/pulumi-resource-${{ env.PROVIDER }}/schema.json; - echo "$EOF"; - } >> "$GITHUB_ENV" - - if: github.event_name == 'pull_request' && github.actor != 'dependabot[bot]' - name: Comment on PR with Details of Schema Check - uses: thollander/actions-comment-pull-request@v2 - with: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - comment_tag: schemaCheck - message: >+ - ### Does the PR have any schema changes? - - - ${{ env.SCHEMA_CHANGES }} - - - Maintainer note: consult the [runbook](https://github.com/pulumi/platform-providers-team/blob/main/playbooks/tf-provider-updating.md) for dealing with any breaking changes. - - - name: Tar provider binaries - run: tar -zcf ${{ github.workspace }}/bin/provider.tar.gz -C ${{ - github.workspace }}/bin/ pulumi-resource-${{ env.PROVIDER }} - pulumi-tfgen-${{ env.PROVIDER }} - - name: Upload artifacts - uses: actions/upload-artifact@v2 - with: - name: ${{ env.PROVIDER }}-provider.tar.gz - path: ${{ github.workspace }}/bin/provider.tar.gz - retention-days: 30 - - if: failure() && github.event_name == 'push' - name: Notify Slack - uses: 8398a7/action-slack@v3 - with: - author_name: Failure in building provider prerequisites - fields: repo,commit,author,action - status: ${{ job.status }} - publish: - name: publish - needs: test - runs-on: ubuntu-latest - steps: - - name: Checkout Repo - uses: actions/checkout@v3 - - name: Unshallow clone for tags - run: git fetch --prune --unshallow --tags - - name: Install Go - uses: actions/setup-go@v4 - with: - cache-dependency-path: | - sdk/go.sum - go-version: 1.21.x - - name: Install pulumictl - uses: jaxxstorm/action-install-gh-release@v1.5.0 - with: - repo: pulumi/pulumictl - - name: Install Pulumi CLI - uses: pulumi/action-install-pulumi-cli@v2 - - name: Configure AWS Credentials - uses: aws-actions/configure-aws-credentials@v1 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - aws-region: us-east-2 - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - role-duration-seconds: 7200 - role-external-id: upload-pulumi-release - role-session-name: ${{ env.PROVIDER }}@githubActions - 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@v2 - with: - args: -p 3 -f .goreleaser.prerelease.yml --rm-dist --skip-validate --timeout - 60m0s - version: latest - - if: failure() && github.event_name == 'push' - name: Notify Slack - uses: 8398a7/action-slack@v3 - with: - author_name: Failure in publishing binaries - fields: repo,commit,author,action - status: ${{ job.status }} - publish_sdk: - name: publish_sdk - needs: publish - runs-on: ubuntu-latest - steps: - - name: Publish SDKs - uses: pulumi/pulumi-package-publisher@v0.0.9 - - env: - SLACK_CHANNEL: provider-upgrade-publish-status - SLACK_COLOR: "#FF0000" - SLACK_ICON_EMOJI: ":taco:" - SLACK_MESSAGE: "Publish failed :x:" - SLACK_TITLE: ${{ github.event.repository.name }} upgrade result - SLACK_USERNAME: provider-bot - SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }} - if: failure() - name: Send Publish Failure To Slack - uses: rtCamp/action-slack-notify@v2 - test: - name: test - needs: build_sdk - permissions: - contents: read - id-token: write - runs-on: ubuntu-latest - steps: - - name: Checkout Repo - uses: actions/checkout@v3 - - name: Checkout Scripts Repo - uses: actions/checkout@v3 - with: - path: ci-scripts - repository: pulumi/scripts - - name: Unshallow clone for tags - run: git fetch --prune --unshallow --tags - - name: Install Go - uses: actions/setup-go@v4 - with: - cache-dependency-path: | - sdk/go.sum - go-version: 1.21.x - - name: Install pulumictl - uses: jaxxstorm/action-install-gh-release@v1.5.0 - with: - repo: pulumi/pulumictl - - name: Install Pulumi CLI - uses: pulumi/action-install-pulumi-cli@v2 - - name: Setup Node - uses: actions/setup-node@v2 - with: - node-version: ${{ env.NODEVERSION }} - registry-url: https://registry.npmjs.org - - name: Setup DotNet - uses: actions/setup-dotnet@v1 - with: - dotnet-version: ${{ env.DOTNETVERSION }} - - name: Setup Python - uses: actions/setup-python@v2 - with: - python-version: ${{ env.PYTHONVERSION }} - - name: Setup Java - uses: actions/setup-java@v3 - with: - cache: gradle - distribution: temurin - java-version: ${{ env.JAVAVERSION }} - - name: Setup Gradle - uses: gradle/gradle-build-action@v2 - with: - gradle-version: "7.6" - - name: Download provider + tfgen binaries - uses: actions/download-artifact@v2 - with: - name: ${{ env.PROVIDER }}-provider.tar.gz - path: ${{ github.workspace }}/bin - - name: Untar provider binaries - run: >- - tar -zxf ${{ github.workspace }}/bin/provider.tar.gz -C ${{ - github.workspace}}/bin - - find ${{ github.workspace }} -name "pulumi-*-${{ env.PROVIDER }}" -print -exec chmod +x {} \; - - run: dotnet nuget add source ${{ github.workspace }}/nuget - - name: Download SDK - uses: actions/download-artifact@v2 - with: - name: ${{ matrix.language }}-sdk.tar.gz - path: ${{ github.workspace}}/sdk/ - - name: Uncompress SDK folder - run: tar -zxf ${{ github.workspace }}/sdk/${{ matrix.language }}.tar.gz -C ${{ - github.workspace }}/sdk/${{ matrix.language }} - - name: Update path - run: echo "${{ github.workspace }}/bin" >> "$GITHUB_PATH" - - name: Install Python deps - run: |- - pip3 install virtualenv==20.0.23 - pip3 install pipenv - - name: Install dependencies - run: make install_${{ matrix.language}}_sdk - - name: Install gotestfmt - uses: GoTestTools/gotestfmt-action@v2 - with: - token: ${{ secrets.GITHUB_TOKEN }} - version: v2.4.0 - - name: Run tests - run: cd examples && go test -v -json -count=1 -cover -timeout 2h -tags=${{ - matrix.language }} -parallel 4 . 2>&1 | tee /tmp/gotest.log | gotestfmt - - if: failure() && github.event_name == 'push' - name: Notify Slack - uses: 8398a7/action-slack@v3 - with: - author_name: Failure in running ${{ matrix.language }} tests - fields: repo,commit,author,action - status: ${{ job.status }} - strategy: - fail-fast: false - matrix: - language: - - nodejs - - python - - dotnet - - go - - java -name: main -on: - push: - branches: - - main - paths-ignore: - - "**.md" - tags-ignore: - - v* - - sdk/* - - "**" diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml index 7722b749..cb92d001 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/master.yml @@ -178,34 +178,28 @@ jobs: aws s3 cp "${{ env.COVERAGE_OUTPUT_DIR }}/summary.json" "${s3FullURI}" --acl bucket-owner-full-control lint: - container: golangci/golangci-lint:v1.54.1 name: lint runs-on: ubuntu-latest steps: - name: Checkout Repo uses: actions/checkout@v3 - - name: Checkout Scripts Repo - uses: actions/checkout@v3 - with: - path: ci-scripts - repository: pulumi/scripts - - name: Mark repo as safe directory - run: git config --global --add safe.directory /__w/pulumi-${{ env.PROVIDER }}/pulumi-${{ env.PROVIDER }} - - name: Unshallow clone for tags - run: git fetch --prune --unshallow --tags - name: Install Go uses: actions/setup-go@v4 with: cache-dependency-path: | sdk/go.sum go-version: 1.21.x - - name: Install pulumictl - uses: jaxxstorm/action-install-gh-release@v1.5.0 - with: - repo: pulumi/pulumictl - - name: Install Pulumi CLI - uses: pulumi/action-install-pulumi-cli@v2 - - run: make lint_provider + - name: disarm go:embed directives to enable lint + run: | + git grep -l 'go:embed' -- provider | xargs sed -i 's/go:embed/ goembed/g' + - name: prepare upstream + continue-on-error: true + run: make upstream + - name: golangci-lint + uses: golangci/golangci-lint-action@v3 + with: + version: v1.54.1 + working-directory: provider - if: failure() && github.event_name == 'push' name: Notify Slack uses: 8398a7/action-slack@v3 @@ -338,7 +332,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Publish SDKs - uses: pulumi/pulumi-package-publisher@v0.0.9 + uses: pulumi/pulumi-package-publisher@v0.0.11 - env: SLACK_CHANNEL: provider-upgrade-publish-status SLACK_COLOR: "#FF0000" diff --git a/.github/workflows/prerelease.yml b/.github/workflows/prerelease.yml index 24b2bee8..11a74a70 100644 --- a/.github/workflows/prerelease.yml +++ b/.github/workflows/prerelease.yml @@ -125,34 +125,28 @@ jobs: - go - java lint: - container: golangci/golangci-lint:v1.54.1 name: lint runs-on: ubuntu-latest steps: - name: Checkout Repo uses: actions/checkout@v3 - - name: Checkout Scripts Repo - uses: actions/checkout@v3 - with: - path: ci-scripts - repository: pulumi/scripts - - name: Mark repo as safe directory - run: git config --global --add safe.directory /__w/pulumi-${{ env.PROVIDER }}/pulumi-${{ env.PROVIDER }} - - name: Unshallow clone for tags - run: git fetch --prune --unshallow --tags - name: Install Go uses: actions/setup-go@v4 with: cache-dependency-path: | sdk/go.sum go-version: 1.21.x - - name: Install pulumictl - uses: jaxxstorm/action-install-gh-release@v1.5.0 - with: - repo: pulumi/pulumictl - - name: Install Pulumi CLI - uses: pulumi/action-install-pulumi-cli@v2 - - run: make lint_provider + - name: disarm go:embed directives to enable lint + run: | + git grep -l 'go:embed' -- provider | xargs sed -i 's/go:embed/ goembed/g' + - name: prepare upstream + continue-on-error: true + run: make upstream + - name: golangci-lint + uses: golangci/golangci-lint-action@v3 + with: + version: v1.54.1 + working-directory: provider - if: failure() && github.event_name == 'push' name: Notify Slack uses: 8398a7/action-slack@v3 @@ -284,7 +278,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Publish SDKs - uses: pulumi/pulumi-package-publisher@v0.0.9 + uses: pulumi/pulumi-package-publisher@v0.0.11 - env: SLACK_CHANNEL: provider-upgrade-publish-status SLACK_COLOR: "#FF0000" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index df958df0..7b2f5ca5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -138,34 +138,28 @@ jobs: run: pulumictl create docs-build pulumi-${{ env.PROVIDER }} "${GITHUB_REF#refs/tags/}" lint: - container: golangci/golangci-lint:v1.54.1 name: lint runs-on: ubuntu-latest steps: - name: Checkout Repo uses: actions/checkout@v3 - - name: Checkout Scripts Repo - uses: actions/checkout@v3 - with: - path: ci-scripts - repository: pulumi/scripts - - name: Mark repo as safe directory - run: git config --global --add safe.directory /__w/pulumi-${{ env.PROVIDER }}/pulumi-${{ env.PROVIDER }} - - name: Unshallow clone for tags - run: git fetch --prune --unshallow --tags - name: Install Go uses: actions/setup-go@v4 with: cache-dependency-path: | sdk/go.sum go-version: 1.21.x - - name: Install pulumictl - uses: jaxxstorm/action-install-gh-release@v1.5.0 - with: - repo: pulumi/pulumictl - - name: Install Pulumi CLI - uses: pulumi/action-install-pulumi-cli@v2 - - run: make lint_provider + - name: disarm go:embed directives to enable lint + run: | + git grep -l 'go:embed' -- provider | xargs sed -i 's/go:embed/ goembed/g' + - name: prepare upstream + continue-on-error: true + run: make upstream + - name: golangci-lint + uses: golangci/golangci-lint-action@v3 + with: + version: v1.54.1 + working-directory: provider - if: failure() && github.event_name == 'push' name: Notify Slack uses: 8398a7/action-slack@v3 @@ -296,7 +290,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Publish SDKs - uses: pulumi/pulumi-package-publisher@v0.0.9 + uses: pulumi/pulumi-package-publisher@v0.0.11 - env: SLACK_CHANNEL: provider-upgrade-publish-status SLACK_COLOR: "#FF0000" diff --git a/.github/workflows/run-acceptance-tests.yml b/.github/workflows/run-acceptance-tests.yml index c56c3bf5..70e6c2e6 100644 --- a/.github/workflows/run-acceptance-tests.yml +++ b/.github/workflows/run-acceptance-tests.yml @@ -145,7 +145,6 @@ jobs: repository: ${{ github.event.client_payload.github.payload.repository.full_name }} token: ${{ secrets.PULUMI_BOT_TOKEN }} lint: - container: golangci/golangci-lint:v1.54.1 if: github.event_name == 'repository_dispatch' || github.event.pull_request.head.repo.full_name == github.repository name: lint @@ -155,28 +154,24 @@ jobs: uses: actions/checkout@v3 with: ref: ${{ env.PR_COMMIT_SHA }} - - name: Checkout Scripts Repo - uses: actions/checkout@v3 - with: - path: ci-scripts - repository: pulumi/scripts - - name: Mark repo as safe directory - run: git config --global --add safe.directory /__w/pulumi-${{ env.PROVIDER }}/pulumi-${{ env.PROVIDER }} - - name: Unshallow clone for tags - run: git fetch --prune --unshallow --tags - - name: Install Go + - name: disarm go:embed directives to enable lint + run: | + git grep -l 'go:embed' -- provider | xargs sed -i 's/go:embed/ goembed/g' + - name: prepare upstream + continue-on-error: true + run: make upstream + - name: Install go uses: actions/setup-go@v4 with: - cache-dependency-path: | - sdk/go.sum - go-version: 1.21.x - - name: Install pulumictl - uses: jaxxstorm/action-install-gh-release@v1.5.0 + # The versions of golangci-lint and setup-go here cross-depend and need to update together. + go-version: 1.21 + # Either this action or golangci-lint needs to disable the cache + cache: false + - name: golangci-lint + uses: golangci/golangci-lint-action@v3 with: - repo: pulumi/pulumictl - - name: Install Pulumi CLI - uses: pulumi/action-install-pulumi-cli@v2 - - run: make lint_provider + version: v1.54.1 + working-directory: provider - if: failure() && github.event_name == 'push' name: Notify Slack uses: 8398a7/action-slack@v3 @@ -412,7 +407,6 @@ on: pull_request: branches: - master - - main paths-ignore: - CHANGELOG.md repository_dispatch: diff --git a/.goreleaser.prerelease.yml b/.goreleaser.prerelease.yml index 6222b3f5..72a8327c 100644 --- a/.goreleaser.prerelease.yml +++ b/.goreleaser.prerelease.yml @@ -40,3 +40,4 @@ release: disable: true snapshot: name_template: "{{ .Tag }}-SNAPSHOT" +project_name: "pulumi-wavefront" diff --git a/.goreleaser.yml b/.goreleaser.yml index ec3f95ad..858bb70a 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -49,3 +49,4 @@ release: disable: false snapshot: name_template: "{{ .Tag }}-SNAPSHOT" +project_name: "pulumi-wavefront" diff --git a/Makefile b/Makefile index 7fd13281..6fc65735 100644 --- a/Makefile +++ b/Makefile @@ -61,15 +61,18 @@ build_nodejs: upstream build_python: PYPI_VERSION := $(shell pulumictl get version --language python) build_python: upstream + rm -rf sdk/python/ $(WORKING_DIR)/bin/$(TFGEN) python --out sdk/python/ cd sdk/python/ && \ printf "module fake_python_module // Exclude this directory from Go tools\n\ngo 1.17\n" > go.mod && \ cp ../../README.md . && \ - 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 && rm ./bin/go.mod && \ - cd ./bin && python3 setup.py build sdist + sed -i.bak -e 's/^ version = .*/ version = "$(PYPI_VERSION)"/g' ./bin/pyproject.toml && \ + rm ./bin/pyproject.toml.bak && rm ./bin/go.mod && \ + python3 -m venv venv && \ + ./venv/bin/python -m pip install build && \ + cd ./bin && \ + ../venv/bin/python -m build . clean: rm -rf sdk/{dotnet,nodejs,go,python} diff --git a/provider/cmd/pulumi-resource-wavefront/embed.go b/provider/cmd/pulumi-resource-wavefront/embed.go new file mode 100644 index 00000000..2c30f14b --- /dev/null +++ b/provider/cmd/pulumi-resource-wavefront/embed.go @@ -0,0 +1,22 @@ +// Copyright 2016-2023, Pulumi Corporation. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package main + +import ( + _ "embed" // to embed schema +) + +//go:embed schema-embed.json +var pulumiSchema []byte diff --git a/provider/cmd/pulumi-resource-wavefront/generate.go b/provider/cmd/pulumi-resource-wavefront/generate.go index a548fda8..8b25fcb7 100644 --- a/provider/cmd/pulumi-resource-wavefront/generate.go +++ b/provider/cmd/pulumi-resource-wavefront/generate.go @@ -12,14 +12,15 @@ // See the License for the specific language governing permissions and // limitations under the License. +//go:build ignore // +build ignore package main import ( "encoding/json" - "fmt" - "io/ioutil" + "errors" + "io/fs" "log" "os" @@ -32,7 +33,7 @@ func main() { log.Fatal("version not found") } - schemaContents, err := ioutil.ReadFile("./schema.json") + schemaContents, err := os.ReadFile("./schema.json") if err != nil { log.Fatal(err) } @@ -49,9 +50,13 @@ func main() { log.Fatalf("cannot reserialize schema: %v", err) } - err = ioutil.WriteFile("./schema.go", []byte(fmt.Sprintf(`package main -var pulumiSchema = %#v -`, versionedContents)), 0600) + // Clean up schema.go as it may be present & gitignored and tolerate an error if the file isn't present. + err = os.Remove("./schema.go") + if err != nil && !errors.Is(err, fs.ErrNotExist) { + log.Fatal(err) + } + + err = os.WriteFile("./schema-embed.json", versionedContents, 0600) if err != nil { log.Fatal(err) } diff --git a/provider/cmd/pulumi-resource-wavefront/schema.json b/provider/cmd/pulumi-resource-wavefront/schema.json index e3fbb67e..b6387f8a 100644 --- a/provider/cmd/pulumi-resource-wavefront/schema.json +++ b/provider/cmd/pulumi-resource-wavefront/schema.json @@ -46,7 +46,9 @@ }, "readme": "\u003e This provider is a derived work of the [Terraform Provider](https://github.com/vmware/terraform-provider-wavefront)\n\u003e distributed under [MPL 2.0](https://www.mozilla.org/en-US/MPL/2.0/). If you encounter a bug or missing feature,\n\u003e first check the [`pulumi-wavefront` repo](https://github.com/pulumi/pulumi-wavefront/issues); however, if that doesn't turn up anything,\n\u003e please consult the source [`terraform-provider-wavefront` repo](https://github.com/vmware/terraform-provider-wavefront/issues).", "compatibility": "tfbridge20", - "pyproject": {} + "pyproject": { + "enabled": true + } } }, "config": { diff --git a/provider/resources.go b/provider/resources.go index bb42d3e9..580bcd70 100644 --- a/provider/resources.go +++ b/provider/resources.go @@ -148,11 +148,15 @@ func Provider() tfbridge.ProviderInfo { "@types/mime": "^2.0.0", }, }, - Python: &tfbridge.PythonInfo{ - Requires: map[string]string{ - "pulumi": ">=3.0.0,<4.0.0", - }, - }, + Python: (func() *tfbridge.PythonInfo { + i := &tfbridge.PythonInfo{ + Requires: map[string]string{ + "pulumi": ">=3.0.0,<4.0.0", + }} + i.PyProject.Enabled = true + return i + })(), + Golang: &tfbridge.GolangInfo{ ImportBasePath: filepath.Join( fmt.Sprintf("github.com/pulumi/pulumi-%[1]s/sdk/", mainPkg), diff --git a/sdk/python/pyproject.toml b/sdk/python/pyproject.toml new file mode 100644 index 00000000..72219fb3 --- /dev/null +++ b/sdk/python/pyproject.toml @@ -0,0 +1,22 @@ +[project] + name = "pulumi_wavefront" + description = "A Pulumi package for creating and managing wavefront cloud resources." + dependencies = ["parver>=0.2.1", "pulumi>=3.0.0,<4.0.0", "semver>=2.8.1"] + keywords = ["pulumi", "wavefront"] + readme = "README.md" + requires-python = ">=3.7" + version = "0.0.0" + [project.license] + text = "Apache-2.0" + [project.urls] + Homepage = "https://pulumi.io" + Repository = "https://github.com/pulumi/pulumi-wavefront" + +[build-system] + requires = ["setuptools>=61.0"] + build-backend = "setuptools.build_meta" + +[tool] + [tool.setuptools] + [tool.setuptools.package-data] + pulumi_wavefront = ["py.typed", "pulumi-plugin.json"] diff --git a/sdk/python/setup.py b/sdk/python/setup.py deleted file mode 100644 index b670f6ab..00000000 --- a/sdk/python/setup.py +++ /dev/null @@ -1,44 +0,0 @@ -# coding=utf-8 -# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** -# *** Do not edit by hand unless you're certain you know what you are doing! *** - -import errno -from setuptools import setup, find_packages -from setuptools.command.install import install -from subprocess import check_call - - -VERSION = "0.0.0" -def readme(): - try: - with open('README.md', encoding='utf-8') as f: - return f.read() - except FileNotFoundError: - return "wavefront Pulumi Package - Development Version" - - -setup(name='pulumi_wavefront', - python_requires='>=3.7', - version=VERSION, - description="A Pulumi package for creating and managing wavefront cloud resources.", - long_description=readme(), - long_description_content_type='text/markdown', - keywords='pulumi wavefront', - url='https://pulumi.io', - project_urls={ - 'Repository': 'https://github.com/pulumi/pulumi-wavefront' - }, - license='Apache-2.0', - packages=find_packages(), - package_data={ - 'pulumi_wavefront': [ - 'py.typed', - 'pulumi-plugin.json', - ] - }, - install_requires=[ - 'parver>=0.2.1', - 'pulumi>=3.0.0,<4.0.0', - 'semver>=2.8.1' - ], - zip_safe=False)