Fix issue where UDP Exporter throws error in async callback, which isn't caught #797
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: JavaScript Instrumentation PR Build | |
| on: | |
| pull_request: | |
| types: | |
| - opened | |
| - reopened | |
| - synchronize | |
| - labeled | |
| - unlabeled | |
| branches: | |
| - main | |
| - "release/v*" | |
| permissions: | |
| id-token: write | |
| contents: read | |
| jobs: | |
| static-code-checks: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 #v5.0.0 | |
| with: | |
| fetch-depth: 0 | |
| - name: Check CHANGELOG | |
| if: always() | |
| run: | | |
| # Check if PR is from workflows bot or dependabot | |
| if [[ "${{ github.event.pull_request.user.login }}" == "aws-application-signals-bot" ]]; then | |
| echo "Skipping check: PR from aws-application-signals-bot" | |
| exit 0 | |
| fi | |
| if [[ "${{ github.event.pull_request.user.login }}" == "dependabot[bot]" ]]; then | |
| echo "Skipping check: PR from dependabot" | |
| exit 0 | |
| fi | |
| # Check for skip changelog label | |
| if echo '${{ toJSON(github.event.pull_request.labels.*.name) }}' | jq -r '.[]' | grep -q "skip changelog"; then | |
| echo "Skipping check: skip changelog label found" | |
| exit 0 | |
| fi | |
| # Fetch base branch and check for CHANGELOG modifications | |
| git fetch origin ${{ github.base_ref }} | |
| if git diff --name-only origin/${{ github.base_ref }}..HEAD | grep -q "CHANGELOG.md"; then | |
| echo "CHANGELOG.md entry found - check passed" | |
| exit 0 | |
| fi | |
| echo "It looks like you didn't add an entry to CHANGELOG.md. If this change affects the SDK behavior, please update CHANGELOG.md and link this PR in your entry. If this PR does not need a CHANGELOG entry, you can add the 'Skip Changelog' label to this PR." | |
| exit 1 | |
| - name: Check for versioned GitHub actions | |
| if: always() | |
| run: | | |
| # Get changed GitHub workflow/action files | |
| CHANGED_FILES=$(git diff --name-only origin/${{ github.base_ref }}..HEAD | grep -E "^\.github/(workflows|actions)/.*\.ya?ml$" || true) | |
| if [ -n "$CHANGED_FILES" ]; then | |
| # Check for any versioned actions, excluding comments and this validation script | |
| VIOLATIONS=$(grep -Hn "uses:.*@v" $CHANGED_FILES | grep -v "grep.*uses:.*@v" | grep -v "#.*@v" || true) | |
| if [ -n "$VIOLATIONS" ]; then | |
| echo "Found versioned GitHub actions. Use commit SHAs instead:" | |
| echo "$VIOLATIONS" | |
| exit 1 | |
| fi | |
| fi | |
| echo "No versioned actions found in changed files" | |
| build: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false # ensures the entire test matrix is run, even if one permutation fails | |
| matrix: | |
| node: ["14", "16", "18", "20", "22"] | |
| include: | |
| - node: 18 | |
| code-coverage: true | |
| env: | |
| NPM_CONFIG_UNSAFE_PERM: true | |
| steps: | |
| - name: Checkout Repo @ SHA - ${{ github.sha }} | |
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 #v5.0.0 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Node | |
| uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 #v5.0.0 | |
| with: | |
| node-version: ${{ matrix.node }} | |
| - name: Update npm to a version that supports workspaces (v7 or later) | |
| if: ${{ matrix.node < 16 }} | |
| run: npm install -g npm@9 # npm@9 supports node >=14.17.0 | |
| - name: NPM Clean Install | |
| # https://docs.npmjs.com/cli/v10/commands/npm-ci | |
| run: npm ci | |
| - name: Compile all NPM projects | |
| run: npm run compile | |
| - name: Build Tarball and Image Files | |
| uses: ./.github/actions/artifacts_build | |
| with: | |
| image_uri_with_tag: pr-build/${{ matrix.node }} | |
| push_image: false | |
| load_image: true | |
| node_version: ${{ matrix.node }} | |
| package_name: aws-distro-opentelemetry-node-autoinstrumentation | |
| os: ubuntu-latest | |
| - name: Build Lambda Layer | |
| run: npm run build-lambda | |
| - name: Unit tests (Full) | |
| run: npm run test:coverage | |
| - name: Report Coverage | |
| if: ${{ matrix.code-coverage && !cancelled()}} | |
| uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 #v5.5.1 | |
| with: | |
| verbose: true | |
| contract-test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 #v5.0.0 | |
| - name: run contract tests | |
| run: | | |
| bash ./scripts/build_and_install_distro.sh | |
| bash scripts/set-up-contract-tests.sh | |
| pip install pytest | |
| pytest contract-tests/tests | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 #v5.0.0 | |
| - uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 #v5.0.0 | |
| with: | |
| node-version: 18 | |
| cache: 'npm' | |
| - run: npm ci | |
| - name: Lint | |
| run: | | |
| npm run lint | |
| npm run lint:markdown | |
| npm run lint:readme | |
| all-pr-checks-pass: | |
| runs-on: ubuntu-latest | |
| needs: [static-code-checks, contract-test, lint, build] | |
| if: always() | |
| steps: | |
| - name: Checkout to get workflow file | |
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 #5.0.0 | |
| - name: Check all jobs succeeded and none missing | |
| run: | | |
| # Check if all needed jobs succeeded | |
| results='${{ toJSON(needs) }}' | |
| if echo "$results" | jq -r '.[] | .result' | grep -v success; then | |
| echo "Some jobs failed" | |
| exit 1 | |
| fi | |
| # Extract all job names from workflow (excluding this gate job) | |
| all_jobs=$(yq eval '.jobs | keys | .[]' .github/workflows/pr-build.yml | grep -v "all-pr-checks-pass" | sort) | |
| # Extract job names from needs array | |
| needed_jobs='${{ toJSON(needs) }}' | |
| needs_list=$(echo "$needed_jobs" | jq -r 'keys[]' | sort) | |
| # Check if any jobs are missing from needs | |
| missing_jobs=$(comm -23 <(echo "$all_jobs") <(echo "$needs_list")) | |
| if [ -n "$missing_jobs" ]; then | |
| echo "ERROR: Jobs missing from needs array in all-pr-checks-pass:" | |
| echo "$missing_jobs" | |
| echo "Please add these jobs to the needs array of all-pr-checks-pass" | |
| exit 1 | |
| fi | |
| echo "All checks passed and no jobs missing from gate!" |