Skip to content

Commit c3607a6

Browse files
committed
Merge branch 'tonycthsu/karafka-community-support' into karafka-tracing
2 parents e34c2cb + 5446aaa commit c3607a6

File tree

741 files changed

+1863
-1856
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

741 files changed

+1863
-1856
lines changed

.circleci/config.yml

Lines changed: 0 additions & 585 deletions
This file was deleted.

.circleci/images/primary/README.md

Lines changed: 0 additions & 3 deletions
This file was deleted.

.circleci/images/primary/binary_version

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: 'Prepare bundle cache'
2+
3+
description: 'Sets up bundle cache for GitHub Actions'
4+
5+
outputs:
6+
cache-key:
7+
description: 'Cache key for the bundle'
8+
value: ${{ steps.restore-cache.outputs.cache-primary-key }}
9+
lockfile:
10+
description: 'Lockfile name'
11+
value: ${{ steps.lockfile.outputs.lockfile }}
12+
13+
runs:
14+
using: "composite"
15+
steps:
16+
- id: ruby-alias
17+
shell: bash
18+
run: |
19+
engine=$(ruby -e "puts RUBY_ENGINE")
20+
alias=$(ruby -e "puts RUBY_ENGINE_VERSION.split('.').take(2).join")
21+
22+
echo "ruby-alias=$engine-$alias" >> "$GITHUB_OUTPUT"
23+
- name: Generate lockfile
24+
id: lockfile
25+
shell: bash
26+
env:
27+
LOCKFILE: lockfile-${{ steps.ruby-alias.outputs.ruby-alias }}
28+
run: |
29+
bundle lock
30+
echo "lockfile=$LOCKFILE" >> "$GITHUB_OUTPUT"
31+
- name: Upload lockfile
32+
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
33+
with:
34+
name: ${{ steps.lockfile.outputs.lockfile }}
35+
path: "*.lock"
36+
- name: Restore cache
37+
uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
38+
id: restore-cache
39+
with:
40+
key: bundle-${{ runner.os }}-${{ runner.arch }}-${{ steps.ruby-alias.outputs.ruby-alias }}-${{ hashFiles('*.lock') }}
41+
path: "/usr/local/bundle"
42+
- if: steps.restore-cache.outputs.cache-hit != 'true'
43+
shell: bash
44+
run: bundle install
45+
- if: steps.restore-cache.outputs.cache-hit != 'true'
46+
name: Save cache
47+
uses: actions/cache/save@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
48+
with:
49+
key: "${{ steps.restore-cache.outputs.cache-primary-key }}"
50+
path: "/usr/local/bundle"
51+
- run: bundle check
52+
shell: bash

.github/actions/bundle-restore/action.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
name: 'Restore Bundle from cache'
1+
name: 'Restore bundle cache'
22

33
# TODO: Improve description
4-
description: 'Restore the bundle from cache'
4+
description: 'Restores bundle cache for GitHub Actions'
55

66
inputs:
7-
lockfile-name:
7+
lockfile:
88
description: 'Name of the lockfile artifact to download'
99
required: true
1010
cache-key:
@@ -17,7 +17,7 @@ runs:
1717
- name: Download lockfile
1818
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
1919
with:
20-
name: ${{ inputs.lockfile-name }}
20+
name: ${{ inputs.lockfile }}
2121

2222
- name: Restore cache
2323
uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0

.github/labeler.yml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,69 +3,69 @@
33

44
core:
55
- changed-files:
6-
- any-glob-to-any-file: [ 'lib/datadog/core/**' ]
6+
- any-glob-to-any-file: ['lib/datadog/core/**']
77

88
# Only documentation changes
99
docs:
1010
- changed-files:
11-
- all-globs-to-all-files: [ '**/*.md' ]
11+
- all-globs-to-all-files: ['**/*.md']
1212

1313
# Only test changes
1414
dev/testing:
1515
- changed-files:
16-
- all-globs-to-all-files: [ '{spec/**,integration/**,benchmarks/**}' ]
16+
- all-globs-to-all-files: ['{spec/**,integration/**,benchmarks/**}']
1717

1818
# Changes to Profiling
1919
profiling:
2020
- changed-files:
21-
- any-glob-to-any-file: [ '{lib/datadog/profiling/**,ext/datadog_profiling_native_extension/**}' ]
21+
- any-glob-to-any-file: ['{lib/datadog/profiling/**,ext/datadog_profiling_native_extension/**}']
2222

2323
# Changes to CI-App
2424
ci-app:
2525
- changed-files:
26-
- any-glob-to-any-file: [ 'lib/datadog/ci/**' ]
26+
- any-glob-to-any-file: ['lib/datadog/ci/**']
2727

2828
# Changes to ASM
2929
appsec:
3030
- changed-files:
31-
- any-glob-to-any-file: [ 'lib/datadog/appsec/**' ]
31+
- any-glob-to-any-file: ['lib/datadog/appsec/**']
3232

3333
# Changes to Tracing
3434
tracing:
3535
- changed-files:
36-
- any-glob-to-any-file: [ 'lib/datadog/tracing/**' ]
36+
- any-glob-to-any-file: ['lib/datadog/tracing/**']
3737

3838
# Changes to Tracing integrations
3939
integrations:
4040
- changed-files:
41-
- any-glob-to-any-file: [ '{lib/datadog/tracing/contrib/**,lib/datadog/appsec/contrib/**}' ]
41+
- any-glob-to-any-file: ['{lib/datadog/tracing/contrib/**,lib/datadog/appsec/contrib/**}']
4242

4343
# Only repository GitHub changes
4444
dev/github:
4545
- changed-files:
46-
- all-globs-to-all-files: [ '.github/**' ]
46+
- all-globs-to-all-files: ['.github/**']
4747

4848
# Only repository CI changes
4949
dev/ci:
5050
- changed-files:
51-
- all-globs-to-all-files: [ '{.circleci/**,.gitlab-ci.yml}' ]
51+
- all-globs-to-all-files: ['{.circleci/**,.gitlab-ci.yml}']
5252

5353
# Version bump pull request
5454
release:
5555
- changed-files:
56-
- all-globs-to-all-files: [ '{CHANGELOG.md,lib/datadog/version.rb}' ]
56+
- all-globs-to-all-files: ['{CHANGELOG.md,lib/datadog/version.rb}']
5757

5858
# Changes to OpenTelemetry
5959
otel:
6060
- changed-files:
61-
- any-glob-to-any-file: [ 'lib/datadog/opentelemetry/**' ]
61+
- any-glob-to-any-file: ['lib/datadog/opentelemetry/**']
6262

6363
# Changes to Single Step Instrumentation
6464
single-step:
6565
- changed-files:
66-
- any-glob-to-any-file: [ 'lib-injection/**' ]
66+
- any-glob-to-any-file: ['lib-injection/**']
6767

6868
# Changes to Debugging
6969
debugging:
7070
- changed-files:
71-
- any-glob-to-any-file: [ 'lib/datadog/debugging/**' ]
71+
- any-glob-to-any-file: ['lib/datadog/debugging/**']

.github/workflows/_unit_test.yml

Lines changed: 17 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: Unit Test Template
22

3-
on:
3+
on: # yamllint disable-line rule:truthy
44
workflow_call:
55
inputs:
66
# TODO: Provides concurrency control for each ruby version
@@ -28,36 +28,19 @@ jobs:
2828
outputs:
2929
batches: "${{ steps.set-batches.outputs.batches }}"
3030
misc: "${{ steps.set-batches.outputs.misc }}"
31-
cache-key: "${{ steps.restore-cache.outputs.cache-primary-key }}"
32-
lockfile: "${{ steps.lockfile.outputs.lockfile }}"
31+
cache-key: "${{ steps.bundle-cache.outputs.cache-key }}"
32+
lockfile: "${{ steps.bundle-cache.outputs.lockfile }}"
3333
container:
3434
image: ghcr.io/datadog/images-rb/engines/${{ inputs.engine }}:${{ inputs.version }}
3535
steps:
3636
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
37-
- name: Generate lockfile
38-
id: lockfile
39-
run: |
40-
bundle lock
41-
echo "lockfile=lockfile-${{ inputs.alias }}-${{ github.run_id }}" >> $GITHUB_OUTPUT
42-
- name: Upload lockfile
43-
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
44-
with:
45-
name: ${{ steps.lockfile.outputs.lockfile }}
46-
path: "*.lock"
47-
- name: Restore cache
48-
uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
49-
id: restore-cache
5037
with:
51-
key: bundle-${{ runner.os }}-${{ runner.arch }}-${{ inputs.alias }}-${{ hashFiles('*.lock') }}
52-
path: "/usr/local/bundle"
53-
- if: steps.restore-cache.outputs.cache-hit != 'true'
54-
run: bundle install
55-
- if: steps.restore-cache.outputs.cache-hit != 'true'
56-
name: Save cache
57-
uses: actions/cache/save@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
58-
with:
59-
key: "${{ steps.restore-cache.outputs.cache-primary-key }}"
60-
path: "/usr/local/bundle"
38+
persist-credentials: false
39+
40+
- name: Prepare bundle cache
41+
id: bundle-cache
42+
uses: ./.github/actions/bundle-cache
43+
6144
- id: set-batches
6245
name: Distribute tasks into batches
6346
run: |
@@ -68,8 +51,8 @@ jobs:
6851
batches_data=$(echo "$data" | ruby -rjson -e 'puts JSON.parse(STDIN.read)["batches"].to_json')
6952
misc_data=$(echo "$data" | ruby -rjson -e 'puts JSON.parse(STDIN.read)["misc"].to_json')
7053
71-
echo "batches=$batches_data" >> $GITHUB_OUTPUT
72-
echo "misc=$misc_data" >> $GITHUB_OUTPUT
54+
echo "batches=$batches_data" >> "$GITHUB_OUTPUT"
55+
echo "misc=$misc_data" >> "$GITHUB_OUTPUT"
7356
- name: Generate batch summary
7457
run: bundle exec rake github:generate_batch_summary
7558
env:
@@ -148,10 +131,12 @@ jobs:
148131
image: ghcr.io/datadog/images-rb/services/redis:6.2
149132
steps:
150133
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
134+
with:
135+
persist-credentials: false
151136
- name: Restore bundle cache
152137
uses: ./.github/actions/bundle-restore
153138
with:
154-
lockfile-name: ${{ needs.batch.outputs.lockfile }}
139+
lockfile: ${{ needs.batch.outputs.lockfile }}
155140
cache-key: ${{ needs.batch.outputs.cache-key }}
156141
- name: Build & Test
157142
uses: ./.github/actions/build-test
@@ -221,10 +206,12 @@ jobs:
221206
image: ghcr.io/datadog/images-rb/services/starburstdata/presto:332-e.9
222207
steps:
223208
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
209+
with:
210+
persist-credentials: false
224211
- name: Restore bundle cache
225212
uses: ./.github/actions/bundle-restore
226213
with:
227-
lockfile-name: ${{ needs.batch.outputs.lockfile }}
214+
lockfile: ${{ needs.batch.outputs.lockfile }}
228215
cache-key: ${{ needs.batch.outputs.cache-key }}
229216
- name: Build & Test
230217
uses: ./.github/actions/build-test

.github/workflows/add-milestone-to-pull-requests.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
name: Add milestone to merged pull requests
2-
on:
2+
3+
on: # yamllint disable-line rule:truthy
34
pull_request:
45
types: [closed]
56

@@ -16,13 +17,15 @@ jobs:
1617
# Checks out the branch that the pull request is merged into
1718
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
1819
with:
20+
persist-credentials: false
1921
ref: ${{ github.event.pull_request.base.ref }}
2022

2123
- name: Get major version from gemspec
2224
# Parse the gemspec and return the major version
2325
id: version
2426
run: |
25-
echo "::set-output name=version::$(find . -name *.gemspec | ruby -ne 'puts Gem::Specification.load($_.chomp).version.to_s.split(".").first')"
27+
VERSION=$(ruby -e "puts Gem::Specification.load(Dir.glob('*.gemspec').first).version.to_s.split('.').first")
28+
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
2629
2730
- name: Get project milestones
2831
id: milestones

.github/workflows/build-gem.yml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: Build gem
22

3-
on:
3+
on: # yamllint disable-line rule:truthy
44
workflow_dispatch:
55
inputs:
66
push:
@@ -10,10 +10,13 @@ on:
1010
default: true
1111
push:
1212
branches:
13-
- master
13+
- master
1414
pull_request:
1515
branches:
16-
- master
16+
- master
17+
18+
# Default permissions for all jobs
19+
permissions: {}
1720

1821
env:
1922
GEM_HOST: 'https://rubygems.pkg.github.com/DataDog'
@@ -31,32 +34,29 @@ jobs:
3134
steps:
3235
- name: Checkout
3336
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
37+
with:
38+
persist-credentials: false
3439
- uses: ruby/setup-ruby@8388f20e6a9c43cd241131b678469a9f89579f37 # v1.216.0
3540
with:
3641
ruby-version: '3.2'
3742
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
3843
- name: Patch version
3944
if: ${{ matrix.type != 'final' }}
45+
env:
46+
GHA_RUN_ID: ${{ github.run_id }}
47+
GIT_REF: ${{ github.ref }}
48+
GIT_SHA: ${{ github.sha }}
4049
run: |
41-
# Obtain context information
42-
gha_run_id='${{ github.run_id }}'
43-
git_ref='${{ github.ref }}'
44-
git_sha='${{ github.sha }}'
45-
46-
# Output info for CI debug
47-
echo gha_run_id="${gha_run_id}"
48-
echo git_ref="${git_ref}"
49-
echo git_sha="${git_sha}"
50+
.gitlab/patch_gem_version.sh gha "$GHA_RUN_ID" "$GIT_REF" "$GIT_SHA";
5051
51-
.gitlab/patch_gem_version.sh gha $gha_run_id $git_ref $git_sha;
5252
- name: Patch gem host
5353
if: ${{ matrix.type != 'final' }}
5454
run: |
5555
# Patch in GEM_HOST
5656
sed datadog.gemspec -i -e "s,^\([\t ]*spec\.metadata\['allowed_push_host'\]\) *= *,\1 = \'${GEM_HOST}\' # ,"
5757
5858
# Test result
59-
cat datadog.gemspec | grep -e allowed_push_host
59+
grep -e allowed_push_host datadog.gemspec
6060
- name: Build gem
6161
run: bundle exec rake build
6262
- name: List gem

0 commit comments

Comments
 (0)