From 098c6b1ccf622e444bac57678f7df8900106a5c3 Mon Sep 17 00:00:00 2001 From: Pulumi Bot Date: Wed, 12 Jun 2024 05:22:45 +0000 Subject: [PATCH] [internal] Update GitHub Actions workflow files --- .github/workflows/build_sdk.yml | 99 +++++++++ .github/workflows/master.yml | 195 +---------------- .github/workflows/prerelease.yml | 195 +---------------- .github/workflows/prerequisites.yml | 102 +++++++++ .github/workflows/release.yml | 217 ++----------------- .github/workflows/run-acceptance-tests.yml | 233 +-------------------- 6 files changed, 248 insertions(+), 793 deletions(-) create mode 100644 .github/workflows/build_sdk.yml create mode 100644 .github/workflows/prerequisites.yml diff --git a/.github/workflows/build_sdk.yml b/.github/workflows/build_sdk.yml new file mode 100644 index 00000000..d143013e --- /dev/null +++ b/.github/workflows/build_sdk.yml @@ -0,0 +1,99 @@ +name: "Build SDK" + +on: + workflow_call: {} + +jobs: + build_sdk: + name: build_sdk + runs-on: ubuntu-latest + strategy: + fail-fast: true + matrix: + language: + - nodejs + - python + - dotnet + - go + - java + steps: + - name: Checkout Repo + uses: actions/checkout@v4 + - uses: pulumi/provider-version-action@v1 + with: + set-env: 'PROVIDER_VERSION' + - name: Cache examples generation + uses: actions/cache@v4 + with: + path: | + .pulumi/examples-cache + key: ${{ runner.os }}-${{ hashFiles('provider/go.sum') }} + - name: Install pulumictl + uses: jaxxstorm/action-install-gh-release@v1.11.0 + with: + tag: v0.0.46 + repo: pulumi/pulumictl + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: 20.x + registry-url: https://registry.npmjs.org + - name: Setup DotNet + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 6.0.x + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: 3.11.8 + - name: Setup Java + uses: actions/setup-java@v4 + with: + cache: gradle + distribution: temurin + java-version: 11 + - name: Setup Gradle + uses: gradle/gradle-build-action@v3 + with: + gradle-version: 7.6 + - name: Download provider + tfgen binaries + uses: actions/download-artifact@v4 + with: + name: f5bigip-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-*-f5bigip" -print -exec chmod +x {} \; + - name: Install plugins + run: make install_plugins + - name: Update path + run: echo "${{ github.workspace }}/bin" >> "$GITHUB_PATH" + - name: Build SDK + 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/**/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 + uses: actions/upload-artifact@v4 + 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 }} diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml index 87997daa..dec3d623 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/master.yml @@ -26,107 +26,8 @@ jobs: build_sdk: name: build_sdk needs: prerequisites - runs-on: ubuntu-latest - steps: - - name: Checkout Repo - uses: actions/checkout@v4 - - uses: pulumi/provider-version-action@v1 - with: - set-env: 'PROVIDER_VERSION' - - name: Install Go - uses: actions/setup-go@v5 - with: - go-version: "1.21.x" - cache-dependency-path: | - sdk/go.sum - - name: Cache examples generation - uses: actions/cache@v4 - with: - path: | - .pulumi/examples-cache - key: ${{ runner.os }}-${{ hashFiles('provider/go.sum') }} - - name: Install pulumictl - uses: jaxxstorm/action-install-gh-release@v1.11.0 - with: - tag: v0.0.46 - repo: pulumi/pulumictl - - name: Install Pulumi CLI - uses: pulumi/actions@v5 - with: - pulumi-version: "^3" - - name: Setup Node - uses: actions/setup-node@v4 - with: - node-version: "20.x" - registry-url: https://registry.npmjs.org - - name: Setup DotNet - uses: actions/setup-dotnet@v4 - with: - dotnet-version: "6.0.x" - - name: Setup Python - uses: actions/setup-python@v5 - with: - python-version: "3.11.8" - - name: Setup Java - uses: actions/setup-java@v4 - with: - cache: gradle - distribution: temurin - java-version: "11" - - name: Setup Gradle - uses: gradle/gradle-build-action@v3 - with: - gradle-version: "7.6" - - name: Download provider + tfgen binaries - uses: actions/download-artifact@v4 - with: - name: f5bigip-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-*-f5bigip" -print -exec chmod +x {} \; - - name: Install plugins - run: make install_plugins - - name: Update path - run: echo "${{ github.workspace }}/bin" >> "$GITHUB_PATH" - - name: Build SDK - 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/**/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 - uses: actions/upload-artifact@v4 - 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 + uses: ./.github/workflows/build_sdk.yml + secrets: inherit generate_coverage_data: continue-on-error: true @@ -191,92 +92,12 @@ jobs: uses: ./.github/workflows/license.yml secrets: inherit prerequisites: - name: prerequisites - runs-on: ubuntu-latest - steps: - - name: Checkout Repo - uses: actions/checkout@v4 - - uses: pulumi/provider-version-action@v1 - with: - set-env: 'PROVIDER_VERSION' - - name: Cache examples generation - uses: actions/cache@v4 - with: - path: | - .pulumi/examples-cache - key: ${{ runner.os }}-${{ hashFiles('provider/go.sum') }} - - name: Prepare upstream code - run: make upstream - - name: Install Go - uses: actions/setup-go@v5 - with: - go-version: "1.21.x" - cache-dependency-path: | - provider/*.sum - upstream/*.sum - - name: Install pulumictl - uses: jaxxstorm/action-install-gh-release@v1.11.0 - with: - tag: v0.0.46 - repo: pulumi/pulumictl - - name: Install Pulumi CLI - uses: pulumi/actions@v5 - with: - pulumi-version: "^3" - - if: github.event_name == 'pull_request' - name: Install Schema Tools - uses: jaxxstorm/action-install-gh-release@v1.11.0 - with: - repo: pulumi/schema-tools - - name: Build schema generator binary - run: make tfgen_build_only - - name: Install plugins - run: make install_plugins - - name: Generate schema - run: make tfgen_no_deps - - name: Build provider binary - run: make provider_no_deps - - name: Unit-test provider code - run: make test_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 f5bigip -o ${{ github.event.repository.default_branch }} -n --local-path=provider/cmd/pulumi-resource-f5bigip/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: >+ - ${{ 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-f5bigip - pulumi-tfgen-f5bigip - - name: Upload artifacts - uses: actions/upload-artifact@v4 - with: - name: f5bigip-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 }} - + uses: ./.github/workflows/prerequisites.yml + secrets: inherit + with: + default_branch: ${{ github.event.repository.default_branch }} + is_pr: ${{ github.event_name == 'pull_request' }} + is_automated: ${{ github.actor == 'dependabot[bot]' }} publish: name: publish diff --git a/.github/workflows/prerelease.yml b/.github/workflows/prerelease.yml index 70396327..a66e0efa 100644 --- a/.github/workflows/prerelease.yml +++ b/.github/workflows/prerelease.yml @@ -27,107 +27,8 @@ jobs: build_sdk: name: build_sdk needs: prerequisites - runs-on: ubuntu-latest - steps: - - name: Checkout Repo - uses: actions/checkout@v4 - - uses: pulumi/provider-version-action@v1 - with: - set-env: 'PROVIDER_VERSION' - - name: Install Go - uses: actions/setup-go@v5 - with: - go-version: "1.21.x" - cache-dependency-path: | - sdk/go.sum - - name: Cache examples generation - uses: actions/cache@v4 - with: - path: | - .pulumi/examples-cache - key: ${{ runner.os }}-${{ hashFiles('provider/go.sum') }} - - name: Install pulumictl - uses: jaxxstorm/action-install-gh-release@v1.11.0 - with: - tag: v0.0.46 - repo: pulumi/pulumictl - - name: Install Pulumi CLI - uses: pulumi/actions@v5 - with: - pulumi-version: "^3" - - name: Setup Node - uses: actions/setup-node@v4 - with: - node-version: "20.x" - registry-url: https://registry.npmjs.org - - name: Setup DotNet - uses: actions/setup-dotnet@v4 - with: - dotnet-version: "6.0.x" - - name: Setup Python - uses: actions/setup-python@v5 - with: - python-version: "3.11.8" - - name: Setup Java - uses: actions/setup-java@v4 - with: - cache: gradle - distribution: temurin - java-version: "11" - - name: Setup Gradle - uses: gradle/gradle-build-action@v3 - with: - gradle-version: "7.6" - - name: Download provider + tfgen binaries - uses: actions/download-artifact@v4 - with: - name: f5bigip-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-*-f5bigip" -print -exec chmod +x {} \; - - name: Install plugins - run: make install_plugins - - name: Update path - run: echo "${{ github.workspace }}/bin" >> "$GITHUB_PATH" - - name: Build SDK - 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/**/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 - uses: actions/upload-artifact@v4 - 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 + uses: ./.github/workflows/build_sdk.yml + secrets: inherit lint: name: lint @@ -138,92 +39,12 @@ jobs: uses: ./.github/workflows/license.yml secrets: inherit prerequisites: - name: prerequisites - runs-on: ubuntu-latest - steps: - - name: Checkout Repo - uses: actions/checkout@v4 - - uses: pulumi/provider-version-action@v1 - with: - set-env: 'PROVIDER_VERSION' - - name: Cache examples generation - uses: actions/cache@v4 - with: - path: | - .pulumi/examples-cache - key: ${{ runner.os }}-${{ hashFiles('provider/go.sum') }} - - name: Prepare upstream code - run: make upstream - - name: Install Go - uses: actions/setup-go@v5 - with: - go-version: "1.21.x" - cache-dependency-path: | - provider/*.sum - upstream/*.sum - - name: Install pulumictl - uses: jaxxstorm/action-install-gh-release@v1.11.0 - with: - tag: v0.0.46 - repo: pulumi/pulumictl - - name: Install Pulumi CLI - uses: pulumi/actions@v5 - with: - pulumi-version: "^3" - - if: github.event_name == 'pull_request' - name: Install Schema Tools - uses: jaxxstorm/action-install-gh-release@v1.11.0 - with: - repo: pulumi/schema-tools - - name: Build schema generator binary - run: make tfgen_build_only - - name: Install plugins - run: make install_plugins - - name: Generate schema - run: make tfgen_no_deps - - name: Build provider binary - run: make provider_no_deps - - name: Unit-test provider code - run: make test_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 f5bigip -o ${{ github.event.repository.default_branch }} -n --local-path=provider/cmd/pulumi-resource-f5bigip/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: >+ - ${{ 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-f5bigip - pulumi-tfgen-f5bigip - - name: Upload artifacts - uses: actions/upload-artifact@v4 - with: - name: f5bigip-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 }} - + uses: ./.github/workflows/prerequisites.yml + secrets: inherit + with: + default_branch: ${{ github.event.repository.default_branch }} + is_pr: ${{ github.event_name == 'pull_request' }} + is_automated: ${{ github.actor == 'dependabot[bot]' }} publish: name: publish diff --git a/.github/workflows/prerequisites.yml b/.github/workflows/prerequisites.yml new file mode 100644 index 00000000..2baa74a6 --- /dev/null +++ b/.github/workflows/prerequisites.yml @@ -0,0 +1,102 @@ +name: "Prerequisites" + +on: + workflow_call: + inputs: + is_pr: + type: boolean + required: true + is_automated: + type: boolean + required: true + default_branch: + type: string + required: true + +jobs: + prerequisites: + name: prerequisites + runs-on: ubuntu-latest + steps: + - name: Checkout Repo + uses: actions/checkout@v4 + - uses: pulumi/provider-version-action@v1 + with: + set-env: 'PROVIDER_VERSION' + - name: Cache examples generation + uses: actions/cache@v4 + with: + path: | + .pulumi/examples-cache + key: ${{ runner.os }}-${{ hashFiles('provider/go.sum') }} + - name: Prepare upstream code + run: make upstream + - name: Install Go + uses: actions/setup-go@v5 + with: + go-version: "1.21.x" + cache-dependency-path: | + provider/*.sum + upstream/*.sum + - name: Install pulumictl + uses: jaxxstorm/action-install-gh-release@v1.11.0 + with: + tag: v0.0.46 + repo: pulumi/pulumictl + - name: Install Pulumi CLI + uses: pulumi/actions@v5 + with: + pulumi-version: "^3" + - if: inputs.is_pr + name: Install Schema Tools + uses: jaxxstorm/action-install-gh-release@v1.11.0 + with: + repo: pulumi/schema-tools + - name: Build schema generator binary + run: make tfgen_build_only + - name: Install plugins + run: make install_plugins + - name: Generate schema + run: make tfgen_no_deps + - name: Build provider binary + run: make provider_no_deps + - name: Unit-test provider code + run: make test_provider + - if: inputs.is_pr + 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 f5bigip -o ${{ inputs.default_branch }} -n --local-path=provider/cmd/pulumi-resource-f5bigip/schema.json; + echo "$EOF"; + } >> "$GITHUB_ENV" + - if: inputs.is_pr && inputs.is_automated == false + 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: >+ + ${{ 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-f5bigip + pulumi-tfgen-f5bigip + - name: Upload artifacts + uses: actions/upload-artifact@v4 + with: + name: f5bigip-provider.tar.gz + path: ${{ github.workspace }}/bin/provider.tar.gz + retention-days: 30 + - if: failure() && inputs.is_pr + name: Notify Slack + uses: 8398a7/action-slack@v3 + with: + author_name: Failure in building provider prerequisites + fields: repo,commit,author,action + status: ${{ job.status }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index dd41730c..18903662 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -26,123 +26,26 @@ jobs: build_sdk: name: build_sdk needs: prerequisites - runs-on: ubuntu-latest - steps: - - name: Checkout Repo - uses: actions/checkout@v4 - - uses: pulumi/provider-version-action@v1 - with: - set-env: 'PROVIDER_VERSION' - - name: Install Go - uses: actions/setup-go@v5 - with: - go-version: "1.21.x" - cache-dependency-path: | - sdk/go.sum - - name: Cache examples generation - uses: actions/cache@v4 - with: - path: | - .pulumi/examples-cache - key: ${{ runner.os }}-${{ hashFiles('provider/go.sum') }} - - name: Install pulumictl - uses: jaxxstorm/action-install-gh-release@v1.11.0 - with: - tag: v0.0.46 - repo: pulumi/pulumictl - - name: Install Pulumi CLI - uses: pulumi/actions@v5 - with: - pulumi-version: "^3" - - name: Setup Node - uses: actions/setup-node@v4 - with: - node-version: "20.x" - registry-url: https://registry.npmjs.org - - name: Setup DotNet - uses: actions/setup-dotnet@v4 - with: - dotnet-version: "6.0.x" - - name: Setup Python - uses: actions/setup-python@v5 - with: - python-version: "3.11.8" - - name: Setup Java - uses: actions/setup-java@v4 - with: - cache: gradle - distribution: temurin - java-version: "11" - - name: Setup Gradle - uses: gradle/gradle-build-action@v3 - with: - gradle-version: "7.6" - - name: Download provider + tfgen binaries - uses: actions/download-artifact@v4 - with: - name: f5bigip-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-*-f5bigip" -print -exec chmod +x {} \; - - name: Install plugins - run: make install_plugins - - name: Update path - run: echo "${{ github.workspace }}/bin" >> "$GITHUB_PATH" - - name: Build SDK - 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/**/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 - uses: actions/upload-artifact@v4 - 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 + uses: ./.github/workflows/build_sdk.yml + secrets: inherit create_docs_build: name: create_docs_build needs: tag_sdk runs-on: ubuntu-latest steps: - - name: Install pulumictl - uses: jaxxstorm/action-install-gh-release@v1.11.0 - with: - tag: v0.0.46 - repo: pulumi/pulumictl - - env: - GITHUB_TOKEN: ${{ secrets.PULUMI_BOT_TOKEN }} - name: Dispatch Event - run: pulumictl create docs-build pulumi-f5bigip - "${GITHUB_REF#refs/tags/}" + - name: Dispatch Metadata build + uses: peter-evans/repository-dispatch@v3 + with: + token: ${{ secrets.PULUMI_BOT_TOKEN }} + repository: pulumi/registry + event-type: resource-provider + client-payload: |- + { + "project": "${{ github.repository }}", + "project-shortname": "f5bigip", + "ref": "${{ github.ref_name }}" + } lint: name: lint uses: ./.github/workflows/lint.yml @@ -152,92 +55,12 @@ jobs: uses: ./.github/workflows/license.yml secrets: inherit prerequisites: - name: prerequisites - runs-on: ubuntu-latest - steps: - - name: Checkout Repo - uses: actions/checkout@v4 - - uses: pulumi/provider-version-action@v1 - with: - set-env: 'PROVIDER_VERSION' - - name: Cache examples generation - uses: actions/cache@v4 - with: - path: | - .pulumi/examples-cache - key: ${{ runner.os }}-${{ hashFiles('provider/go.sum') }} - - name: Prepare upstream code - run: make upstream - - name: Install Go - uses: actions/setup-go@v5 - with: - go-version: "1.21.x" - cache-dependency-path: | - provider/*.sum - upstream/*.sum - - name: Install pulumictl - uses: jaxxstorm/action-install-gh-release@v1.11.0 - with: - tag: v0.0.46 - repo: pulumi/pulumictl - - name: Install Pulumi CLI - uses: pulumi/actions@v5 - with: - pulumi-version: "^3" - - if: github.event_name == 'pull_request' - name: Install Schema Tools - uses: jaxxstorm/action-install-gh-release@v1.11.0 - with: - repo: pulumi/schema-tools - - name: Build schema generator binary - run: make tfgen_build_only - - name: Install plugins - run: make install_plugins - - name: Generate schema - run: make tfgen_no_deps - - name: Build provider binary - run: make provider_no_deps - - name: Unit-test provider code - run: make test_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 f5bigip -o ${{ github.event.repository.default_branch }} -n --local-path=provider/cmd/pulumi-resource-f5bigip/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: >+ - ${{ 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-f5bigip - pulumi-tfgen-f5bigip - - name: Upload artifacts - uses: actions/upload-artifact@v4 - with: - name: f5bigip-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 }} - + uses: ./.github/workflows/prerequisites.yml + secrets: inherit + with: + default_branch: ${{ github.event.repository.default_branch }} + is_pr: ${{ github.event_name == 'pull_request' }} + is_automated: ${{ github.actor == 'dependabot[bot]' }} publish: name: publish diff --git a/.github/workflows/run-acceptance-tests.yml b/.github/workflows/run-acceptance-tests.yml index eeaad38b..3122e612 100644 --- a/.github/workflows/run-acceptance-tests.yml +++ b/.github/workflows/run-acceptance-tests.yml @@ -34,109 +34,8 @@ jobs: github.event.pull_request.head.repo.full_name == github.repository name: build_sdk needs: prerequisites - runs-on: ubuntu-latest - steps: - - name: Checkout Repo - uses: actions/checkout@v4 - with: - ref: ${{ env.PR_COMMIT_SHA }} - - uses: pulumi/provider-version-action@v1 - with: - set-env: 'PROVIDER_VERSION' - - name: Install Go - uses: actions/setup-go@v5 - with: - go-version: "1.21.x" - cache-dependency-path: | - sdk/go.sum - - name: Cache examples generation - uses: actions/cache@v4 - with: - path: | - .pulumi/examples-cache - key: ${{ runner.os }}-${{ hashFiles('provider/go.sum') }} - - name: Install pulumictl - uses: jaxxstorm/action-install-gh-release@v1.11.0 - with: - tag: v0.0.46 - repo: pulumi/pulumictl - - name: Install Pulumi CLI - uses: pulumi/actions@v5 - with: - pulumi-version: "^3" - - name: Setup Node - uses: actions/setup-node@v4 - with: - node-version: "20.x" - registry-url: https://registry.npmjs.org - - name: Setup DotNet - uses: actions/setup-dotnet@v4 - with: - dotnet-version: "6.0.x" - - name: Setup Python - uses: actions/setup-python@v5 - with: - python-version: "3.11.8" - - name: Setup Java - uses: actions/setup-java@v4 - with: - cache: gradle - distribution: temurin - java-version: "11" - - name: Setup Gradle - uses: gradle/gradle-build-action@v3 - with: - gradle-version: "7.6" - - name: Download provider + tfgen binaries - uses: actions/download-artifact@v4 - with: - name: f5bigip-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-*-f5bigip" -print -exec chmod +x {} \; - - name: Install plugins - run: make install_plugins - - name: Update path - run: echo "${{ github.workspace }}/bin" >> "$GITHUB_PATH" - - name: Build SDK - 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/**/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 - uses: actions/upload-artifact@v4 - 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 + uses: ./.github/workflows/build_sdk.yml + secrets: inherit comment-notification: if: github.event_name == 'repository_dispatch' @@ -162,144 +61,34 @@ jobs: prerequisites: if: github.event_name == 'repository_dispatch' || github.event.pull_request.head.repo.full_name == github.repository - name: prerequisites - runs-on: ubuntu-latest - steps: - - name: Checkout Repo - uses: actions/checkout@v4 - - uses: pulumi/provider-version-action@v1 - with: - set-env: 'PROVIDER_VERSION' - - name: Cache examples generation - uses: actions/cache@v4 - with: - path: | - .pulumi/examples-cache - key: ${{ runner.os }}-${{ hashFiles('provider/go.sum') }} - - name: Prepare upstream code - run: make upstream - - name: Install Go - uses: actions/setup-go@v5 - with: - go-version: "1.21.x" - cache-dependency-path: | - provider/*.sum - upstream/*.sum - - name: Install pulumictl - uses: jaxxstorm/action-install-gh-release@v1.11.0 - with: - tag: v0.0.46 - repo: pulumi/pulumictl - - name: Install Pulumi CLI - uses: pulumi/actions@v5 - with: - pulumi-version: "^3" - - if: github.event_name == 'pull_request' - name: Install Schema Tools - uses: jaxxstorm/action-install-gh-release@v1.11.0 - with: - repo: pulumi/schema-tools - - name: Build schema generator binary - run: make tfgen_build_only - - name: Install plugins - run: make install_plugins - - name: Generate schema - run: make tfgen_no_deps - - name: Build provider binary - run: make provider_no_deps - - name: Unit-test provider code - run: make test_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 f5bigip -o ${{ github.event.repository.default_branch }} -n --local-path=provider/cmd/pulumi-resource-f5bigip/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: >+ - ${{ 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-f5bigip - pulumi-tfgen-f5bigip - - name: Upload artifacts - uses: actions/upload-artifact@v4 - with: - name: f5bigip-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 }} - + uses: ./.github/workflows/prerequisites.yml + secrets: inherit + with: + default_branch: ${{ github.event.repository.default_branch }} + is_pr: ${{ github.event_name == 'pull_request' }} + is_automated: ${{ github.actor == 'dependabot[bot]' }} sentinel: name: sentinel - # We would like to be able to specify `sentinel` as the only required job for this - # workflow. To do that, we need `sentinel` to succeed only when it is safe to - # merge and fail in all other cases. - # - # We can't use the default `if: success()`, since GitHub interprets a skipped job as a - # success, and by default a dependee job failing will skip a dependent job. That means - # if a test step fails, then it will skip `sentinel` so GitHub will register - # `sentinel` as succeeded. - # - # GitHub documents `jobs.result` as: - # - # The result of a job in the reusable workflow. Possible values are success, - # failure, cancelled, or skipped. - # - # GitHub documents `cancelled()` as: - # - # Returns true if the workflow was canceled. - # - # Combining these terms gives us an intuitive definition of success: - # - # We have succeeded when no dependent workflow has failed and the job was - # not cancelled. - # - if: (github.event_name == 'repository_dispatch' || - github.event.pull_request.head.repo.full_name == github.repository) && - ! cancelled() + if: github.event_name == 'repository_dispatch' || + github.event.pull_request.head.repo.full_name == github.repository needs: - test - license_check - lint runs-on: ubuntu-latest steps: - - name: Workflow is not a success - if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') || contains(needs.*.result, 'skipped') - run: exit 1 - uses: guibranco/github-status-action-v2@0849440ec82c5fa69b2377725b9b7852a3977e76 with: authToken: ${{secrets.GITHUB_TOKEN}} # Write an explicit status check called "Sentinel" which will only pass if this code really runs. - # Once rolled out, we can make this the only required check for PRs, - # then remove the old conditionals on this job and remove the previous step. + # This should always be a required check for PRs. context: 'Sentinel' description: 'All required checks passed' state: 'success' # Write to the PR commit SHA if it's available as we don't want the merge commit sha, # otherwise use the current SHA for any other type of build. sha: ${{ github.event.pull_request.head.sha || github.sha }} - - name: Workflow is a success - run: echo "🎉🎈🎉🎈🎉" test: if: github.event_name == 'repository_dispatch' ||