Skip to content

feat: RD-13777-Remove-Mongo-IsMaster-spans-sampler #429

feat: RD-13777-Remove-Mongo-IsMaster-spans-sampler

feat: RD-13777-Remove-Mongo-IsMaster-spans-sampler #429

Workflow file for this run

name: Tracer Testing
on:
push:
branches: [ main ]
paths-ignore:
- '.github/**'
- '**.md'
pull_request:
types: [ opened, synchronize ]
paths-ignore:
- '.github/**'
- '**.md'
jobs:
pr-labeling:
runs-on: ubuntu-latest
permissions:
contents: write
issues: write
pull-requests: write
steps:
- uses: amannn/action-semantic-pull-request@v5
if: github.event_name == 'pull_request'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
disallowScopes: |
release
- uses: codelytv/pr-size-labeler@v1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
xs_label: 'size/xs'
xs_max_size: '15'
s_label: 'size/s'
s_max_size: '100'
m_label: 'size/m'
m_max_size: '500'
l_label: 'size/l'
l_max_size: '1000'
xl_label: 'size/xl'
fail_if_xl: 'false'
message_if_xl: >
This PR exceeds the recommended size of 1000 lines.
Please make sure you are NOT addressing multiple issues with one PR.
Note this PR might be rejected due to its size.
files_to_ignore: ''
spotless:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up JDK for running Gradle
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
- name: Spotless
uses: gradle/actions/setup-gradle@v3
with:
# this is a common failure point, so we run it first
arguments: spotlessCheck
cache-read-only: true
smoke-tests:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
- name: Configure aws credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_KEY }}
aws-region: 'us-west-2'
- name: Tests
uses: gradle/actions/setup-gradle@v3
with:
# exclude spotlessCheck to avoid running it twice
arguments: check -x spotlessCheck
cache-read-only: true
- name: Upload test reports
uses: actions/upload-artifact@v4
if: always()
with:
name: 'Smoke test reports'
path: |
**/build/reports/
**/build/test-results/
if-no-files-found: error
k8s-e2e:
runs-on: ubuntu-latest
steps:
- name: Clone the code
uses: actions/checkout@v4
- name: Cache go dependencies
uses: actions/cache@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Install KiND
uses: helm/kind-action@v1.5.0
with:
install_only: true
- name: Set up JDK for running Gradle
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
- name: Build the injector container
run: make -C integration-tests/k8s build-injector
shell: bash
- name: Set up gotestfmt
uses: GoTestTools/gotestfmt-action@v2
with:
# Optional: pass GITHUB_TOKEN to avoid rate limiting.
token: ${{ secrets.GITHUB_TOKEN }}
- name: Run Integration tests
shell: bash
working-directory: integration-tests/k8s
run: |
set -euo pipefail
go test -v -timeout 1h -json ./... --args -v 5 -build-tag=$(git rev-parse --short HEAD) 2>&1 | tee /tmp/gotest.log | gotestfmt
- name: Upload test log
uses: actions/upload-artifact@v4
if: always()
with:
name: k8s-e2e-test-log
path: /tmp/gotest.log
if-no-files-found: error
ecs-e2e:
# Needed by aws-actions/configure-aws-credentials
permissions:
id-token: write
contents: read
runs-on: ubuntu-latest
steps:
- name: Clone the code
uses: actions/checkout@v4
- name: Set up JDK for running Gradle
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
- name: Assemble the agent
uses: gradle/actions/setup-gradle@v3
with:
# Skip tests and spotless to get more specific K8s info in case
# of PRs with issues
arguments: |
clean assemble
-x test
-x spotlessCheck
cache-read-only: true
- uses: actions/setup-node@v3
- name: Configure aws credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_KEY }}
aws-region: 'us-west-2'
- name: Create a random deployment suffix
id: deployment-suffix
shell: bash
run: |
suffix=$(dd bs=512 if=/dev/urandom count=1 2>/dev/null | LC_ALL=C tr -dc "a-zA-Z0-9" | head -c 10)
echo "DEPLOYMENT_SUFFIX=${suffix}" >> $GITHUB_OUTPUT
- name: Install dependencies
run: yarn
working-directory: integration-tests/ecs
- name: CDK Bootstrap
run: yarn cdk bootstrap
working-directory: integration-tests/ecs
env:
DEPLOYMENT_SUFFIX: ${{ steps.deployment-suffix.outputs.DEPLOYMENT_SUFFIX }}
- name: Synth stack
run: yarn cdk synth
working-directory: integration-tests/ecs
env:
DEPLOYMENT_SUFFIX: ${{ steps.deployment-suffix.outputs.DEPLOYMENT_SUFFIX }}
- name: Deploy stack
run: yarn cdk deploy --all --require-approval never
working-directory: integration-tests/ecs
env:
DEPLOYMENT_SUFFIX: ${{ steps.deployment-suffix.outputs.DEPLOYMENT_SUFFIX }}
- name: Test the agent
env:
DEPLOYMENT_SUFFIX: ${{ steps.deployment-suffix.outputs.DEPLOYMENT_SUFFIX }}
shell: bash
run: |
suffix=${DEPLOYMENT_SUFFIX}
if [ -z "$suffix" ]; then
suffix="dev"
fi
suffix="-${suffix}"
start_time=$(($(date +%s000) - 100000))
log_count=$(aws logs filter-log-events --log-stream-name-prefix springboot --log-group-name JavaagentFargateTestLogGroup${suffix} --output text --start-time $start_time --end-time $(date +%s000) | grep -o "aws.ecs.task.arn" | wc -l | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')
log_count=$(($log_count + 0))
if [ $log_count -lt 1 ]; then
echo -e "\033[0;31mNo evidence for the aws.ecs.task.arn resource attribute in the logs. Expected at least 1 occurrence.\033[0m"
exit 1
fi
echo -e "\033[0;32mFound $log_count occurrences of the aws.ecs.task.arn resource attribute in the logs.\033[0m"
echo -e "\033[0;32mTest passes.\033[0m"
- name: remove stack
if: always()
run: yarn cdk destroy --all --force --require-approval never
working-directory: integration-tests/ecs
env:
DEPLOYMENT_SUFFIX: ${{ steps.deployment-suffix.outputs.DEPLOYMENT_SUFFIX }}
instrumentations-to-test:
name: List instrumentations to test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- id: list_instrumentations
run: |
instrumentationFolders=$(find instrumentation -type d -name "tested_versions" -not -path "*/build/*" | sed 's/instrumentation\///g' | sed 's/\/src\/main\/resources\/tested_versions//' | sort)
instrumentations_as_json_list=$(echo "$instrumentationFolders" | jq --raw-input --slurp 'split("\n") | map(select(. != ""))' | jq -r tostring)
echo "instrumentations=${instrumentations_as_json_list}" >> "${GITHUB_OUTPUT}"
echo "instrumentations=${instrumentations_as_json_list}"
outputs:
instrumentations: ${{ steps.list_instrumentations.outputs.instrumentations }}
supported-java-versions-testing:
name: 'JDK ${{ matrix.jdk_version }} ${{ matrix.instrumentation_to_test }} tests'
runs-on: ubuntu-latest
needs: [instrumentations-to-test]
strategy:
fail-fast: false # We want to see all tests being tried, rather than stop when the first fails
matrix:
jdk_version: [ 11, 17, 21]
instrumentation_to_test: ${{ fromJson(needs.instrumentations-to-test.outputs.instrumentations) }}
steps:
- uses: actions/checkout@v4
- name: Set up JDK ${{ matrix.jdk_version }}
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: ${{ matrix.jdk_version }}
- name: Configure aws credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_KEY }}
aws-region: 'us-west-2'
- run: ./gradlew clean
- run: ./gradlew build -x test
- run: .github/testComponentVersions.sh ${{ matrix.instrumentation_to_test }}
checks:
permissions:
contents: write
issues: write
runs-on: ubuntu-latest
needs: [ pr-labeling, spotless, smoke-tests, k8s-e2e, ecs-e2e, instrumentations-to-test, supported-java-versions-testing ]
# Force this job to run even if the previous jobs failed
if: ${{ always() }}
steps:
- name: Report failure
# Only create an issue if a previous job failed and this is a push to main
if: ${{contains(needs.*.result, 'failure') && github.event_name == 'push' && github.ref == 'refs/heads/main'}}
uses: actions-cool/issues-helper@v3
with:
actions: 'create-issue'
token: ${{ secrets.GITHUB_TOKEN }}
title: 🐛 Checks failed for ${{ github.sha }}
body: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
labels: bug