From 3895074c918543dcbe638e0eb22615c7d6f0fc7a Mon Sep 17 00:00:00 2001 From: Sean Holung Date: Fri, 17 May 2024 10:20:44 -0700 Subject: [PATCH 1/4] Separate pull request flow --- .github/workflows/build-and-deploy.yml | 3 - .github/workflows/pull-request.yml | 83 ++++++++++++++++++++++++++ 2 files changed, 83 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/pull-request.yml diff --git a/.github/workflows/build-and-deploy.yml b/.github/workflows/build-and-deploy.yml index e7df34ba9b18..4e96779e66cf 100644 --- a/.github/workflows/build-and-deploy.yml +++ b/.github/workflows/build-and-deploy.yml @@ -3,9 +3,6 @@ on: push: branches: - master - pull_request: - branches: - - master permissions: id-token: write # This is required for requesting the JWT contents: read # This is required for actions/checkout diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml new file mode 100644 index 000000000000..4c492a2c4c0a --- /dev/null +++ b/.github/workflows/pull-request.yml @@ -0,0 +1,83 @@ +name: Pull Request +on: + pull_request: + branches: + - master +permissions: + id-token: write # This is required for requesting the JWT + contents: read # This is required for actions/checkout +jobs: + buildSite: + env: + GOPATH: ${{ github.workspace }}/go + name: Install deps and build site + runs-on: ubuntu-22.04-8core + environment: testing + steps: + + - uses: actions/checkout@v2 + + - uses: actions/setup-node@v1 + with: + node-version: '18.x' + + - uses: actions/setup-go@v2 + with: + go-version: 1.20.x + + - uses: peaceiris/actions-hugo@v2 + with: + hugo-version: '0.111.0' + extended: true + + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v2 + with: + role-to-assume: arn:aws:iam::571684982431:role/ContinuousDelivery + role-session-name: docs-deploy + role-duration-seconds: 7200 + aws-region: us-west-2 + + - name: Install Pulumi CLI + uses: pulumi/actions@v4 + + - name: Build and deploy + run: make ci_pull_request + env: + CDN_PULUMI_URN: ${{ vars.CDN_PULUMI_URN }} + PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }} + PULUMI_STACK_NAME: ${{ vars.PULUMI_STACK_NAME }} + DEPLOYMENT_ENVIRONMENT: ${{ vars.DEPLOYMENT_ENVIRONMENT }} + SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} + GITHUB_TOKEN: ${{ secrets.PULUMI_BOT_TOKEN }} + ALGOLIA_APP_ID: ${{ vars.ALGOLIA_APP_ID }} + ALGOLIA_APP_SEARCH_KEY: ${{ vars.ALGOLIA_APP_SEARCH_KEY }} + ALGOLIA_APP_ADMIN_KEY: ${{ secrets.ALGOLIA_APP_ADMIN_KEY }} + NODE_OPTIONS: "--max_old_space_size=8192" + + - name: Archive test results + uses: actions/upload-artifact@v2 + with: + name: browser-test-results + path: cypress/videos + + - name: Archive bucket metadata + uses: actions/upload-artifact@v2 + with: + name: origin-bucket-metadata + path: origin-bucket-metadata.json + notify: + if: (github.ref == 'refs/heads/master' || (github.event_name == 'pull_request' && github.event.pull_request.user.login == 'pulumi-bot')) && failure() + name: Send slack notification + runs-on: ubuntu-latest + needs: [buildSite] + steps: + - name: Slack Notification + uses: docker://sholung/action-slack-notify:v2.3.0 + env: + SLACK_CHANNEL: docs-ops + SLACK_COLOR: "#F54242" + SLACK_MESSAGE: "build and deploy failure in pulumi/docs repo :meow_sad:" + SLACK_USERNAME: docsbot + SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }} + SLACK_ICON: https://www.pulumi.com/logos/brand/avatar-on-white.png From 89b2e930eb735f1b445df2fc1770ab60d5bf9f0a Mon Sep 17 00:00:00 2001 From: Sean Holung Date: Fri, 17 May 2024 10:23:47 -0700 Subject: [PATCH 2/4] update command --- .github/workflows/build-and-deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-deploy.yml b/.github/workflows/build-and-deploy.yml index 4e96779e66cf..58b0cf4ea1b2 100644 --- a/.github/workflows/build-and-deploy.yml +++ b/.github/workflows/build-and-deploy.yml @@ -42,7 +42,7 @@ jobs: uses: pulumi/actions@v4 - name: Build and deploy - run: make ci_${GITHUB_EVENT_NAME} + run: make ci_push env: CDN_PULUMI_URN: ${{ vars.CDN_PULUMI_URN }} PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }} From 6d201cb2c61d28bceef21bd0aae248e0bf40411f Mon Sep 17 00:00:00 2001 From: Sean Holung Date: Wed, 27 Sep 2023 11:30:35 -0700 Subject: [PATCH 3/4] add clean up for test fix --- .github/workflows/bucket-cleanup-testing.yml | 45 ++++++++++++++++++++ .github/workflows/bucket-cleanup.yml | 1 + scripts/list-recent-buckets.sh | 8 +++- 3 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/bucket-cleanup-testing.yml diff --git a/.github/workflows/bucket-cleanup-testing.yml b/.github/workflows/bucket-cleanup-testing.yml new file mode 100644 index 000000000000..0b284ae78336 --- /dev/null +++ b/.github/workflows/bucket-cleanup-testing.yml @@ -0,0 +1,45 @@ +name: "Scheduled jobs: Bucket cleanup testing" +on: + schedule: + # * is a special character in YAML so you have to quote this string. + # Run every day at 3:00PM UTC. + - cron: '0 15 * * *' + workflow_dispatch: +permissions: + id-token: write # This is required for requesting the JWT + contents: read # This is required for actions/checkout +jobs: + all: + env: + GOPATH: ${{ github.workspace }}/go + name: Bucket cleanup + environment: testing + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - uses: actions/setup-node@v1 + with: + node-version: '18.x' + + - uses: actions/setup-go@v2 + with: + go-version: 1.19.x + + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v2 + with: + role-to-assume: arn:aws:iam::571684982431:role/ContinuousDelivery + role-session-name: docs-deploy + role-duration-seconds: 7200 + aws-region: us-west-2 + + - name: Run make ci_bucket_cleanup + run: make ci_bucket_cleanup + env: + PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }} + PULUMI_STACK_NAME: ${{ vars.PULUMI_STACK_NAME }} + SLACK_ACCESS_TOKEN: ${{ secrets.SLACK_ACCESS_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + DEPLOYMENT_ENVIRONMENT: ${{ vars.DEPLOYMENT_ENVIRONMENT }} + WEBSITE_URL: ${{ vars.WEBSITE_URL }} diff --git a/.github/workflows/bucket-cleanup.yml b/.github/workflows/bucket-cleanup.yml index aa273f174f12..a6743f0265b0 100644 --- a/.github/workflows/bucket-cleanup.yml +++ b/.github/workflows/bucket-cleanup.yml @@ -41,3 +41,4 @@ jobs: SLACK_ACCESS_TOKEN: ${{ secrets.SLACK_ACCESS_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} DEPLOYMENT_ENVIRONMENT: ${{ vars.DEPLOYMENT_ENVIRONMENT }} + WEBSITE_URL: ${{ vars.WEBSITE_URL }} diff --git a/scripts/list-recent-buckets.sh b/scripts/list-recent-buckets.sh index aeded6c1a051..b1ec181eb1e1 100755 --- a/scripts/list-recent-buckets.sh +++ b/scripts/list-recent-buckets.sh @@ -49,8 +49,14 @@ if [ "$bucket_count" == "0" ]; then exit fi +# Check if WEBSITE_URL is set +if [ -z "$WEBSITE_URL" ]; then + echo "WEBSITE_URL is not set." + exit 1 +fi + # Query for the bucket currently serving pulumi.com. -currently_deployed_bucket="$(curl -s https://www.pulumi.com/metadata.json | jq -r '.bucket' || echo '')" +currently_deployed_bucket="$(curl -s ${WEBSITE_URL}/metadata.json | jq -r '.bucket' || echo '')" maybe_echo "Found ${bucket_count} recent buckets matching the prefix $(origin_bucket_prefix)-${bucket_prefix}:" From adf5aca87da7e46bb3b5cfdb01b817b2072d4503 Mon Sep 17 00:00:00 2001 From: Sean Holung Date: Fri, 17 May 2024 16:51:25 -0700 Subject: [PATCH 4/4] remove go dependency --- .github/workflows/bucket-cleanup-testing.yml | 4 ---- .github/workflows/pull-request.yml | 4 ---- 2 files changed, 8 deletions(-) diff --git a/.github/workflows/bucket-cleanup-testing.yml b/.github/workflows/bucket-cleanup-testing.yml index 0b284ae78336..71e7aa1a3a10 100644 --- a/.github/workflows/bucket-cleanup-testing.yml +++ b/.github/workflows/bucket-cleanup-testing.yml @@ -22,10 +22,6 @@ jobs: with: node-version: '18.x' - - uses: actions/setup-go@v2 - with: - go-version: 1.19.x - - name: Configure AWS Credentials uses: aws-actions/configure-aws-credentials@v2 with: diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 4c492a2c4c0a..f698cf31a353 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -21,10 +21,6 @@ jobs: with: node-version: '18.x' - - uses: actions/setup-go@v2 - with: - go-version: 1.20.x - - uses: peaceiris/actions-hugo@v2 with: hugo-version: '0.111.0'