diff --git a/.github/workflows/run-e2e-tests.yml b/.github/workflows/run-e2e-tests.yml index 61862ee4..2c8b455e 100644 --- a/.github/workflows/run-e2e-tests.yml +++ b/.github/workflows/run-e2e-tests.yml @@ -178,6 +178,8 @@ on: required: true QA_AWS_ACCOUNT_NUMBER: required: true + PROD_AWS_ACCOUNT_NUMBER: + required: true QA_PYROSCOPE_INSTANCE: required: true QA_PYROSCOPE_KEY: @@ -217,8 +219,6 @@ on: # Used in some tests to send slack notifications SLACK_CHANNEL: required: false - AWS_ACCOUNT_ID_PROD: - required: false env: CHAINLINK_IMAGE: @@ -242,6 +242,9 @@ env: ${{ inputs.slack_notification_after_tests_channel_id || inputs.SLACK_CHANNEL || secrets.SLACK_CHANNEL }} SLACK_USER: ${{ inputs.SLACK_USER }} + E2E_JD_IMAGE: + ${{ secrets.PROD_AWS_ACCOUNT_NUMBER }}.dkr.ecr.${{ + secrets.AWS_REGION}}.amazonaws.com/job-distributor jobs: validate-inputs: @@ -646,6 +649,22 @@ jobs: --user "$(id -u):$(id -g)" \ -p 4317:4317 otel/opentelemetry-collector:0.88.0 --config=/etc/otel-collector.yaml + - name: Set dynamic env vars for tests + shell: bash + run: | + json_content='${{ toJson(matrix.tests.test_env_vars) }}' + test_id='${{ matrix.tests.id }}' + + # Check if json_content is non-empty and is a valid JSON object that is not null + if [ -z "$json_content" ] || [ "$json_content" = 'null' ] || ! echo "$json_content" | jq -e .; then + echo "No dynamic environment variables for $test_id." + else + echo "$json_content" | jq -r 'to_entries | .[] | "\(.key)=\(.value)"' | while IFS='=' read -r key value; do + echo "Setting $key=$value for $test_id" + echo "$key=$value" >> "$GITHUB_ENV" + done + fi + - name: Run tests id: run_tests uses: smartcontractkit/.github/actions/ctf-run-tests@b8731364b119e88983e94b0c4da87fc27ddb41b8 # ctf-run-tests@0.0.0 @@ -654,21 +673,12 @@ jobs: E2E_TEST_CHAINLINK_VERSION: ${{ matrix.tests.test_env_vars.E2E_TEST_CHAINLINK_VERSION || env.DEFAULT_CHAINLINK_VERSION }} - E2E_TEST_CHAINLINK_UPGRADE_VERSION: - ${{ matrix.tests.test_env_vars.E2E_TEST_CHAINLINK_UPGRADE_VERSION }} - E2E_TEST_CHAINLINK_POSTGRES_VERSION: - ${{ matrix.tests.test_env_vars.E2E_TEST_CHAINLINK_POSTGRES_VERSION - }} - E2E_TEST_SELECTED_NETWORK: - ${{ matrix.tests.test_env_vars.E2E_TEST_SELECTED_NETWORK }} E2E_TEST_LOGGING_RUN_ID: ${{ github.run_id }} E2E_TEST_LOG_STREAM_LOG_TARGETS: ${{ vars.LOGSTREAM_LOG_TARGETS }} E2E_TEST_LOG_COLLECT: ${{ vars.TEST_LOG_COLLECT }} E2E_TEST_LOKI_TENANT_ID: ${{ secrets.LOKI_TENANT_ID }} E2E_TEST_LOKI_ENDPOINT: ${{ secrets.LOKI_URL }} E2E_TEST_LOKI_BASIC_AUTH: ${{ secrets.LOKI_BASIC_AUTH }} - E2E_TEST_GRAFANA_DASHBOARD_URL: - ${{ matrix.tests.test_env_vars.E2E_TEST_GRAFANA_DASHBOARD_URL }} E2E_TEST_GRAFANA_BEARER_TOKEN: ${{ secrets.GRAFANA_INTERNAL_URL_SHORTENER_TOKEN }} E2E_TEST_PYROSCOPE_ENVIRONMENT: ${{ matrix.tests.pyroscope_env }} @@ -678,10 +688,6 @@ jobs: E2E_TEST_PYROSCOPE_KEY: ${{ matrix.tests.pyroscope_env != '' && secrets.QA_PYROSCOPE_KEY || '' }} - E2E_JD_IMAGE: - ${{ secrets.AWS_ACCOUNT_ID_PROD }}.dkr.ecr.${{ secrets.AWS_REGION - }}.amazonaws.com/job-distributor - E2E_JD_VERSION: 0.4.0 with: test_command_to_run: ${{ matrix.tests.test_cmd }} ${{ matrix.tests.test_cmd_opts || '2>&1 @@ -700,8 +706,8 @@ jobs: default_e2e_test_chainlink_upgrade_image: ${{ matrix.tests.test_env_vars.E2E_TEST_CHAINLINK_UPGRADE_IMAGE }} aws_registries: - ${{ secrets.QA_AWS_ACCOUNT_NUMBER }},${{ secrets.AWS_ACCOUNT_ID_PROD - }} + ${{ secrets.QA_AWS_ACCOUNT_NUMBER }},${{ + secrets.PROD_AWS_ACCOUNT_NUMBER }} artifacts_name: ${{ env.TEST_ID }}-test-logs artifacts_location: | ./integration-tests/smoke/logs/ @@ -915,6 +921,22 @@ jobs: - name: Show test configuration in logs run: echo '${{ toJson(matrix.tests) }}' | jq . + - name: Set dynamic env vars for tests + shell: bash + run: | + json_content='${{ toJson(matrix.tests.test_env_vars) }}' + test_id='${{ matrix.tests.id }}' + + # Check if json_content is non-empty and is a valid JSON object that is not null + if [ -z "$json_content" ] || [ "$json_content" = 'null' ] || ! echo "$json_content" | jq -e .; then + echo "No dynamic environment variables for $test_id." + else + echo "$json_content" | jq -r 'to_entries | .[] | "\(.key)=\(.value)"' | while IFS='=' read -r key value; do + echo "Setting $key=$value for $test_id" + echo "$key=$value" >> "$GITHUB_ENV" + done + fi + - name: Run tests id: run_tests uses: smartcontractkit/.github/actions/ctf-run-tests@b6e37806737eef87e8c9137ceeb23ef0bff8b1db # ctf-run-tests@0.1.0 @@ -932,29 +954,16 @@ jobs: ${{ secrets.QA_AWS_ACCOUNT_NUMBER }}.dkr.ecr.${{ secrets.QA_AWS_REGION }}.amazonaws.com # We can comment these out when we have a stable soak test and aren't worried about resource consumption - TEST_UPLOAD_CPU_PROFILE: - ${{ matrix.tests.test_env_vars.TEST_UPLOAD_CPU_PROFILE }} - TEST_UPLOAD_MEM_PROFILE: - ${{ matrix.tests.test_env_vars.TEST_UPLOAD_MEM_PROFILE }} REF_NAME: ${{ github.head_ref || github.ref_name }} E2E_TEST_CHAINLINK_VERSION: ${{ matrix.tests.test_env_vars.E2E_TEST_CHAINLINK_VERSION || env.DEFAULT_CHAINLINK_VERSION }} - E2E_TEST_CHAINLINK_UPGRADE_VERSION: - ${{ matrix.tests.test_env_vars.E2E_TEST_CHAINLINK_UPGRADE_VERSION }} - E2E_TEST_CHAINLINK_POSTGRES_VERSION: - ${{ matrix.tests.test_env_vars.E2E_TEST_CHAINLINK_POSTGRES_VERSION - }} - E2E_TEST_SELECTED_NETWORK: - ${{ matrix.tests.test_env_vars.E2E_TEST_SELECTED_NETWORK }} E2E_TEST_LOGGING_RUN_ID: ${{ github.run_id }} E2E_TEST_LOG_STREAM_LOG_TARGETS: ${{ vars.LOGSTREAM_LOG_TARGETS }} E2E_TEST_LOG_COLLECT: ${{ vars.TEST_LOG_COLLECT }} E2E_TEST_LOKI_TENANT_ID: ${{ secrets.LOKI_TENANT_ID }} E2E_TEST_LOKI_ENDPOINT: ${{ secrets.LOKI_URL }} E2E_TEST_LOKI_BASIC_AUTH: ${{ secrets.LOKI_BASIC_AUTH }} - E2E_TEST_GRAFANA_DASHBOARD_URL: - ${{ matrix.tests.test_env_vars.E2E_TEST_GRAFANA_DASHBOARD_URL }} E2E_TEST_GRAFANA_BEARER_TOKEN: ${{ secrets.GRAFANA_INTERNAL_URL_SHORTENER_TOKEN }} E2E_TEST_PYROSCOPE_ENVIRONMENT: ${{ matrix.tests.pyroscope_env }} diff --git a/CODEOWNERS b/CODEOWNERS index fae9c2b8..c6089b56 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -2,3 +2,4 @@ # Chainlink Testing Framework (CTF) /actions/ctf-*/** @smartcontractkit/test-tooling-team +.github/workflows/run-e2e-tests.yml @smartcontractkit/test-tooling-team