Add clarification for expected behavior of yield #5598
Workflow file for this run
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: "Library Injection" | |
on: | |
# Build each branch for testing | |
push: | |
jobs: | |
build-and-publish-test-image: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- 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 latest snapshot build | |
if: github.ref == 'refs/heads/master' | |
uses: docker/build-push-action@v3 | |
with: | |
push: true | |
tags: ghcr.io/datadog/dd-trace-rb/dd-lib-ruby-init:latest_snapshot | |
platforms: 'linux/amd64,linux/arm64/v8' | |
# The build arguments must match what is defined in lib-injection/Dockerfile | |
build-args: DATADOG_RUBY_GEM_SHA=${{ github.sha }} | |
context: ./lib-injection | |
- 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' | |
# The build arguments must match what is defined in lib-injection/Dockerfile | |
build-args: DATADOG_RUBY_GEM_SHA=${{ github.sha }} | |
context: ./lib-injection | |
test: | |
needs: | |
- build-and-publish-test-image | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
strategy: | |
matrix: | |
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 }} | |
DOCKER_REGISTRY_IMAGES_PATH: ghcr.io/datadog | |
DOCKER_IMAGE_TAG: ${{ github.sha }} | |
BUILDX_PLATFORMS: linux/amd64,linux/arm64/v8 | |
steps: | |
- name: Checkout system tests | |
uses: actions/checkout@v4 | |
with: | |
repository: 'DataDog/system-tests' | |
- name: Install runner | |
uses: ./.github/actions/install_runner | |
- name: Run K8s Lib Injection Tests | |
run: ./run.sh K8S_LIB_INJECTION_BASIC | |
- name: Compress logs | |
id: compress_logs | |
if: always() | |
run: tar -czvf artifact.tar.gz $(ls | grep logs) | |
- name: Upload artifact | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: logs_k8s_lib_injection | |
path: artifact.tar.gz | |
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@v4 | |
- name: Checkout system-tests | |
uses: actions/checkout@v4 | |
with: | |
repository: DataDog/system-tests | |
path: system-tests | |
- name: Overwrite auto inject script with commit SHA | |
run: | | |
sed -i "s~<DATADOG_GEM_SHA_TO_BE_REPLACED>~${{github.sha}}~g" lib-injection/auto_inject.rb | |
sed -i "s~<DATADOG_GEM_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 |