Skip to content

Commit 8735238

Browse files
committed
Provide git metadata
1 parent 44bbcc1 commit 8735238

File tree

3 files changed

+41
-40
lines changed

3 files changed

+41
-40
lines changed

.circleci/config.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ orbs:
286286
287287
datadog-ci version
288288
289-
DD_ENV=ci DATADOG_API_KEY=$JUNIT_UPLOAD_API_KEY DATADOG_SITE=datadoghq.com datadog-ci junit upload --verbose --service dd-trace-rb tmp/rspec/
289+
DD_ENV=ci DATADOG_API_KEY=$JUNIT_UPLOAD_API_KEY DATADOG_SITE=datadoghq.com datadog-ci junit upload --dry-run --verbose --service dd-trace-rb tmp/rspec/
290290
- store_test_results:
291291
path: tmp/rspec
292292
- persist_to_workspace:

.github/workflows/test.yml

+17-11
Original file line numberDiff line numberDiff line change
@@ -1620,12 +1620,17 @@ jobs:
16201620
name: upload/junit
16211621
if: "!cancelled()"
16221622
runs-on: ubuntu-24.04
1623-
env:
1624-
DD_APP_KEY: "${{ secrets.DD_APP_KEY }}"
1625-
DD_API_KEY: "${{ secrets.DD_API_KEY }}"
1626-
DD_ENV: ci
1627-
DATADOG_SITE: datadoghq.com
1628-
DD_SERVICE: dd-trace-rb
1623+
container:
1624+
image: datadog/ci
1625+
credentials:
1626+
username: "${{ secrets.DOCKERHUB_USERNAME }}"
1627+
password: "${{ secrets.DOCKERHUB_TOKEN }}"
1628+
env:
1629+
DD_API_KEY: "${{ secrets.DD_API_KEY }}"
1630+
DD_ENV: ci
1631+
DATADOG_SITE: datadoghq.com
1632+
DD_SERVICE: dd-trace-rb
1633+
DD_GIT_REPOSITORY_URL: "${{ github.repositoryUrl }}"
16291634
needs:
16301635
- build-test-ruby-34
16311636
- build-test-ruby-33
@@ -1639,18 +1644,19 @@ jobs:
16391644
- build-test-jruby-93
16401645
- build-test-jruby-92
16411646
steps:
1642-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
1643-
- run: |
1644-
curl -L --fail --retry 5 https://github.com/DataDog/datadog-ci/releases/latest/download/datadog-ci_linux-x64 --output /usr/local/bin/datadog-ci
1645-
chmod +x /usr/local/bin/datadog-ci
16461647
- run: mkdir -p tmp/rspec && datadog-ci version
16471648
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16
16481649
with:
16491650
path: tmp/rspec
16501651
pattern: junit-*
16511652
merge-multiple: true
16521653
- run: sed -i 's;file="./;file=";g' tmp/rspec/*.xml
1653-
- run: datadog-ci junit upload --verbose --dry-run tmp/rspec/
1654+
- if: github.event_name == 'pull_request'
1655+
run: echo "DD_GIT_COMMIT_SHA=${{ github.event.pull_request.head.sha }}" >> $GITHUB_ENV
1656+
- if: github.event_name != 'pull_request'
1657+
run: echo "DD_GIT_COMMIT_SHA=${{ github.sha }}" >> $GITHUB_ENV
1658+
- run: echo $DD_GIT_COMMIT_SHA
1659+
- run: datadog-ci junit upload --verbose tmp/rspec/
16541660
coverage:
16551661
name: upload/coverage
16561662
runs-on: ubuntu-24.04

tasks/github.rake

+23-28
Original file line numberDiff line numberDiff line change
@@ -289,36 +289,22 @@ namespace :github do
289289
'name' => 'upload/junit',
290290
'if' => '!cancelled()',
291291
'runs-on' => ubuntu,
292-
'env' => {
293-
'DD_APP_KEY' => '${{ secrets.DD_APP_KEY }}',
294-
'DD_API_KEY' => '${{ secrets.DD_API_KEY }}',
295-
'DD_ENV' => 'ci',
296-
'DATADOG_SITE' => 'datadoghq.com',
297-
'DD_SERVICE' => 'dd-trace-rb',
292+
'container' => {
293+
'image' => 'datadog/ci',
294+
'credentials' => {
295+
'username' => '${{ secrets.DOCKERHUB_USERNAME }}',
296+
'password' => '${{ secrets.DOCKERHUB_TOKEN }}'
297+
},
298+
'env' => {
299+
'DD_API_KEY' => '${{ secrets.DD_API_KEY }}',
300+
'DD_ENV' => 'ci',
301+
'DATADOG_SITE' => 'datadoghq.com',
302+
'DD_SERVICE' => 'dd-trace-rb',
303+
'DD_GIT_REPOSITORY_URL' => '${{ github.repositoryUrl }}',
304+
}
298305
},
299-
# 'container' => {
300-
# 'image' => 'datadog/ci',
301-
# 'credentials' => {
302-
# 'username' => '${{ secrets.DOCKERHUB_USERNAME }}',
303-
# 'password' => '${{ secrets.DOCKERHUB_TOKEN }}'
304-
# },
305-
# 'env' => {
306-
# 'DD_APP_KEY' => '${{ secrets.DD_APP_KEY }}',
307-
# 'DD_API_KEY' => '${{ secrets.DD_API_KEY }}',
308-
# 'DD_ENV' => 'ci',
309-
# 'DATADOG_SITE' => 'datadoghq.com',
310-
# 'DD_SERVICE' => 'dd-trace-rb',
311-
# }
312-
# },
313306
'needs' => runtimes.map(&:build_test_id),
314307
'steps' => [
315-
{ 'uses' => 'actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683' },
316-
{
317-
'run' => <<~BASH
318-
curl -L --fail --retry 5 https://github.com/DataDog/datadog-ci/releases/latest/download/datadog-ci_linux-x64 --output /usr/local/bin/datadog-ci
319-
chmod +x /usr/local/bin/datadog-ci
320-
BASH
321-
},
322308
{ 'run' => 'mkdir -p tmp/rspec && datadog-ci version' },
323309
{
324310
'uses' => 'actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16',
@@ -329,7 +315,16 @@ namespace :github do
329315
}
330316
},
331317
{ 'run' => "sed -i 's;file=\"\.\/;file=\";g' tmp/rspec/*.xml" },
332-
{ 'run' => 'datadog-ci junit upload --verbose --dry-run tmp/rspec/' },
318+
{
319+
'if' => "github.event_name == 'pull_request'",
320+
'run' => 'echo "DD_GIT_COMMIT_SHA=${{ github.event.pull_request.head.sha }}" >> $GITHUB_ENV'
321+
},
322+
{
323+
'if' => "github.event_name != 'pull_request'",
324+
'run' => 'echo "DD_GIT_COMMIT_SHA=${{ github.sha }}" >> $GITHUB_ENV'
325+
},
326+
{ 'run' => 'echo $DD_GIT_COMMIT_SHA' },
327+
{ 'run' => 'datadog-ci junit upload --verbose tmp/rspec/' },
333328
]
334329
},
335330
'coverage' => {

0 commit comments

Comments
 (0)