From 82d4dcbf276565e0d32b5a2a468b22cb148f3d14 Mon Sep 17 00:00:00 2001 From: Andrew Anguiano Date: Fri, 13 Sep 2024 11:02:12 -0400 Subject: [PATCH] feat: Remove additional workflows These should be no longer needed now that validation is done via JSON schema --- .../workflows/quickstarts.eu-production.yml | 20 -- .github/workflows/quickstarts.production.yml | 20 -- .github/workflows/quickstarts.staging.yml | 20 -- .../reusable.quickstart_submission.yml | 126 -------- .github/workflows/submit-gate.yml | 26 -- .github/workflows/validate_data_sources.yml | 56 ---- .github/workflows/validate_packs.yml | 281 ------------------ .github/workflows/validation_gate.yml | 23 -- 8 files changed, 572 deletions(-) delete mode 100644 .github/workflows/quickstarts.eu-production.yml delete mode 100644 .github/workflows/quickstarts.production.yml delete mode 100644 .github/workflows/quickstarts.staging.yml delete mode 100644 .github/workflows/reusable.quickstart_submission.yml delete mode 100644 .github/workflows/submit-gate.yml delete mode 100644 .github/workflows/validate_data_sources.yml delete mode 100644 .github/workflows/validate_packs.yml delete mode 100644 .github/workflows/validation_gate.yml diff --git a/.github/workflows/quickstarts.eu-production.yml b/.github/workflows/quickstarts.eu-production.yml deleted file mode 100644 index 518e0541f9..0000000000 --- a/.github/workflows/quickstarts.eu-production.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: Submit All - EU-Production - -on: - workflow_dispatch: - inputs: - pr-number: - description: 'PR to run against' - required: true - -jobs: - eu-production: - uses: ./.github/workflows/reusable.quickstart_submission.yml - with: - pr-number: ${{ github.event.inputs.pr-number }} - dry-run: false - secrets: - nr-api-url: ${{ secrets.NR_API_URL_EU }} - nr-api-token: ${{ secrets.NR_API_TOKEN_EU }} - github-token: ${{ secrets.GITHUB_TOKEN }} - nr-license-key: ${{ secrets.NEW_RELIC_LICENSE_KEY }} diff --git a/.github/workflows/quickstarts.production.yml b/.github/workflows/quickstarts.production.yml deleted file mode 100644 index 6a5b0a0d0e..0000000000 --- a/.github/workflows/quickstarts.production.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: Submit All - Production - -on: - workflow_dispatch: - inputs: - pr-number: - description: 'PR to run against' - required: true - -jobs: - production: - uses: ./.github/workflows/reusable.quickstart_submission.yml - with: - pr-number: ${{ github.event.inputs.pr-number }} - dry-run: false - secrets: - nr-api-url: ${{ secrets.NR_API_URL }} - nr-api-token: ${{ secrets.NR_API_TOKEN }} - github-token: ${{ secrets.GITHUB_TOKEN }} - nr-license-key: ${{ secrets.NEW_RELIC_LICENSE_KEY }} diff --git a/.github/workflows/quickstarts.staging.yml b/.github/workflows/quickstarts.staging.yml deleted file mode 100644 index 28e6a5b20a..0000000000 --- a/.github/workflows/quickstarts.staging.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: Submit All - Staging - -on: - workflow_dispatch: - inputs: - pr-number: - description: 'PR to run against' - required: true - -jobs: - staging: - uses: ./.github/workflows/reusable.quickstart_submission.yml - with: - pr-number: ${{ github.event.inputs.pr-number }} - dry-run: false - secrets: - nr-api-url: ${{ secrets.NR_API_URL_STAGING }} - nr-api-token: ${{ secrets.NR_API_TOKEN_STAGING }} - github-token: ${{ secrets.GITHUB_TOKEN }} - nr-license-key: ${{ secrets.NEW_RELIC_LICENSE_KEY }} diff --git a/.github/workflows/reusable.quickstart_submission.yml b/.github/workflows/reusable.quickstart_submission.yml deleted file mode 100644 index 4857fa880c..0000000000 --- a/.github/workflows/reusable.quickstart_submission.yml +++ /dev/null @@ -1,126 +0,0 @@ -# Reusable workflow for creating, updating, or validating quickstarts for a single environment. -name: Quickstart submission - -on: - workflow_call: - inputs: - pr-number: - required: true - type: string - dry-run: - required: true - type: boolean - default: true - secrets: - nr-api-url: - required: true - nr-api-token: - required: true - github-token: - required: true - nr-license-key: - required: true - -env: - PR_NUMBER: ${{ inputs.pr-number }} - DRY_RUN: ${{ inputs.dry-run }} - -jobs: - submit-data-sources: - name: Submit data sources - runs-on: ubuntu-latest - steps: - - name: Checkout repo - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 - # Ensure we have the most recent commit to `main` - with: - ref: 'main' - fetch-depth: 0 - - - name: Setup workspace - uses: './.github/actions/bootstrap' - - - name: Update data sources - env: - NR_API_URL: ${{ secrets.nr-api-url }} - NR_API_TOKEN: ${{ secrets.nr-api-token }} - GITHUB_TOKEN: ${{ secrets.github-token }} - NEW_RELIC_LICENSE_KEY: ${{ secrets.nr-license-key }} - run: | - URL="https://api.github.com/repos/${GITHUB_REPOSITORY}/pulls/$PR_NUMBER/files" - cd utils && yarn create-validate-data-sources "$URL" "$DRY_RUN" - - submit-quickstarts: - needs: [submit-data-sources] - name: Submit quickstarts - runs-on: ubuntu-latest - steps: - - name: Checkout repo - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 - # Ensure we have the most recent commit to `main` - with: - ref: 'main' - fetch-depth: 0 - - - name: Setup workspace - uses: './.github/actions/bootstrap' - - - name: Update quickstarts - env: - NR_API_URL: ${{ secrets.nr-api-url }} - NR_API_TOKEN: ${{ secrets.nr-api-token }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - NEW_RELIC_LICENSE_KEY: ${{ secrets.nr-license-key }} - run: | - URL="https://api.github.com/repos/${GITHUB_REPOSITORY}/pulls/$PR_NUMBER/files" - cd utils && yarn create-validate-pr-quickstarts "$URL" "$DRY_RUN" - - set-dashboard-required-datasources: - needs: [submit-quickstarts] - name: Set dashboard required datasources - runs-on: ubuntu-latest - steps: - - name: Checkout repo - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 - # Ensure we have the most recent commit to `main` - with: - ref: 'main' - fetch-depth: 0 - - - name: Setup workspace - uses: './.github/actions/bootstrap' - - - name: Update dashboards with required datasources from quickstarts - env: - NR_API_URL: ${{ secrets.nr-api-url }} - NR_API_TOKEN: ${{ secrets.nr-api-token }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - NEW_RELIC_LICENSE_KEY: ${{ secrets.nr-license-key }} - run: | - URL="https://api.github.com/repos/${GITHUB_REPOSITORY}/pulls/$PR_NUMBER/files" - cd utils && yarn set-dashboards-required-datasources "$URL" - - set-alert-policy-required-datasources: - needs: [submit-quickstarts] - name: Set alert policy required datasources - runs-on: ubuntu-latest - steps: - - name: Checkout repo - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 - # Ensure we have the most recent commit to `main` - with: - ref: 'main' - fetch-depth: 0 - - - name: Setup workspace - uses: './.github/actions/bootstrap' - - - name: Update dashboards with required datasources from quickstarts - env: - NR_API_URL: ${{ secrets.nr-api-url }} - NR_API_TOKEN: ${{ secrets.nr-api-token }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - NEW_RELIC_LICENSE_KEY: ${{ secrets.nr-license-key }} - run: | - URL="https://api.github.com/repos/${GITHUB_REPOSITORY}/pulls/$PR_NUMBER/files" - cd utils && yarn set-alert-policy-required-datasources "$URL" diff --git a/.github/workflows/submit-gate.yml b/.github/workflows/submit-gate.yml deleted file mode 100644 index 948919007f..0000000000 --- a/.github/workflows/submit-gate.yml +++ /dev/null @@ -1,26 +0,0 @@ -# This looks like a confusing workflow, but it has a purpose (✿ ◕‿◕) -# It functions kind of as a workflow shim. We can't setup other important workflows to run on pull_request (due to forks), so we setup this workflow to be triggered by pull_request and it is always able to run. -# When it is finished running, it triggers the other important workflows -- submit_packs, etc. -# Having it setup this way allows us to have manual approval for this workflow run, and then the subsequent triggered runs can access secrets in the repository for validation (even for forked PRs). -name: Submit Gate - -on: - pull_request: - branches: - - release - types: [closed] - -jobs: - upload-artifact: - runs-on: ubuntu-latest - if: ${{github.event.pull_request.merged}} - steps: - # This is used so that subsequent triggered workflows have access to the PR number that triggered this workflow. - # This is needed for PRs from forks which don't have access to certain information on github.event (or it isn't even available in the first place). - - name: write pr number - run: echo "${{ github.event.pull_request.number }}" > pr_number_submit.txt - - - name: upload artifact - uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 - with: - path: pr_number_submit.txt diff --git a/.github/workflows/validate_data_sources.yml b/.github/workflows/validate_data_sources.yml deleted file mode 100644 index 4d0e542d2c..0000000000 --- a/.github/workflows/validate_data_sources.yml +++ /dev/null @@ -1,56 +0,0 @@ -name: Validate data sources - -on: - workflow_run: - workflows: ["Validation Gate"] - types: - - completed - -jobs: - validate-data-source-schema: - name: Validate data source schema - runs-on: ubuntu-latest - steps: - - name: Download artifact - uses: dawidd6/action-download-artifact@268677152d06ba59fcec7a7f0b5d961b6ccd7e1e - with: - workflow: validation_gate.yml - run_id: ${{ github.event.workflow_run.id }} - - - name: Get PR number - id: get_pr_number - run: | - export PR_NUMBER=$(cat artifact/pr_number.txt) - echo "pr-number=$PR_NUMBER" >> $GITHUB_ENV - - - name: Checkout repository - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 - with: - ref: "refs/pull/${{ env.pr-number }}/merge" - - - name: Setup workspace - uses: "./.github/actions/bootstrap" - - - name: Validate new files - id: validation - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - NR_API_URL: ${{ secrets.NR_API_URL }} - NR_API_TOKEN: ${{ secrets.NR_API_TOKEN }} - NEW_RELIC_NO_CONFIG_FILE: true - NEW_RELIC_LICENSE_KEY: ${{ secrets.NEW_RELIC_LICENSE_KEY }} - NEW_RELIC_APP_NAME: ${{ secrets.NEW_RELIC_APP_NAME }} - NEW_RELIC_HOST: staging-collector.newrelic.com - NODE_ENV: production - PR_NUMBER: ${{ env.pr-number }} - run: | - URL="https://api.github.com/repos/${GITHUB_REPOSITORY}/pulls/$PR_NUMBER/files" - DRY_RUN=true - cd utils && yarn create-validate-data-sources $URL $DRY_RUN - - - name: Add commit status - if: always() - uses: "./.github/actions/add-commit-status" - with: - statusContext: "Validation / Data source schema compliance" - state: ${{ job.status }} diff --git a/.github/workflows/validate_packs.yml b/.github/workflows/validate_packs.yml deleted file mode 100644 index be85d7a1e7..0000000000 --- a/.github/workflows/validate_packs.yml +++ /dev/null @@ -1,281 +0,0 @@ -name: Validate quickstarts - -on: - workflow_run: - workflows: ["Validation Gate"] - types: - - completed - -env: - COMMIT_SHA: ${{ github.event.workflow_run.head_commit.id }} - -jobs: - ensure-quickstart-ids-are-unique: - name: Ensure quickstart ids are unique - runs-on: ubuntu-latest - steps: - - name: Download artifact - uses: dawidd6/action-download-artifact@268677152d06ba59fcec7a7f0b5d961b6ccd7e1e - with: - workflow: validation_gate.yml - run_id: ${{ github.event.workflow_run.id }} - - - name: Get PR number - id: get_pr_number - run: | - export PR_NUMBER=$(cat artifact/pr_number.txt) - echo "pr-number=$PR_NUMBER" >> $GITHUB_ENV - - - name: Checkout repository - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 - with: - ref: "refs/pull/${{ env.pr-number }}/merge" - - - name: Setup workspace - uses: "./.github/actions/bootstrap" - - - name: Check for unique names and ids - id: validation - run: cd utils && yarn check-quickstart-uniqueness - - - name: Add commit status - if: always() - uses: "./.github/actions/add-commit-status" - with: - statusContext: "Validation / Quickstart id are unique" - state: ${{ job.status }} - - ensure-images-are-valid: - name: Ensure images are valid - runs-on: ubuntu-latest - steps: - - name: Download artifact - uses: dawidd6/action-download-artifact@268677152d06ba59fcec7a7f0b5d961b6ccd7e1e - with: - workflow: validation_gate.yml - run_id: ${{ github.event.workflow_run.id }} - - - name: Get PR number - id: get_pr_number - run: | - export PR_NUMBER=$(cat artifact/pr_number.txt) - echo "pr-number=$PR_NUMBER" >> $GITHUB_ENV - - - name: Checkout repository - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 - with: - ref: "refs/pull/${{ env.pr-number }}/merge" - - - name: Setup workspace - uses: "./.github/actions/bootstrap" - - - name: Validate Images - id: validation - run: cd utils && yarn validate-images - - - name: Add commit status - if: always() - uses: "./.github/actions/add-commit-status" - with: - statusContext: "Validation / Image count and extension compliance" - state: ${{ job.status }} - - ensure-icons-exist: - name: Ensure icons exist - runs-on: ubuntu-latest - steps: - - name: Download artifact - uses: dawidd6/action-download-artifact@268677152d06ba59fcec7a7f0b5d961b6ccd7e1e - with: - workflow: validation_gate.yml - run_id: ${{ github.event.workflow_run.id }} - - - name: Get PR number - id: get_pr_number - run: | - export PR_NUMBER=$(cat artifact/pr_number.txt) - echo "pr-number=$PR_NUMBER" >> $GITHUB_ENV - - - name: Checkout repository - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 - with: - ref: "refs/pull/${{ env.pr-number }}/merge" - - - name: Setup workspace - uses: "./.github/actions/bootstrap" - - - name: Validate Icons - id: validation - run: cd utils && yarn validate-icons - - - name: Add commit status - if: always() - uses: "./.github/actions/add-commit-status" - with: - statusContext: "Validation / Ensure icons exist" - state: ${{ job.status }} - - validate-quickstart: - name: Validate Quickstart - runs-on: ubuntu-latest - steps: - - name: Download artifact - uses: dawidd6/action-download-artifact@268677152d06ba59fcec7a7f0b5d961b6ccd7e1e - with: - workflow: validation_gate.yml - run_id: ${{ github.event.workflow_run.id }} - - - name: Get PR number - id: get_pr_number - run: | - export PR_NUMBER=$(cat artifact/pr_number.txt) - echo "pr-number=$PR_NUMBER" >> $GITHUB_ENV - - - name: Checkout repository - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 - with: - ref: "refs/pull/${{ env.pr-number }}/merge" - - - name: Setup workspace - uses: "./.github/actions/bootstrap" - - - name: Validate pr quickstart files - id: validation - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - NR_API_URL: ${{ secrets.NR_API_URL }} - NR_API_TOKEN: ${{ secrets.NR_API_TOKEN }} - NEW_RELIC_NO_CONFIG_FILE: true - NEW_RELIC_LICENSE_KEY: ${{ secrets.NEW_RELIC_LICENSE_KEY }} - NEW_RELIC_APP_NAME: ${{ secrets.NEW_RELIC_APP_NAME }} - NEW_RELIC_HOST: staging-collector.newrelic.com - NODE_ENV: production - PR_NUMBER: ${{ env.pr-number }} - run: | - URL="https://api.github.com/repos/${GITHUB_REPOSITORY}/pulls/$PR_NUMBER/files" - DRY_RUN=true - cd utils && yarn create-validate-pr-quickstarts "$URL" "$DRY_RUN" - - - name: Add commit status - if: always() - uses: "./.github/actions/add-commit-status" - with: - statusContext: "Validation / Validate Quickstart Schema" - state: ${{ job.status }} - - validate-data-source-ids: - name: Validate data source ids - runs-on: ubuntu-latest - steps: - - name: Download artifact - uses: dawidd6/action-download-artifact@268677152d06ba59fcec7a7f0b5d961b6ccd7e1e - with: - workflow: validation_gate.yml - run_id: ${{ github.event.workflow_run.id }} - - - name: Get PR number - id: get_pr_number - run: | - export PR_NUMBER=$(cat artifact/pr_number.txt) - echo "pr-number=$PR_NUMBER" >> $GITHUB_ENV - - - name: Checkout repository - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 - with: - ref: "refs/pull/${{ env.pr-number }}/merge" - - - name: Setup workspace - uses: "./.github/actions/bootstrap" - - - name: Validate new files - id: validation - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - PR_NUMBER: ${{ env.pr-number }} - NR_API_URL: ${{ secrets.NR_API_URL }} - NR_API_TOKEN: ${{ secrets.NR_API_TOKEN }} - run: | - URL="https://api.github.com/repos/${GITHUB_REPOSITORY}/pulls/$PR_NUMBER/files" - cd utils && yarn validate-quickstart-data-sources "$URL" - - - name: Add commit status - if: always() - uses: "./.github/actions/add-commit-status" - with: - statusContext: "Validation / Data source ids exist" - state: ${{ job.status }} - - ensure-quickstart-dashboard-names-are-unique: - name: Ensure quickstart dashboard names are unique - runs-on: ubuntu-latest - steps: - - name: Download artifact - uses: dawidd6/action-download-artifact@268677152d06ba59fcec7a7f0b5d961b6ccd7e1e - with: - workflow: validation_gate.yml - run_id: ${{ github.event.workflow_run.id }} - - - name: Get PR number - id: get_pr_number - run: | - export PR_NUMBER=$(cat artifact/pr_number.txt) - echo "pr-number=$PR_NUMBER" >> $GITHUB_ENV - - - name: Checkout repository - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 - with: - ref: "refs/pull/${{ env.pr-number }}/merge" - - - name: Setup workspace - uses: "./.github/actions/bootstrap" - - - name: Check for unique dashboard names - id: validation - run: cd utils && yarn check-dashboard-name-uniqueness - - - name: Add commit status - if: always() - uses: "./.github/actions/add-commit-status" - with: - statusContext: "Validation / Quickstart dashboard name is unique" - state: ${{ job.status }} - - dashboard-helper: - runs-on: ubuntu-latest - steps: - - name: Download artifact - uses: dawidd6/action-download-artifact@268677152d06ba59fcec7a7f0b5d961b6ccd7e1e - with: - workflow: validation_gate.yml - run_id: ${{ github.event.workflow_run.id }} - - - name: Get PR number - id: get_pr_number - run: | - export PR_NUMBER=$(cat artifact/pr_number.txt) - echo "pr-number=$PR_NUMBER" >> $GITHUB_ENV - - - name: Checkout repository - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 - with: - ref: "refs/pull/${{ env.pr-number }}/merge" - - - name: Setup workspace - uses: "./.github/actions/bootstrap" - - - name: Run dashboard helper - id: helper - env: - PR_NUMBER: ${{ env.pr-number }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - URL="https://api.github.com/repos/${GITHUB_REPOSITORY}/pulls/$PR_NUMBER/files" - cd utils && yarn dashboard-helper $URL - - name: Comment - if: steps.helper.outputs.comment != '' - env: - PR_NUMBER: ${{ env.pr-number }} - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - COMMENT: ${{ steps.helper.outputs.comment }} - run: | - gh pr comment "$PR_NUMBER" --body "$COMMENT" diff --git a/.github/workflows/validation_gate.yml b/.github/workflows/validation_gate.yml deleted file mode 100644 index 958de4beb4..0000000000 --- a/.github/workflows/validation_gate.yml +++ /dev/null @@ -1,23 +0,0 @@ -# This looks like a confusing workflow, but it has a purpose (✿ ◕‿◕) -# It functions kind of as a workflow shim. We can't setup other important workflows to run on pull_request (due to forks), so we setup this workflow to be triggered by pull_request and it is always able to run. -# When it is finished running, it triggers the other important workflows -- validate_packs, etc. -# Having it setup this way allows us to have manual approval for this workflow run, and then the subsequent triggered runs can access secrets in the repository for validation (even for forked PRs). -name: Validation Gate - -on: - pull_request: - -jobs: - upload-artifact: - runs-on: ubuntu-latest - - steps: - # This is used so that subsequent triggered workflows have access to the PR number that triggered this workflow. - # This is needed for PRs from forks which don't have access to certain information on github.event (or it isn't even available in the first place). - - name: write pr number - run: echo "${{ github.event.pull_request.number }}" > pr_number.txt - - - name: upload artifact - uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 - with: - path: pr_number.txt