Skip to content

Replace with close #1988

Replace with close

Replace with close #1988

Workflow file for this run

name: "Library Injection"
on:
# Build each branch for testing
push:
jobs:
build-and-publish-test-image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
- name: Login to Docker
run: docker login -u publisher -p ${{ secrets.GITHUB_TOKEN }} ghcr.io
- name: Docker Build
uses: docker/build-push-action@v3
with:
push: true
tags: ghcr.io/datadog/dd-trace-rb/dd-lib-ruby-init:${{ github.sha }}
platforms: 'linux/amd64,linux/arm64/v8'
build-args: DDTRACE_RUBY_SHA=${{ github.sha }}
context: ./lib-injection
test:
needs:
- build-and-publish-test-image
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
strategy:
matrix:
lib-injection-connection: ['network']
lib-injection-use-admission-controller: ['', 'use-admission-controller']
weblog-variant:
- dd-lib-ruby-init-test-rails
- dd-lib-ruby-init-test-rails-explicit
- dd-lib-ruby-init-test-rails-gemsrb
fail-fast: false
env:
TEST_LIBRARY: ruby
WEBLOG_VARIANT: ${{ matrix.weblog-variant }}
LIBRARY_INJECTION_CONNECTION: ${{ matrix.lib-injection-connection }}
LIBRARY_INJECTION_ADMISSION_CONTROLLER: ${{ matrix.lib-injection-use-admission-controller }}
DOCKER_REGISTRY_IMAGES_PATH: ghcr.io/datadog
DOCKER_IMAGE_TAG: ${{ github.sha }}
BUILDX_PLATFORMS: linux/amd64,linux/arm64/v8
MODE: manual
steps:
- name: lib-injection test runner
id: lib-injection-test-runner
uses: DataDog/system-tests/lib-injection/runner@main
with:
docker-registry: ghcr.io
docker-registry-username: ${{ github.repository_owner }}
docker-registry-password: ${{ secrets.GITHUB_TOKEN }}
test-script: ./lib-injection/run-manual-lib-injection.sh
test-negative:
runs-on: ubuntu-latest
strategy:
matrix:
variant:
- dd-lib-ruby-init-test-rails-conflict
- dd-lib-ruby-init-test-rails-bundle-deploy
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Checkout system-tests
uses: actions/checkout@v3
with:
repository: DataDog/system-tests
path: system-tests
- name: Overwrite auto inject script with commit SHA
run: |
sed -i "s~<DD_TRACE_SHA_TO_BE_REPLACED>~${{github.sha}}~g" lib-injection/auto_inject.rb
sed -i "s~<DD_TRACE_VERSION_TO_BE_REPLACED>~~g" lib-injection/auto_inject.rb
- name: Build app
run: |
cp -r system-tests/lib-injection/build/docker/ruby/lib_injection_rails_app system-tests/lib-injection/build/docker/ruby/${{matrix.variant}}
cp system-tests/lib-injection/build/docker/ruby/.dockerignore system-tests/lib-injection/build/docker/ruby/${{matrix.variant}}
docker build -t ${{matrix.variant}} system-tests/lib-injection/build/docker/ruby/${{matrix.variant}}
- name: Run app with injection
run: |
docker run -d \
--name ${{matrix.variant}} \
-e RUBYOPT=-r/lib-injection/auto_inject \
-e DD_TRACE_DEBUG=true \
-v $(pwd)/lib-injection:/lib-injection \
-p 18080:18080 \
${{matrix.variant}}
- name: Log container to see error message
run: |
sleep 10
docker logs ${{matrix.variant}}
- name: Send http request to ensure app remains running even with lib injection failure
run: curl -v --retry 10 -f --retry-all-errors --retry-delay 5 -s -o /dev/null http://localhost:18080