Skip to content

Vaccine

Vaccine #11

Workflow file for this run

name: Vaccine
on:
schedule:
- cron: '0 7 * * *'
workflow_dispatch:
inputs:
commit_sha:
description: 'Commit SHA'
required: true
default: 'latest_snapshot'
jobs:
inoculate:
name: ${{ matrix.engine.name }} ${{ matrix.engine.version }} with ${{ matrix.command }}
runs-on: ubuntu-latest
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: false
- 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
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 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.commit_sha || '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 \
-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
run: docker logs inoculation
- name: Crash puma server
run: 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
notify:
runs-on: ubuntu-latest
needs: inoculate
if: always() && github.event_name == 'schedule'
steps:
- if: ${{ needs.inoculate.result == 'success' }}
name: Notify on success
uses: slackapi/slack-github-action@v1.26.0
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/slack-github-action@v1.26.0
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 }}