Skip to content

fix: update schema reference #1008

fix: update schema reference

fix: update schema reference #1008

Workflow file for this run

name: CI
on:
push:
branches:
- 'main'
tags:
- 'v*'
pull_request:
branches:
- 'main'
permissions:
id-token: write
contents: read
# Ensure we only have one such workflow running per branch, to avoid
# conflicts in the test env
concurrency:
group: ${{ github.ref }}
jobs:
otelbin-verify:
name: OTelBin tests
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
- name: Install dependencies
shell: bash
working-directory: packages/otelbin
run: npm ci
- name: Lint
shell: bash
working-directory: packages/otelbin
run: npm run lint
- name: Test
shell: bash
working-directory: packages/otelbin
run: npm run test
otelbin-validation-image-verify:
name: OTelBin Validation Image Tests
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
- name: Install dependencies
shell: bash
working-directory: packages/otelbin-validation-image
run: npm ci
- name: Test
shell: bash
working-directory: packages/otelbin-validation-image
run: npm run test
prep-itests:
name: Deploy validation backend
needs: ['otelbin-verify', 'otelbin-validation-image-verify']
runs-on: 8core_32gb
timeout-minutes: 30
outputs:
test_matrix: ${{ steps.prepare_test_matrix.outputs.test_matrix }}
validation_api_apigateway_name: ${{ steps.parse_cdk_output.outputs.api_gateway_name }}
validation_api_apigateway_url: ${{ steps.parse_cdk_output.outputs.api_gateway_url }}\
validation_api_apigateway_key_id: ${{ steps.parse_cdk_output.outputs.api_gateway_key_id }}
test_env_name: ${{ steps.get_test_env_name.outputs.test_env_name }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
- name: Install CDK dependencies
shell: bash
working-directory: packages/otelbin-validation
run: |
npm ci
npm i -g aws-cli
- name: Get test environment name
id: get_test_env_name
shell: bash
env:
REF_NAME: ${{ github.head_ref || github.ref_name }}
# When the trigger is a pull event, use the PR's branch name (`github.head_ref`), which
# is available only for pull trigger. Otherwise, use the branch on which the commit was pushed.
# (Ref names in pull requests are in the shape of `<pr_id>/merge` and those will break CDK.)
run: |
echo "test_env_name=$(./.github/workflows/scripts/test_env_name.sh)" >> $GITHUB_OUTPUT || exit 1
- name: Select credentials
id: select_credentials
shell: bash
env:
TEST_ENVIRONMENT_NAME: ${{ steps.get_test_env_name.outputs.test_env_name }}
run: |
if [ "${TEST_ENVIRONMENT_NAME}" == 'main' ]; then
echo 'aws_account=${{secrets.OTELBIN_AUTOMATION_ACCOUNT_PROD}}' >> ${GITHUB_OUTPUT}
echo 'aws_access_key=${{secrets.OTELBIN_AUTOMATION_ACCESS_KEY_ID_PROD}}' >> ${GITHUB_OUTPUT}
echo 'aws_secret_access_key=${{secrets.OTELBIN_AUTOMATION_SECRET_ACCESS_KEY_PROD}}' >> ${GITHUB_OUTPUT}
echo 'role_arn=${{secrets.OTELBIN_AUTOMATION_ROLE_ARN_PROD}}' >> ${GITHUB_OUTPUT}
else
echo 'aws_account=${{secrets.OTELBIN_AUTOMATION_ACCOUNT_DEV}}' >> ${GITHUB_OUTPUT}
echo 'aws_access_key=${{secrets.OTELBIN_AUTOMATION_ACCESS_KEY_ID_DEV}}' >> ${GITHUB_OUTPUT}
echo 'aws_secret_access_key=${{secrets.OTELBIN_AUTOMATION_SECRET_ACCESS_KEY_DEV}}' >> ${GITHUB_OUTPUT}
echo 'role_arn=${{secrets.OTELBIN_AUTOMATION_ROLE_ARN_DEV}}' >> ${GITHUB_OUTPUT}
fi
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ steps.select_credentials.outputs.aws_access_key }}
aws-secret-access-key: ${{ steps.select_credentials.outputs.aws_secret_access_key }}
aws-region: 'us-east-2'
mask-aws-account-id: true
role-to-assume: ${{ steps.select_credentials.outputs.role_arn }}
- name: Deploy validation backend
shell: bash
working-directory: packages/otelbin-validation
env:
AWS_DEFAULT_REGION: 'us-east-2'
CDK_DEPLOY_ACCOUNT: ${{ steps.select_credentials.outputs.aws_account }}
CDK_DEPLOY_REGION: 'us-east-2'
GH_TOKEN: ${{ github.token }}
TEST_ENVIRONMENT_NAME: ${{ steps.get_test_env_name.outputs.test_env_name }}
DASH0_AUTHORIZATION_TOKEN: ${{ secrets.DASH0_AUTHORIZATION_TOKEN }}
run: |
npx projen deploy --require-approval never --outputs-file ./cdk-outputs.json
- name: Read API Gateway URL
id: parse_cdk_output
shell: bash
working-directory: packages/otelbin-validation
env:
TEST_ENVIRONMENT_NAME: ${{ steps.get_test_env_name.outputs.test_env_name }}
run: |
echo api_gateway_name=$(jq -r ".[\"otelbin-validation-${TEST_ENVIRONMENT_NAME}\"] | .apiname" < ./cdk-outputs.json) >> ${GITHUB_OUTPUT}
echo api_gateway_url=$(jq -r ".[\"otelbin-validation-${TEST_ENVIRONMENT_NAME}\"] | .apiurl" < ./cdk-outputs.json) >> ${GITHUB_OUTPUT}
echo api_gateway_key_id=$(jq -r ".[\"otelbin-validation-${TEST_ENVIRONMENT_NAME}\"] | .apikeyid" < ./cdk-outputs.json) >> ${GITHUB_OUTPUT}
- name: Prepare test matrix
id: prepare_test_matrix
shell: bash
working-directory: packages/otelbin-validation
run: |
echo test_matrix=$(jq -r '. | [to_entries[] | {distribution: .key, release: .value.releases[].version} | "\(.distribution)/\(.release)"]' < ./src/assets/supported-distributions.json) >> ${GITHUB_OUTPUT}
run-itests:
name: Validation tests
needs: ['prep-itests']
strategy:
matrix:
test_matrix: ${{ fromJson(needs.prep-itests.outputs.test_matrix )}}
fail-fast: false # We want to run all the tests, to prevent one failure from hiding another
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
- name: Install CDK dependencies
shell: bash
working-directory: packages/otelbin-validation
run: |
npm ci
- name: Select credentials
id: select_credentials
shell: bash
env:
TEST_ENVIRONMENT_NAME: ${{ needs.prep-itests.outputs.test_env_name }}
run: |
if [ "${TEST_ENVIRONMENT_NAME}" == 'main' ]; then
echo 'aws_access_key=${{secrets.OTELBIN_AUTOMATION_ACCESS_KEY_ID_PROD}}' >> ${GITHUB_OUTPUT}
echo 'aws_secret_access_key=${{secrets.OTELBIN_AUTOMATION_SECRET_ACCESS_KEY_PROD}}' >> ${GITHUB_OUTPUT}
echo 'role_arn=${{secrets.OTELBIN_AUTOMATION_ROLE_ARN_PROD}}' >> ${GITHUB_OUTPUT}
else
echo 'aws_access_key=${{secrets.OTELBIN_AUTOMATION_ACCESS_KEY_ID_DEV}}' >> ${GITHUB_OUTPUT}
echo 'aws_secret_access_key=${{secrets.OTELBIN_AUTOMATION_SECRET_ACCESS_KEY_DEV}}' >> ${GITHUB_OUTPUT}
echo 'role_arn=${{secrets.OTELBIN_AUTOMATION_ROLE_ARN_DEV}}' >> ${GITHUB_OUTPUT}
fi
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ steps.select_credentials.outputs.aws_access_key }}
aws-secret-access-key: ${{ steps.select_credentials.outputs.aws_secret_access_key }}
aws-region: 'us-east-2'
mask-aws-account-id: true
role-to-assume: ${{ steps.select_credentials.outputs.role_arn }}
- name: Retrieve API Key for Validation API and run tests
shell: bash
working-directory: packages/otelbin-validation
env:
AWS_DEFAULT_REGION: 'us-east-2'
API_GATEWAY_NAME: ${{ needs.prep-itests.outputs.validation_api_apigateway_name }}
API_GATEWAY_URL: ${{ needs.prep-itests.outputs.validation_api_apigateway_url }}
RELEASE_UNDER_TEST: ${{ matrix.test_matrix }}
run: |
VALIDATION_API_KEY=$(aws apigateway get-api-key --api-key ${{ needs.prep-itests.outputs.validation_api_apigateway_key_id }} --include-value | jq -r '.value') npm run test