Skip to content

Conversation

@lloeki
Copy link
Member

@lloeki lloeki commented Nov 17, 2025

What does this PR do?

  • Update Ruby injector to latest version
  • Adjust OCI package contents to match

Motivation:

Add various fixes + deployment mode

Change log entry

TODO: will be backfilled once undrafted.

Additional Notes:

TODO: this is a draft to trigger onboarding tests.

How to test the change?

CI should pass

@github-actions
Copy link

github-actions bot commented Nov 17, 2025

👋 Hey @lloeki, please fill "Change log entry" section in the pull request description.

If changes need to be present in CHANGELOG.md you can state it this way

**Change log entry**

Yes. A brief summary to be placed into the CHANGELOG.md

(possible answers Yes/Yep/Yeah)

Or you can opt out like that

**Change log entry**

None.

(possible answers No/Nope/None)

Visited at: 2025-11-18 14:17:20 UTC

@datadog-official
Copy link

datadog-official bot commented Nov 17, 2025

✅ Tests

🎉 All green!

❄️ No new flaky tests detected
🧪 All tests passed

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: ee7cde4 | Docs | Datadog PR Page | Was this helpful? Give us feedback!

@pr-commenter
Copy link

pr-commenter bot commented Nov 17, 2025

Benchmarks

Benchmark execution time: 2025-11-20 10:06:31

Comparing candidate commit ee7cde4 in PR branch lloeki/update-injector with baseline commit 77aa204 in branch master.

Found 0 performance improvements and 0 performance regressions! Performance is the same for 44 metrics, 2 unstable metrics.

@lloeki lloeki force-pushed the lloeki/update-injector branch from 55d55dc to 8119bb9 Compare November 19, 2025 14:41
@lloeki
Copy link
Member Author

lloeki commented Nov 19, 2025

Odd behaviour at the create-multi-arch-lib-injection-image stage:

$ echo "TAGS are $TAGS_AS_ARGUMENT"
TAGS are --tag registry.ddbuild.io/ssi/dd-lib-ruby-init:8119bb9fc46d2b7c8fa7440144ef0ab4c33a570d --tag registry.ddbuild.io/ssi/dd-lib-ruby-init:glci83149026 --tag registry.ddbuild.io/ssi/dd-lib-ruby-init:glci83149026-g8119bb9fc46d2b7c8fa7440144ef0ab4c33a570d 
$ datadog-package decompose --single-manifest-image packaging/*linux*amd64*.tar scripts/lib-injection/decomposed-amd64
Using local package package at packaging/datadog-apm-library-ruby-2.23.0.dev.bedb6bb.glci1244730020.g8119bb9f-linux-amd64.tar
2025/11/19 14:52:02 could not extract layer: could not create symlink: symlink injector.rb scripts/lib-injection/decomposed-amd64/contents/auto_inject.rb: no such file or directory

The odd part is that if I examine the artifacts from the previous stage they contain perfectly valid symlinks as expected, are the same as before, and have been working just fine til now:

$ tar xf datadog-apm-library-ruby-2.23.0.dev.bedb6bb.glci1244730020.g8119bb9f-linux-amd64.tar
$ tar tvzf datadog-apm-library-ruby-2.23.0.dev.bedb6bb.glci1244730020.g8119bb9f-linux-amd64/blobs/sha256/80abb142a762d320db497f3ee946859166151287e14bc8bfe3658ee2bf7e1d3c | head -3
lrwxrwxrwx  0 root   1000        0 Nov 19 15:48 auto_inject.rb -> injector.rb
lrwxrwxrwx  0 root   1000        0 Nov 19 15:48 host_inject.rb -> injector.rb
-rw-r--r--  0 root   1000     2628 Nov 19 15:48 injector.rb

So far no idea what's going on with that datadog-package decompose command failing, except no such file or directory seems to suggest a path component of scripts/lib-injection/decomposed-amd64/contents isn't there.

Ruby 2.6 decided to activate the default gem via `Kernel.gem` which makes it
subject to isolation, hence breaking under vendored mode.

This `Kernel.gem` activation happens in `gem_prelude` and can only be skipped
with the `--disable=did_you_mean` CLI flag.

Ruby 2.7 reverted that problematic behaviour, instead resorting to a plain
`require` which will either simply load from `$LOAD_PATH` or use a bundled
version.

To ensure no crash happens on Ruby 2.6 we package the corresponding
`did_you_mean` version.

See:
- gem_prelude.rb calls `Kernel.gem` on 2.6, but not 2.7:
  https://github.com/ruby/ruby/blob/ruby_2_6/gem_prelude.rb#L3-L7
  https://github.com/ruby/ruby/blob/ruby_2_7/gem_prelude.rb#L2
- gem_prelude.rb is included as a prelude script
  https://github.com/ruby/ruby/blob/ruby_2_6/common.mk#L158-L161
- prelude scripts get compiled in prelude.c:
  https://github.com/ruby/ruby/blob/ruby_2_6/common.mk#L1050-L1059
- prelude.c is generated from a template:
  https://github.com/ruby/ruby/blob/ruby_2_6/common.mk#L189
- the template embeds ISeqs of scripts
  https://github.com/ruby/ruby/blob/ruby_2_6/template/prelude.c.tmpl#L167-L168
- prelude targets are just prelude.c:
  https://github.com/ruby/ruby/blob/ruby_2_6/common.mk#L1081-L1082
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants