dd-lib-ruby-init:ca926df5e94ce3afa2f078467e8dde7841509f8c glci:56422211 #3934
This file contains 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: Vaccine | |
on: | |
push: | |
schedule: | |
- cron: '0 7 * * *' | |
workflow_dispatch: | |
inputs: | |
dd-lib-ruby-init-tag: | |
description: 'dd-lib-ruby-init image tag' | |
required: true | |
default: 'latest_snapshot' | |
trigger-id: | |
description: 'Trigger ID' | |
required: false | |
default: '' | |
run-name: "dd-lib-ruby-init:${{ inputs.dd-lib-ruby-init-tag || 'latest_snapshot' }}${{ inputs.trigger-id && format(' {0}', inputs.trigger-id) }}" | |
jobs: | |
inoculate: | |
name: ${{ matrix.engine.name }} ${{ matrix.engine.version }} with ${{ matrix.command }} | |
runs-on: ubuntu-24.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
command: | |
- rails s | |
- bin/rails s | |
- bundle exec rails s | |
engine: | |
- name: ruby | |
version: '3.4' | |
validate: false | |
- name: ruby | |
version: '3.3' | |
validate: true | |
- name: ruby | |
version: '3.2' | |
validate: true | |
- name: ruby | |
version: '3.1' | |
validate: true | |
- name: ruby | |
version: '3.0' | |
validate: true | |
- name: ruby | |
version: '2.7' | |
validate: true | |
- name: ruby | |
version: '2.6' | |
validate: false | |
- name: ruby | |
version: '2.5' | |
validate: false | |
- name: ruby | |
version: '2.4' | |
validate: false | |
- name: ruby | |
version: '2.3' | |
validate: false | |
include: | |
- engine: | |
name: ruby | |
version: '2.2' | |
validate: false | |
command: 'ruby hello.rb' | |
- engine: | |
name: ruby | |
version: '2.1' | |
validate: false | |
command: 'ruby hello.rb' | |
- engine: | |
name: ruby | |
version: '2.0' | |
validate: false | |
command: 'ruby hello.rb' | |
- engine: | |
name: ruby | |
version: '1.9' | |
validate: false | |
command: 'ruby hello.rb' | |
- engine: | |
name: ruby | |
version: '1.8' | |
validate: false | |
command: 'ruby hello.rb' | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: .ruby-version | |
- run: bundle install | |
# Prepare mock server 'catadog', https://github.com/DataDog/catadog | |
- run: mkdir $GITHUB_WORKSPACE/records | |
- run: | | |
docker run -d \ | |
--name catadog \ | |
-v $GITHUB_WORKSPACE/records:/records \ | |
-p 8128:8128 \ | |
ghcr.io/datadog/catadog:latest \ | |
"-h 0.0.0.0 --mock :Sink --no-forward --record /records" | |
- run: curl -I --retry 12 -f --retry-all-errors --retry-delay 5 -s http://localhost:8128/catadog | |
# Prepare vaccine | |
- name: Prepare vaccine volume | |
run: | | |
docker create \ | |
--name init \ | |
-v vaccine:/datadog-init/package \ | |
ghcr.io/datadog/dd-trace-rb/dd-lib-ruby-init:${{ inputs.dd-lib-ruby-init-tag || 'latest_snapshot' }} | |
- run: | | |
docker build \ | |
--tag patient:${{ matrix.engine.name }}-${{ matrix.engine.version }} \ | |
--file src/${{ matrix.engine.name }}/${{ matrix.engine.version }}/Dockerfile \ | |
src | |
- name: Inject vaccine | |
run: | | |
docker run -d \ | |
--name inoculation \ | |
--network host \ | |
-v vaccine:/vaccine \ | |
-e RUBYOPT=-r/vaccine/host_inject \ | |
-e DD_TRACE_DEBUG=true \ | |
-e DD_INSTRUMENTATION_TELEMETRY_ENABLED=false \ | |
-e DD_AGENT_HOST=localhost \ | |
-e DD_TRACE_AGENT_PORT=8128 \ | |
-e DD_CRASHTRACKING_ENABLED=true \ | |
-p 3000:3000 \ | |
patient:${{ matrix.engine.name }}-${{ matrix.engine.version }} \ | |
"${{ matrix.command }} -b 0.0.0.0" | |
- name: Generate traces | |
run: curl -v --retry 12 -f --retry-all-errors --retry-delay 5 -s -o /dev/null http://localhost:3000 | |
- name: Inspect injection logs | |
if: always() | |
run: docker logs inoculation | |
- name: Crash puma server | |
run: sleep 2 && docker exec inoculation bash -c "pgrep -f puma | xargs kill -SEGV" || true | |
- run: sleep 2 && ls -al $GITHUB_WORKSPACE/records | |
- run: docker logs inoculation | |
- if: ${{ matrix.engine.validate }} | |
name: Validate crash report | |
run: RECORDS_DIR=$GITHUB_WORKSPACE/records bundle exec rspec | |
status-check: | |
runs-on: ubuntu-24.04 | |
needs: inoculate | |
steps: | |
- if: ${{ needs.inoculate.result == 'success' }} | |
name: Signal success | |
run: exit 0 | |
- if: ${{ needs.inoculate.result != 'success' }} | |
name: Signal failure | |
run: exit 1 | |
notify: | |
runs-on: ubuntu-24.04 | |
needs: inoculate | |
if: always() && github.event_name == 'schedule' | |
steps: | |
- if: ${{ needs.inoculate.result == 'success' }} | |
name: Notify on success | |
uses: slackapi/[email protected] | |
env: | |
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} | |
with: | |
channel-id: ${{ vars.SLACK_CHANNEL_ID }} | |
slack-message: |- | |
:github: ${{ github.repository }}: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} | |
:github-check: ${{ github.ref_type }}: ${{ github.ref_name }} | |
- if: ${{ needs.inoculate.result == 'failure' }} | |
name: Notify on failure | |
uses: slackapi/[email protected] | |
env: | |
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} | |
with: | |
channel-id: ${{ vars.SLACK_CHANNEL_ID }} | |
slack-message: |- | |
:github: ${{ github.repository }}: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} | |
:red-light: ${{ github.ref_type }}: ${{ github.ref_name }} |