Skip to content

Commit 06fa09e

Browse files
committed
chore(ci): fix main workflow
1 parent 5f5c273 commit 06fa09e

File tree

9 files changed

+122
-28
lines changed

9 files changed

+122
-28
lines changed

.github/actions/fuzzer/action.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: 'Fuzzer'
2+
description: 'Run Fuzzer'
3+
inputs:
4+
binary: # id of input
5+
description: 'Fuzzer binary to execute'
6+
required: true
7+
duration_seconds:
8+
description: 'How long the fuzzer should run in seconds'
9+
required: true
10+
runs:
11+
using: "composite"
12+
steps:
13+
- name: Check inputs
14+
shell: bash
15+
run: |
16+
if [ ! -f "${{ inputs.binary }}" ]; then
17+
echo "Binary \"${{ inputs.binary }}\" not found"
18+
exit 1
19+
fi
20+
21+
- name: Prepare
22+
id: prepare
23+
shell: bash
24+
run: |
25+
echo "cache-key=${{ runner.os }}-${{ hashFiles(inputs.binary) }}" >> $GITHUB_OUTPUT
26+
echo "corpus-dir=corpus-${{ hashFiles(inputs.binary) }}" >> $GITHUB_OUTPUT
27+
28+
- uses: actions/cache/restore@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
29+
id: cache
30+
with:
31+
path: ${{ steps.prepare.outputs.corpus-dir }}
32+
key: ${{ steps.prepare.outputs.cache-key }}
33+
34+
- name: Initialize corpus
35+
if: steps.cache.outputs.cache-hit != 'true'
36+
shell: bash
37+
run: mkdir -p ${{ steps.prepare.outputs.corpus-dir }}
38+
39+
- name: Run
40+
run: ${{ inputs.binary }} -max_total_time=${{ inputs.duration_seconds }} ${{ steps.prepare.outputs.corpus-dir }}
41+
shell: bash
42+
43+
- uses: actions/cache/save@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
44+
with:
45+
path: ${{ steps.prepare.outputs.corpus-dir }}
46+
key: ${{ steps.prepare.outputs.cache-key }}

.github/workflows/dev.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
name: "Development"
22
on: [pull_request, workflow_dispatch, workflow_call]
33

4+
env:
5+
CI_IMAGE_COMMIT: 5f5c273
6+
47
jobs:
58
format:
6-
runs-on: ubuntu-22.04
9+
runs-on: ubuntu-22.04-arm
710
container:
8-
image: datadog/docker-library:dd-trace-cpp-ci
11+
image: datadog/docker-library:dd-trace-cpp-ci-${{ env.CI_IMAGE_COMMIT }}-arm64
912
steps:
1013
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
1114
- name: Check format
@@ -29,7 +32,7 @@ jobs:
2932
needs: format
3033
runs-on: ${{ matrix.runner }}
3134
container:
32-
image: datadog/docker-library:dd-trace-cpp-ci-91c12776-${{matrix.docker-arch}}
35+
image: datadog/docker-library:dd-trace-cpp-ci-${{ env.CI_IMAGE_COMMIT }}-${{matrix.docker-arch}}
3336
environment:
3437
name: dev
3538
permissions:
@@ -68,7 +71,7 @@ jobs:
6871
docker-arch: amd64
6972
runs-on: ${{ matrix.runner }}
7073
container:
71-
image: datadog/docker-library:dd-trace-cpp-ci-91c12776-${{matrix.docker-arch}}
74+
image: datadog/docker-library:dd-trace-cpp-ci-${{ env.CI_IMAGE_COMMIT }}-${{matrix.docker-arch}}
7275
steps:
7376
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
7477
- name: Build
@@ -144,7 +147,7 @@ jobs:
144147
needs: build-linux-cmake
145148
runs-on: ubuntu-22.04-arm
146149
container:
147-
image: datadog/docker-library:dd-trace-cpp-ci-91c12776-arm64
150+
image: datadog/docker-library:dd-trace-cpp-ci-${{ env.CI_IMAGE_COMMIT }}-arm64
148151
environment:
149152
name: dev
150153
permissions:

.github/workflows/main.yml

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,19 @@ on:
55
branches:
66
- main
77

8+
env:
9+
CI_IMAGE_COMMIT: 5f5c273
10+
811
jobs:
912
call-dev-workflow:
1013
uses: ./.github/workflows/dev.yml
11-
# - name: Upload artifact
12-
# uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
13-
# with:
14-
# name: binaries
15-
# path: .musl-build/ngx_http_datadog_module.so
14+
secrets: inherit
15+
permissions:
16+
contents: read
17+
packages: write
1618

1719
system-tests:
18-
uses: DataDog/system-tests/.github/workflows/system-tests.yml@main
20+
uses: DataDog/system-tests/.github/workflows/system-tests.yml@main
1921
secrets: inherit
2022
permissions:
2123
contents: read
@@ -24,10 +26,10 @@ jobs:
2426
library: cpp
2527
binaries_artifact: binaries
2628
desired_execution_time: 300 # 5 minutes
27-
scenarios_groups: appsec
28-
scenarios: DEFAULT
29-
excluded_scenarios: INTEGRATIONS # no test activated, and long warm-up
29+
scenarios: PARAMETRIC
3030
skip_empty_scenarios: true
31+
_system_tests_dev_mode: true
32+
display_summary: true
3133

3234
# Ensure the main job is run to completion
3335
check-system-tests:
@@ -41,19 +43,28 @@ jobs:
4143
needs: call-dev-workflow
4244
runs-on: ubuntu-22.04-arm
4345
container:
44-
image: datadog/docker-library:dd-trace-cpp-ci-91c12776-arm64
46+
image: datadog/docker-library:dd-trace-cpp-ci-${{ env.CI_IMAGE_COMMIT }}-arm64
4547
env:
4648
DURATION_SEC: 300 # 5min
4749
steps:
4850
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
4951
- name: Configure
50-
run: bin/with-toolchain llvm cmake . -B .build -DCMAKE_BUILD_TYPE=Debug -DDD_TRACE_BUILD_FUZZERS=1 -DDD_TRACE_ENABLE_SANITIZE=1
52+
run: bin/with-toolchain llvm cmake . -B .build -DCMAKE_BUILD_TYPE=Debug -DDD_TRACE_BUILD_FUZZERS=1 -DDD_TRACE_ENABLE_SANITIZE=1 -DDD_TRACE_TRANSPORT=none
5153
- name: Build
5254
run: cmake --build .build -j --target dd_trace_cpp-fuzzers
5355
- name: Run W3C propagation fuzzer
54-
run: ./.build/fuzz/w3c-propagation/w3c-propagation-fuzz -max_total_time=${DURATION_SEC}
56+
uses: ./.github/actions/fuzzer
57+
with:
58+
binary: ./.build/fuzz/w3c-propagation/w3c-propagation-fuzz
59+
duration_seconds: ${DURATION_SEC}
5560
- name: Run Base64 fuzzer
56-
run: ./.build/fuzz/base64/base64-fuzz -max_total_time=${DURATION_SEC}
61+
uses: ./.github/actions/fuzzer
62+
with:
63+
binary: ./.build/fuzz/base64/base64-fuzz
64+
duration_seconds: ${DURATION_SEC}
5765
- name: Run Remote Configuration fuzzer
58-
run: ./.build/fuzz/remote-configuration/remote-config-fuzz -max_total_time=${DURATION_SEC}
66+
uses: ./.github/actions/fuzzer
67+
with:
68+
binary: ./.build/fuzz/remote-configuration/remote-config-fuzz
69+
duration_seconds: ${DURATION_SEC}
5970

CMakeLists.txt

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -198,12 +198,9 @@ if (BUILD_SHARED_LIBS)
198198
)
199199
endif ()
200200

201-
add_dependencies(dd_trace_cpp-shared dd_trace_cpp-objects CURL::libcurl_shared)
202-
203201
target_link_libraries(dd_trace_cpp-shared
204202
PUBLIC
205203
dd_trace::obj
206-
CURL::libcurl_shared
207204
PRIVATE
208205
dd_trace::specs
209206
)
@@ -221,6 +218,8 @@ if (BUILD_STATIC_LIBS)
221218
add_library(dd_trace_cpp-static STATIC $<TARGET_OBJECTS:dd_trace_cpp-objects>)
222219
add_library(dd_trace::static ALIAS dd_trace_cpp-static)
223220

221+
add_dependencies(dd_trace_cpp-static dd_trace_cpp-objects)
222+
224223
if (DD_TRACE_TRANSPORT STREQUAL "curl")
225224
add_dependencies(dd_trace_cpp-static CURL::libcurl_static)
226225

@@ -241,8 +240,6 @@ if (BUILD_STATIC_LIBS)
241240
)
242241
endif ()
243242

244-
add_dependencies(dd_trace_cpp-static dd_trace_cpp-objects)
245-
246243
target_link_libraries(dd_trace_cpp-static
247244
PUBLIC
248245
dd_trace::obj

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ run apt-get update && apt-get install --yes software-properties-common && \
2020
apt-get update && apt-get upgrade --yes && \
2121
apt-get install --yes \
2222
wget build-essential clang sed gdb clang-format git ssh shellcheck \
23-
libc++-dev libc++abi-dev python3 pip coreutils curl gnupg
23+
libc++-dev libc++abi-dev python3 pip coreutils curl gnupg nodejs
2424

2525
# bazelisk, a launcher for bazel. `bazelisk --help` will cause the latest
2626
# version to be downloaded.

fuzz/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
add_subdirectory(base64)
22
add_subdirectory(tracing)
33
add_subdirectory(w3c-propagation)
4+
add_subdirectory(remote-configuration)
45

fuzz/remote-configuration/main.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include <datadog/string_view.h>
44

55
#include <cstdint>
6+
#include <mutex>
67
#include <sstream>
78
#include <string>
89

fuzz/w3c-propagation/fuzz.cpp

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,41 @@ namespace dd = datadog::tracing;
1515

1616
namespace {
1717

18+
// TODO: Move in `src` and be the default client if transport is `none`.
19+
class NullHttpClient : public dd::HTTPClient {
20+
public:
21+
dd::Expected<void> post(
22+
const URL& url, HeadersSetter set_headers, std::string body,
23+
ResponseHandler on_response, ErrorHandler on_error,
24+
std::chrono::steady_clock::time_point deadline) override {
25+
return {};
26+
}
27+
28+
// Wait until there are no more outstanding requests, or until the specified
29+
// `deadline`.
30+
void drain(std::chrono::steady_clock::time_point deadline) override {}
31+
32+
// Return a JSON representation of this object's configuration. The JSON
33+
// representation is an object with the following properties:
34+
//
35+
// - "type" is the unmangled, qualified name of the most-derived class, e.g.
36+
// "datadog::tracing::Curl".
37+
// - "config" is an object containing this object's configuration. "config"
38+
// may be omitted if the derived class has no configuration.
39+
std::string config() const override {
40+
return R"({"type": "NullHttpClient"})";
41+
};
42+
43+
~NullHttpClient() override = default;
44+
};
45+
1846
dd::Tracer& tracer_singleton() {
1947
thread_local auto tracer = []() {
2048
dd::TracerConfig config;
2149
config.service = "fuzzer";
2250
config.collector = std::make_shared<dd::NullCollector>();
2351
config.extraction_styles = {dd::PropagationStyle::W3C};
52+
config.agent.http_client = std::make_shared<NullHttpClient>();
2453

2554
const auto finalized_config = dd::finalize_config(config);
2655
if (!finalized_config) {

test/CMakeLists.txt

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ add_executable(tests
2424
test_baggage.cpp
2525
test_base64.cpp
2626
test_cerr_logger.cpp
27-
test_curl.cpp
2827
test_config_manager.cpp
2928
test_datadog_agent.cpp
3029
test_glob.cpp
@@ -62,10 +61,17 @@ target_compile_definitions(tests
6261

6362
target_link_libraries(tests
6463
PRIVATE
65-
# TODO: Remove dependency on libcurl
66-
CURL::libcurl_static
6764
dd_trace_cpp-static
6865
dd_trace::specs
6966
)
7067

68+
if(DD_TRACE_TRANSPORT STREQUAL "curl")
69+
target_sources(tests PRIVATE test_curl.cpp)
70+
target_link_libraries(tests
71+
PRIVATE
72+
# TODO: Remove dependency on libcurl
73+
CURL::libcurl_static
74+
)
75+
endif()
76+
7177
add_subdirectory(system-tests)

0 commit comments

Comments
 (0)