From f9e2f749993038de4214bc352c67859945834b52 Mon Sep 17 00:00:00 2001 From: lukaszcl <120112546+lukaszcl@users.noreply.github.com> Date: Thu, 5 Sep 2024 11:55:59 +0200 Subject: [PATCH] Migrate on-demand-vrfv2plus-smoke-tests.yml to reusable workflow --- .../on-demand-vrfv2plus-smoke-tests 2.yml | 89 ---------- .../on-demand-vrfv2plus-smoke-tests.yml | 158 +++++++----------- 2 files changed, 57 insertions(+), 190 deletions(-) delete mode 100644 .github/workflows/on-demand-vrfv2plus-smoke-tests 2.yml diff --git a/.github/workflows/on-demand-vrfv2plus-smoke-tests 2.yml b/.github/workflows/on-demand-vrfv2plus-smoke-tests 2.yml deleted file mode 100644 index 23edea6d555..00000000000 --- a/.github/workflows/on-demand-vrfv2plus-smoke-tests 2.yml +++ /dev/null @@ -1,89 +0,0 @@ -name: On Demand VRFV2 Plus Smoke Tests USES REUSABLE WORKFLOW -on: - workflow_dispatch: - inputs: - test_suite: - description: "Test Suite to run" - required: true - type: choice - default: "All Tests" - options: - - "All Tests" - - "Selected Tests" - test_list_regex: - description: "Regex for 'Selected Tests' to run" - required: false - default: "TestVRFv2Plus$/(Link_Billing|Native_Billing|Direct_Funding)|TestVRFV2PlusWithBHS" - test_config_override_path: - description: Path to a test config file used to override the default test config - required: false - type: string - test_secrets_override_key: - description: 'Key to run tests with custom test secrets' - required: false - type: string - chainlink_version: - description: Chainlink image version to use - default: develop - required: false - type: string - -jobs: - set-tests-to-run: - name: Set tests to run - runs-on: ubuntu-latest - outputs: - test_list: ${{ steps.set-tests.outputs.test_list }} - steps: - - name: Generate Test List JSON - id: set-tests - run: | - if [[ "${{ inputs.test_suite }}" == "All Tests" ]]; then - TEST_CMD="cd integration-tests/smoke && go test vrfv2plus_test.go -test.parallel=1 -timeout 3h -count=1 -json -v" - else - TEST_CMD='cd integration-tests/smoke && go test -test.run "${{ inputs.test_list_regex }}" -test.parallel=1 -timeout 2h -count=1 -json -v' - fi - TEST_CONFIG_OVERRIDE_PATH=${{ inputs.test_config_override_path }} - - TEST_LIST=$(jq -n -c \ - --arg test_cmd "$TEST_CMD" \ - --arg test_config_override_path "$TEST_CONFIG_OVERRIDE_PATH" \ - '{ - "tests": [ - { - "id": "TestVRFv2Plus_Smoke", - "path": "integration-tests/smoke/vrfv2plus_test.go", - "runs_on": "ubuntu-latest", - "test_env_type": "docker", - "test_cmd": $test_cmd, - "test_config_override_path": $test_config_override_path - } - ] - }') - - echo "test_list=$TEST_LIST" >> $GITHUB_OUTPUT - - run-e2e-tests-workflow: - name: Run E2E Tests - needs: set-tests-to-run - uses: ./.github/workflows/run-e2e-tests-reusable-workflow.yml - with: - custom_test_list_json: ${{ needs.set-tests-to-run.outputs.test_list }} - chainlink_version: ${{ inputs.chainlink_version }} - secrets: - QA_AWS_REGION: ${{ secrets.QA_AWS_REGION }} - QA_AWS_ROLE_TO_ASSUME: ${{ secrets.QA_AWS_ROLE_TO_ASSUME }} - QA_AWS_ACCOUNT_NUMBER: ${{ secrets.QA_AWS_ACCOUNT_NUMBER }} - QA_PYROSCOPE_INSTANCE: ${{ secrets.QA_PYROSCOPE_INSTANCE }} - QA_PYROSCOPE_KEY: ${{ secrets.QA_PYROSCOPE_KEY }} - QA_KUBECONFIG: ${{ secrets.QA_KUBECONFIG }} - GRAFANA_INTERNAL_TENANT_ID: ${{ secrets.GRAFANA_INTERNAL_TENANT_ID }} - GRAFANA_INTERNAL_BASIC_AUTH: ${{ secrets.GRAFANA_INTERNAL_BASIC_AUTH }} - GRAFANA_INTERNAL_HOST: ${{ secrets.GRAFANA_INTERNAL_HOST }} - GRAFANA_INTERNAL_URL_SHORTENER_TOKEN: ${{ secrets.GRAFANA_INTERNAL_URL_SHORTENER_TOKEN }} - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - AWS_REGION: ${{ secrets.QA_AWS_REGION }} - AWS_OIDC_IAM_ROLE_VALIDATION_PROD_ARN: ${{ secrets.AWS_OIDC_IAM_ROLE_VALIDATION_PROD_ARN }} - AWS_API_GW_HOST_GRAFANA: ${{ secrets.AWS_API_GW_HOST_GRAFANA }} - TEST_SECRETS_OVERRIDE_BASE64: ${{ secrets[inputs.test_secrets_override_key] }} - diff --git a/.github/workflows/on-demand-vrfv2plus-smoke-tests.yml b/.github/workflows/on-demand-vrfv2plus-smoke-tests.yml index e7a9cd6ee95..268bb7e7d7a 100644 --- a/.github/workflows/on-demand-vrfv2plus-smoke-tests.yml +++ b/.github/workflows/on-demand-vrfv2plus-smoke-tests.yml @@ -6,6 +6,7 @@ on: description: "Test Suite to run" required: true type: choice + default: "All Tests" options: - "All Tests" - "Selected Tests" @@ -25,108 +26,63 @@ on: description: Chainlink image version to use default: develop required: false - type: string + type: string jobs: - vrfv2plus_smoke_test: - name: VRFV2 Plus Smoke Test - environment: integration - runs-on: ubuntu22.04-8cores-32GB - permissions: - checks: write - pull-requests: write - id-token: write - contents: read - env: - LOKI_URL: ${{ secrets.LOKI_URL }} - LOKI_TENANT_ID: ${{ secrets.LOKI_TENANT_ID }} - LOKI_BASIC_AUTH: ${{ secrets.LOKI_BASIC_AUTH }} - TEST_LOG_LEVEL: debug - REF_NAME: ${{ github.head_ref || github.ref_name }} - SLACK_API_KEY: ${{ secrets.QA_SLACK_API_KEY }} - SLACK_CHANNEL: ${{ secrets.QA_VRF_SLACK_CHANNEL }} - GRAFANA_URL: "http://localhost:8080/primary" - GRAFANA_DASHBOARD_URL: "/d/ddf75041-1e39-42af-aa46-361fe4c36e9e/ci-e2e-tests-logs" - GRAFANA_BEARER_TOKEN: ${{ secrets.GRAFANA_INTERNAL_URL_SHORTENER_TOKEN }} - WASP_LOG_LEVEL: info + set-tests-to-run: + name: Set tests to run + runs-on: ubuntu-latest + outputs: + test_list: ${{ steps.set-tests.outputs.test_list }} steps: - - name: Collect Metrics - id: collect-gha-metrics - uses: smartcontractkit/push-gha-metrics-action@d9da21a2747016b3e13de58c7d4115a3d5c97935 # v3.0.1 - with: - id: on-demand-vrfv2plus-smoke-tests - org-id: ${{ secrets.GRAFANA_INTERNAL_TENANT_ID }} - basic-auth: ${{ secrets.GRAFANA_INTERNAL_BASIC_AUTH }} - hostname: ${{ secrets.GRAFANA_INTERNAL_HOST }} - this-job-name: ${{ inputs.network }} VRFV2 Plus Smoke Test - continue-on-error: true - - name: Checkout code - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 - with: - fetch-depth: 0 - - name: Show test config override path in summary - if: ${{ inputs.test_config_override_path }} - run: | - echo "### Test config override path" >> $GITHUB_STEP_SUMMARY - echo "[${{ inputs.test_config_override_path }}]($GITHUB_SERVER_URL/$GITHUB_REPOSITORY/blob/${{ github.sha }}/${{ inputs.test_config_override_path }})" >> $GITHUB_STEP_SUMMARY - - name: Show test secrets override key in summary - if: ${{ inputs.test_secrets_override_key }} - run: | - echo "### Test secrets override key" >> $GITHUB_STEP_SUMMARY - echo "${{ inputs.test_secrets_override_key }}" >> $GITHUB_STEP_SUMMARY - - name: Show chainlink version in summary + - name: Generate Test List JSON + id: set-tests run: | - echo "### Chainlink version" >> $GITHUB_STEP_SUMMARY - echo "${{ inputs.chainlink_version }}" >> $GITHUB_STEP_SUMMARY - - name: Run Tests - if: ${{ github.event.inputs.test_suite == 'Selected Tests' }} - uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/run-tests@94cb11f4bd545607a2f221c6685052b3abee723d # v2.3.32 - env: - E2E_TEST_CHAINLINK_IMAGE: ${{ secrets.QA_AWS_ACCOUNT_NUMBER }}.dkr.ecr.${{ secrets.QA_AWS_REGION }}.amazonaws.com/chainlink - E2E_TEST_CHAINLINK_VERSION: ${{ inputs.chainlink_version }} # Default chainlink version if not overrided in the test config - E2E_TEST_LOKI_TENANT_ID: ${{ secrets.GRAFANA_INTERNAL_TENANT_ID }} - E2E_TEST_LOKI_ENDPOINT: https://${{ secrets.GRAFANA_INTERNAL_HOST }}/loki/api/v1/push - E2E_TEST_LOKI_BASIC_AUTH: ${{ secrets.GRAFANA_INTERNAL_BASIC_AUTH }} - E2E_TEST_GRAFANA_BASE_URL: "http://localhost:8080/primary" - E2E_TEST_GRAFANA_DASHBOARD_URL: "/d/ddf75041-1e39-42af-aa46-361fe4c36e9e/ci-e2e-tests-logs" - E2E_TEST_GRAFANA_BEARER_TOKEN: ${{ secrets.GRAFANA_INTERNAL_URL_SHORTENER_TOKEN }} - with: - test_command_to_run: cd ./integration-tests/smoke && go test -v -count=1 -parallel=1 -timeout 2h -run "${{ inputs.test_list_regex }}" 2>&1 | tee /tmp/gotest.log | gotestloghelper -ci -singlepackage -hidepassingtests=false -hidepassinglogs - test_download_vendor_packages_command: cd ./integration-tests && go mod download - test_secrets_override_base64: ${{ secrets[inputs.test_secrets_override_key] }} - test_config_override_path: ${{ inputs.test_config_override_path }} - aws_registries: ${{ secrets.QA_AWS_ACCOUNT_NUMBER }} - artifacts_name: vrf-test-logs - artifacts_location: ./integration-tests/smoke/vrfv2plus/logs/ - token: ${{ secrets.GITHUB_TOKEN }} - go_mod_path: ./integration-tests/go.mod - should_cleanup: false - QA_AWS_REGION: ${{ secrets.QA_AWS_REGION }} - QA_AWS_ROLE_TO_ASSUME: ${{ secrets.QA_AWS_ROLE_TO_ASSUME }} - QA_KUBECONFIG: ${{ secrets.QA_KUBECONFIG }} - - name: Run Tests - if: ${{ github.event.inputs.test_suite == 'All Tests' }} - uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/run-tests@94cb11f4bd545607a2f221c6685052b3abee723d # v2.3.32 - env: - E2E_TEST_CHAINLINK_IMAGE: ${{ secrets.QA_AWS_ACCOUNT_NUMBER }}.dkr.ecr.${{ secrets.QA_AWS_REGION }}.amazonaws.com/chainlink - E2E_TEST_CHAINLINK_VERSION: ${{ inputs.chainlink_version }} # Default chainlink version if not overrided in the test config - E2E_TEST_LOKI_TENANT_ID: ${{ secrets.GRAFANA_INTERNAL_TENANT_ID }} - E2E_TEST_LOKI_ENDPOINT: https://${{ secrets.GRAFANA_INTERNAL_HOST }}/loki/api/v1/push - E2E_TEST_LOKI_BASIC_AUTH: ${{ secrets.GRAFANA_INTERNAL_BASIC_AUTH }} - E2E_TEST_GRAFANA_BASE_URL: "http://localhost:8080/primary" - E2E_TEST_GRAFANA_DASHBOARD_URL: "/d/ddf75041-1e39-42af-aa46-361fe4c36e9e/ci-e2e-tests-logs" - E2E_TEST_GRAFANA_BEARER_TOKEN: ${{ secrets.GRAFANA_INTERNAL_URL_SHORTENER_TOKEN }} - with: - test_command_to_run: cd ./integration-tests/smoke && go test -v -count=1 -parallel=1 -timeout 3h vrfv2plus_test.go 2>&1 | tee /tmp/gotest.log | gotestloghelper -ci -singlepackage -hidepassingtests=false -hidepassinglogs - test_download_vendor_packages_command: cd ./integration-tests && go mod download - test_secrets_override_base64: ${{ secrets[inputs.test_secrets_override_key] }} - test_config_override_path: ${{ inputs.test_config_override_path }} - aws_registries: ${{ secrets.QA_AWS_ACCOUNT_NUMBER }} - artifacts_name: vrf-test-logs - artifacts_location: ./integration-tests/smoke/vrfv2plus/logs/ - token: ${{ secrets.GITHUB_TOKEN }} - go_mod_path: ./integration-tests/go.mod - should_cleanup: false - QA_AWS_REGION: ${{ secrets.QA_AWS_REGION }} - QA_AWS_ROLE_TO_ASSUME: ${{ secrets.QA_AWS_ROLE_TO_ASSUME }} - QA_KUBECONFIG: ${{ secrets.QA_KUBECONFIG }} + if [[ "${{ inputs.test_suite }}" == "All Tests" ]]; then + TEST_CMD="cd integration-tests/smoke && go test vrfv2plus_test.go -test.parallel=1 -timeout 3h -count=1 -json -v" + else + TEST_CMD='cd integration-tests/smoke && go test -test.run "${{ inputs.test_list_regex }}" -test.parallel=1 -timeout 2h -count=1 -json -v' + fi + TEST_CONFIG_OVERRIDE_PATH=${{ inputs.test_config_override_path }} + + TEST_LIST=$(jq -n -c \ + --arg test_cmd "$TEST_CMD" \ + --arg test_config_override_path "$TEST_CONFIG_OVERRIDE_PATH" \ + '{ + "tests": [ + { + "id": "TestVRFv2Plus_Smoke", + "path": "integration-tests/smoke/vrfv2plus_test.go", + "runs_on": "ubuntu-latest", + "test_env_type": "docker", + "test_cmd": $test_cmd, + "test_config_override_path": $test_config_override_path + } + ] + }') + + echo "test_list=$TEST_LIST" >> $GITHUB_OUTPUT + + run-e2e-tests-workflow: + name: Run E2E Tests + needs: set-tests-to-run + uses: ./.github/workflows/run-e2e-tests-reusable-workflow.yml + with: + custom_test_list_json: ${{ needs.set-tests-to-run.outputs.test_list }} + chainlink_version: ${{ inputs.chainlink_version }} + secrets: + QA_AWS_REGION: ${{ secrets.QA_AWS_REGION }} + QA_AWS_ROLE_TO_ASSUME: ${{ secrets.QA_AWS_ROLE_TO_ASSUME }} + QA_AWS_ACCOUNT_NUMBER: ${{ secrets.QA_AWS_ACCOUNT_NUMBER }} + QA_PYROSCOPE_INSTANCE: ${{ secrets.QA_PYROSCOPE_INSTANCE }} + QA_PYROSCOPE_KEY: ${{ secrets.QA_PYROSCOPE_KEY }} + QA_KUBECONFIG: ${{ secrets.QA_KUBECONFIG }} + GRAFANA_INTERNAL_TENANT_ID: ${{ secrets.GRAFANA_INTERNAL_TENANT_ID }} + GRAFANA_INTERNAL_BASIC_AUTH: ${{ secrets.GRAFANA_INTERNAL_BASIC_AUTH }} + GRAFANA_INTERNAL_HOST: ${{ secrets.GRAFANA_INTERNAL_HOST }} + GRAFANA_INTERNAL_URL_SHORTENER_TOKEN: ${{ secrets.GRAFANA_INTERNAL_URL_SHORTENER_TOKEN }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + AWS_REGION: ${{ secrets.QA_AWS_REGION }} + AWS_OIDC_IAM_ROLE_VALIDATION_PROD_ARN: ${{ secrets.AWS_OIDC_IAM_ROLE_VALIDATION_PROD_ARN }} + AWS_API_GW_HOST_GRAFANA: ${{ secrets.AWS_API_GW_HOST_GRAFANA }} + TEST_SECRETS_OVERRIDE_BASE64: ${{ secrets[inputs.test_secrets_override_key] }}