Skip to content

fix: resolve git config failures during testing#347

Open
patrick-stephens wants to merge 19 commits into
mainfrom
341_resolve_git_config_failures
Open

fix: resolve git config failures during testing#347
patrick-stephens wants to merge 19 commits into
mainfrom
341_resolve_git_config_failures

Conversation

@patrick-stephens

@patrick-stephens patrick-stephens commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Resolves #341 by fixing various issues found during testing of the git_config plugin:

  • CentOS 6 version of git is old and behaves differently with git branch commands on an empty repo
  • Ubuntu images were not defaulting to bash shell so the attempt to figure out whether to use yum, etc. failed
  • Old versions of libgit2 were being used on some targets which triggered an assertion
  • Amazon Linux 2 & CentOS 7 need to build libgit2 from source like CentOS 6 as there is no available dependency

Summary by cubic

Fixes git_config plugin test failures across distros by standardizing the test shell, supporting older git, aligning libgit2/libssh2/openssl versions, improving the test runner, and handling systemd-analyze/CI edge cases. Resolves #341; AlmaLinux 8 libgit2 crash remains under investigation.

  • Bug Fixes

    • Use /bin/bash -c in the test image so package manager detection works on Ubuntu.
    • Rename branch after the initial commit with git branch -M main to support older git on CentOS 6.
    • Improve test runner: add BUILD_PACKAGE, CLEAN_DOWNLOAD, use $REPO_ROOT, set Docker build context reliably, and guard against root deletion.
    • Handle systemd-analyze environments without a manager and detect the correct fluent-bit.service path; CI now auto-includes ubuntu/24.04 when explicit linux=... targets are requested to satisfy integration tests.
  • Dependencies

    • Revert CMake libgit2 minimum-version check to avoid false failures on older distros.
    • Use libgit2_1.7-devel on CentOS 8, AlmaLinux 8, and Rocky Linux 8 (enable epel-release).
    • For CentOS 7, build openssl 3.5.2, libssh2 1.11.1, and libgit2 1.9.1 from source as static libs and link via CMake (explicit static libssh2 linkage).
    • Add amazonlinux/2 builder that compiles openssl 3.5.2, libssh2 1.11.1, and libgit2 1.9.1 statically; wire CMake flags to link these.

Written for commit 1dd2414. Summary will update on new commits.

Review in cubic

Signed-off-by: Patrick Stephens <pat@telemetryforge.io>
Signed-off-by: Patrick Stephens <pat@telemetryforge.io>
Signed-off-by: Patrick Stephens <pat@telemetryforge.io>
@patrick-stephens patrick-stephens requested a review from a team as a code owner July 10, 2026 11:57
@patrick-stephens patrick-stephens added the build-linux Option to enable building of Linux packages only for a PR to test label Jul 10, 2026
@github-actions

Copy link
Copy Markdown

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

@patrick-stephens

Copy link
Copy Markdown
Contributor Author

/build linux=centos/6,almalinux/8,ubuntu/22.04

@patrick-stephens patrick-stephens removed the build-linux Option to enable building of Linux packages only for a PR to test label Jul 10, 2026
Signed-off-by: Patrick Stephens <pat@telemetryforge.io>
@github-actions

Copy link
Copy Markdown

Build results for /build on PR #347:

  • Linux: ✅ (success) — Targets: centos/6, almalinux/8, ubuntu/22.04Job logs
  • Tests: ❌ (failure) — Job logs

Signed-off-by: Patrick Stephens <pat@telemetryforge.io>
Signed-off-by: Patrick Stephens <pat@telemetryforge.io>
Signed-off-by: Patrick Stephens <pat@telemetryforge.io>
@patrick-stephens

Copy link
Copy Markdown
Contributor Author

/build linux=centos/6,almalinux/8,ubuntu/22.04,amazonlinux/2,centos/7,centos/8,rockylinux/8

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses cross-distro test/build failures for the git_config plugin by standardizing the test shell behavior, making the functional tests compatible with older git, enforcing a minimum libgit2 version at configure time, and adding a dedicated Amazon Linux 2 build path that compiles required dependencies from source.

Changes:

  • Standardize test container shell execution (bash) and fix git branch renaming for older git behavior.
  • Enforce libgit2 >= 0.27.0 via pkg-config and a compile-time header check to fail fast on unsupported versions.
  • Update RPM-based distro build images to use newer libgit2 dev packages and add an Amazon Linux 2 builder that builds OpenSSL/libssh2/libgit2 from source.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
testing/Dockerfile.bats Forces bash as the default shell to make package-manager detection logic reliable on Ubuntu/dash.
testing/bats/tests/functional/plugins/git_config/verify-git-config-plugin.bats Renames the default branch after the initial commit to support older git on empty repos.
testing/bats/run-package-functional-tests.sh Adds an option to wipe the local download directory before functional test runs.
source/packaging/distros/rockylinux/Dockerfile Switches to libgit2_1.7-devel to avoid older libgit2 crashes.
source/packaging/distros/centos/Dockerfile Enables EPEL and switches to libgit2_1.7-devel on CentOS 8-based targets.
source/packaging/distros/centos/7/Dockerfile Adjusts install ordering and switches to libgit2_1.7-devel on CentOS 7.
source/packaging/distros/amazonlinux/Dockerfile Updates top-level documentation/comments now that Amazon Linux 2 is handled separately.
source/packaging/distros/amazonlinux/2/Dockerfile Adds a dedicated Amazon Linux 2 builder that compiles OpenSSL/libssh2/libgit2 from source and wires static-link flags.
source/packaging/distros/almalinux/Dockerfile Enables EPEL and switches to libgit2_1.7-devel on AlmaLinux 8.
source/cmake/libgit2.cmake Enforces a minimum libgit2 version (>= 0.27.0) and errors out early if unmet.
.github/workflows/call-get-metadata.yaml Minor formatting cleanup to satisfy workflow/YAML linters.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread testing/bats/run-package-functional-tests.sh
Comment thread source/packaging/distros/amazonlinux/2/Dockerfile
Comment thread source/packaging/distros/amazonlinux/2/Dockerfile
Comment thread source/packaging/distros/amazonlinux/2/Dockerfile
Signed-off-by: Patrick Stephens <pat@telemetryforge.io>
Signed-off-by: Patrick Stephens <pat@telemetryforge.io>
@patrick-stephens

Copy link
Copy Markdown
Contributor Author

/build linux=centos/6,almalinux/8,ubuntu/22.04,amazonlinux/2,centos/7,centos/8,rockylinux/8

@github-actions

Copy link
Copy Markdown

Build results for /build on PR #347:

  • Linux: 🛑 (cancelled) — Targets: centos/6, almalinux/8, ubuntu/22.04, amazonlinux/2, centos/7, centos/8, rockylinux/8Job logs
  • Tests: ⏭️ (skipped) — Job logs

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 7 files (changes from recent commits).

Tip: Review your code locally with the cubic CLI to iterate faster.

Fix all with cubic | Re-trigger cubic

Comment thread source/packaging/distros/amazonlinux/2/Dockerfile
Comment thread source/packaging/distros/amazonlinux/2/Dockerfile
@github-actions

Copy link
Copy Markdown

Build results for /build on PR #347:

  • Linux: 🛑 (cancelled) — Targets: centos/6, almalinux/8, ubuntu/22.04, amazonlinux/2, centos/7, centos/8, rockylinux/8Job logs
  • Tests: ⏭️ (skipped) — Job logs

@patrick-stephens

Copy link
Copy Markdown
Contributor Author

/build linux=centos/6,almalinux/8,ubuntu/22.04,amazonlinux/2,centos/7,centos/8,rockylinux/8

@github-actions

Copy link
Copy Markdown

Build results for /build on PR #347:

  • Linux: 🛑 (cancelled) — Targets: centos/6, almalinux/8, ubuntu/22.04, amazonlinux/2, centos/7, centos/8, rockylinux/8Job logs
  • Tests: ⏭️ (skipped) — Job logs

@github-actions

Copy link
Copy Markdown

Build results for /build on PR #347:

  • Linux: ❌ (failure) — Targets: centos/6, almalinux/8, ubuntu/22.04, amazonlinux/2, centos/7, centos/8, rockylinux/8Job logs
  • Tests: ⏭️ (skipped) — Job logs

@github-actions

Copy link
Copy Markdown

Build results for /build on PR #347:

  • Linux: ❌ (failure) — Targets: centos/6, almalinux/8, ubuntu/22.04, amazonlinux/2, centos/7, centos/8, rockylinux/8Job logs
  • Tests: ⏭️ (skipped) — Job logs

@coveralls

coveralls commented Jul 10, 2026

Copy link
Copy Markdown

Coverage Report for CI Build 29104661980

Coverage decreased (-0.001%) to 57.874%

Details

  • Coverage decreased (-0.001%) from the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • 3 coverage regressions across 2 files.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

3 previously-covered lines in 2 files lost coverage.

File Lines Losing Coverage Coverage
src/flb_scheduler.c 2 65.75%
src/flb_http_client.c 1 44.01%

Coverage Stats

Coverage Status
Relevant Lines: 161483
Covered Lines: 94564
Line Coverage: 58.56%
Relevant Branches: 35615
Covered Branches: 19505
Branch Coverage: 54.77%
Branches in Coverage %: Yes
Coverage Strength: 5765.71 hits per line

💛 - Coveralls

Signed-off-by: Patrick Stephens <pat@telemetryforge.io>
@patrick-stephens

Copy link
Copy Markdown
Contributor Author

/build linux=centos/6,almalinux/8,ubuntu/22.04,amazonlinux/2,centos/7,centos/8,rockylinux/8

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 1 file (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="source/packaging/distros/centos/7/Dockerfile">

<violation number="1" location="source/packaging/distros/centos/7/Dockerfile:112">
P1: The source-built shared libgit2 may cause RPM installation or runtime failures on target CentOS 7 hosts. Because `CPACK_RPM_PACKAGE_AUTOREQPROV` is enabled, `cpack` will automatically detect the `libgit2.so` SONAME and add it as an RPM `Requires`, but CentOS 7 repositories do not provide this source-built version. The shared library is also not explicitly bundled into the RPM, so the installed binary may fail to load it at runtime. Consider building libgit2 statically by setting `-DBUILD_SHARED_LIBS=OFF` and ensuring the Fluent Bit build links against the static archive instead.</violation>
</file>

Tip: Review your code locally with the cubic CLI to iterate faster.

Fix all with cubic | Re-trigger cubic

Comment thread source/packaging/distros/centos/7/Dockerfile Outdated
Signed-off-by: Patrick Stephens <pat@telemetryforge.io>
@github-actions

Copy link
Copy Markdown

Build results for /build on PR #347:

  • Linux: ✅ (success) — Targets: centos/6, almalinux/8, ubuntu/22.04, amazonlinux/2, centos/7, centos/8, rockylinux/8Job logs
  • Tests: ❌ (failure) — Job logs

Signed-off-by: Patrick Stephens <pat@telemetryforge.io>
Signed-off-by: Patrick Stephens <pat@telemetryforge.io>
Signed-off-by: Patrick Stephens <pat@telemetryforge.io>
Signed-off-by: Patrick Stephens <pat@telemetryforge.io>
Signed-off-by: Patrick Stephens <pat@telemetryforge.io>
Signed-off-by: Patrick Stephens <pat@telemetryforge.io>

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 issues found across 15 files

Confidence score: 3/5

  • source/packaging/distros/centos/7/Dockerfile can still fail CentOS 7 package builds at final link time because CMake appears to keep using non-static LIBGIT2_LIBRARIES while only libssh2.a is added, so merging as-is risks broken package artifacts for that distro — switch the libgit2 CMake linkage to the static library path before merging.
  • testing/bats/run-package-functional-tests.sh may invoke Docker for BUILD_PACKAGE=1 even when CONTAINER_RUNTIME is set to Podman, which can cause local functional package tests to run in the wrong runtime and hide environment-specific failures — pass the selected runtime through FLB_DOCKER_CLI so test/build behavior stays aligned.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="testing/bats/run-package-functional-tests.sh">

<violation number="1" location="testing/bats/run-package-functional-tests.sh:72">
P2: `BUILD_PACKAGE=1` runs the package build with Docker even when this test runner is configured for Podman via `CONTAINER_RUNTIME`. Passing the selected runtime through `FLB_DOCKER_CLI` keeps local package builds aligned with the container runtime used for the test image.</violation>
</file>

<file name="source/packaging/distros/centos/7/Dockerfile">

<violation number="1" location="source/packaging/distros/centos/7/Dockerfile:126">
P1: CentOS 7 package builds can fail at final link once only `libgit2.a` is available, because CMake still uses non-static `LIBGIT2_LIBRARIES` and this Dockerfile only adds `libssh2.a`. Consider switching the libgit2 CMake lookup to static pkg-config/link flags for this build or explicitly passing all private deps required by the static libgit2 archive.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic

tar xf v${LIBGIT2_VER}.tar.gz
WORKDIR /tmp/libgit2-${LIBGIT2_VER}
RUN cmake -B build -DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=OFF \

@cubic-dev-ai cubic-dev-ai Bot Jul 10, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1: CentOS 7 package builds can fail at final link once only libgit2.a is available, because CMake still uses non-static LIBGIT2_LIBRARIES and this Dockerfile only adds libssh2.a. Consider switching the libgit2 CMake lookup to static pkg-config/link flags for this build or explicitly passing all private deps required by the static libgit2 archive.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At source/packaging/distros/centos/7/Dockerfile, line 126:

<comment>CentOS 7 package builds can fail at final link once only `libgit2.a` is available, because CMake still uses non-static `LIBGIT2_LIBRARIES` and this Dockerfile only adds `libssh2.a`. Consider switching the libgit2 CMake lookup to static pkg-config/link flags for this build or explicitly passing all private deps required by the static libgit2 archive.</comment>

<file context>
@@ -102,6 +102,37 @@ RUN tar -xzvf /openssl/openssl-3.5.2.tar.gz -C /openssl
+    tar xf v${LIBGIT2_VER}.tar.gz
+WORKDIR /tmp/libgit2-${LIBGIT2_VER}
+RUN cmake -B build -DCMAKE_BUILD_TYPE=Release \
+        -DBUILD_SHARED_LIBS=OFF \
+        -DLINK_WITH_STATIC_LIBRARIES=ON \
+        -DUSE_SSH=ON \
</file context>
Fix with cubic

if [[ -n "${BUILD_PACKAGE:-}" ]]; then
echo "INFO: Building package for $DISTRO as BUILD_PACKAGE is set"
# If BUILD_PACKAGE is set, build the package first
"$REPO_ROOT/build-package.sh" -d "$DISTRO"

@cubic-dev-ai cubic-dev-ai Bot Jul 10, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: BUILD_PACKAGE=1 runs the package build with Docker even when this test runner is configured for Podman via CONTAINER_RUNTIME. Passing the selected runtime through FLB_DOCKER_CLI keeps local package builds aligned with the container runtime used for the test image.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At testing/bats/run-package-functional-tests.sh, line 72:

<comment>`BUILD_PACKAGE=1` runs the package build with Docker even when this test runner is configured for Podman via `CONTAINER_RUNTIME`. Passing the selected runtime through `FLB_DOCKER_CLI` keeps local package builds aligned with the container runtime used for the test image.</comment>

<file context>
@@ -61,8 +64,21 @@ if [[ $FOUND_FILES == false ]]; then
+		if [[ -n "${BUILD_PACKAGE:-}" ]]; then
+			echo "INFO: Building package for $DISTRO as BUILD_PACKAGE is set"
+			# If BUILD_PACKAGE is set, build the package first
+			"$REPO_ROOT/build-package.sh" -d "$DISTRO"
+			echo "INFO: Package built for $DISTRO, copying to $DOWNLOAD_DIR for test container to find it"
+			# Need to copy the package to the download directory for the test container to find it
</file context>
Suggested change
"$REPO_ROOT/build-package.sh" -d "$DISTRO"
FLB_DOCKER_CLI="$CONTAINER_RUNTIME" "$REPO_ROOT/build-package.sh" -d "$DISTRO"
Fix with cubic

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.

git_config: resolve test failures

3 participants