Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

config: fix compilation with FLB_HAVE_STATIC_CONF #8912

Closed
wants to merge 2 commits into from

Conversation

bglimepoint
Copy link
Contributor

@bglimepoint bglimepoint commented Jun 5, 2024

The FLB_STATIC_CONF build config is broken in 3.0.6 (and has been for a while).

  1. FLB_CF_BUF_SIZE was removed in f50a02e. My understanding is that it was renamed to FLB_DEFAULT_CF_BUF_SIZE, so make that code reference it instead.

  2. A typo didn't update the s variable to state in eabc1a1.

  3. Attempting to add a test for this config option - not sure if this is how this should be implemented, but thought it might be of interest :-)


Enter [N/A] in the box, if an item is not applicable to your change.

Testing
Before we can approve your change; please submit the following in a comment:

  • [N/A] Example configuration file for the change
  • [N/A] Debug log output from testing the change
  • [N/A] Attached Valgrind output that shows no leaks or memory corruption was found

If this is a change to packaging of containers or native binaries then please confirm it works for all targets.

  • [N/A] Run local packaging test showing all targets (including any new ones) build.
  • [N/A] Set ok-package-test label to test for all targets (requires maintainer to do).

Documentation

  • [N/A] Documentation required for this feature

Backporting

  • [N/A] Backport to latest stable release.

Fluent Bit is licensed under Apache 2.0, by submitting this pull request I understand that this code will be released under the terms of that license.

@bglimepoint bglimepoint marked this pull request as draft June 5, 2024 03:51
@bglimepoint bglimepoint marked this pull request as ready for review June 5, 2024 03:54
@bglimepoint bglimepoint force-pushed the fix-static-conf branch 2 times, most recently from 579efd1 to f0330f3 Compare June 5, 2024 03:55
@bglimepoint bglimepoint marked this pull request as draft June 5, 2024 04:39
@bglimepoint bglimepoint marked this pull request as ready for review June 5, 2024 05:01
Copy link
Contributor

@patrick-stephens patrick-stephens left a comment

Choose a reason for hiding this comment

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

Do we need to push any updates to the package builds?
I notice the CentOS 7 one PR check was updated but not the actual package build.

@@ -16,13 +16,15 @@ RUN yum -y update && \
COPY . /src/
WORKDIR /src/build

ARG EXTRA_BUILD_ARGS
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this need rolling to all the package builds as well?
I would probably make a named variable for it rather than a generic one, e.g. FLB_STATIC_CONF, to make it more obvious to control.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Does this need rolling to all the package builds as well?

I'd say not - this is a build flag that requires a local build from source/Git. It can't be enabled in a packaged build (assuming I'm understanding packaged build correctly). The config option makes fluentbit embed the configuration files into the binary rather than looking for them from disk - so it's not something that can be distributed.

The goal here was to have a test that ensure it still works (it's broken a few times in the past) - and the Centos7 build just seemed (arbitrarily) like an easy place to put it. Open to putting it somewhere else instead though :-) We've run into a few small compile bugs when -DFLB_STATIC_CONF has been enabled, so this would prevent those compile bugs into the future :-)

I would probably make a named variable for it rather than a generic one, e.g. FLB_STATIC_CONF, to make it more obvious to control.

Great call :-) Thanks for the suggestion :-)

Copy link
Contributor

Choose a reason for hiding this comment

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

We can always add another container build to verify static builds directly and do this in parallel then as well.
This one was added to primarily verify the legacy target compilation worked so hijacking it for something else does not seem right or obvious.
I would add a new CI job just for this I think for one of the faster targets, you can just invoke the packaging build with FLB_ARGS set for it too I think to pass them in:

FLB_ARG=${FLB_ARG:-}

We could also make a static compilation test for all of the packaging builds via a matrix too in the future.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the suggestion!

I've probably not quite done what you're suggesting yet (I haven't quite grokked call-build-linux-packages.yaml yet) but did reuse build.sh :-) For now I've left it in pr-compile-check.yaml (although it does lightly feel like a rationally named workflow file? 🤔 )

.github/workflows/pr-compile-check.yaml Outdated Show resolved Hide resolved
run: ./build.sh
env:
FLB_DISTRO: ubuntu/20.04
FLB_ARG: --build-arg=FLB_STATIC_CONF=yes
Copy link
Contributor

Choose a reason for hiding this comment

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

This will only work unfortunately if FLB_STATIC_CONF is defined in the packaging dockerfiles as an argument though so we need to add it there too. Personally I'd just extended ./packaging/build.sh to support FLB_STATIC_CONF directly and add it to the dockerfiles too, that way everyone can use it directly as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've started looking into this, thanks Pat :-)

One curiousity is that FLB_STATIC_CONF needs the folder of config to point at, which isn't super practical via the packaging Dockerfiles to my mind. Perhaps something like mounting that config in (e.g. using secrets) could be a thing? 🤔

Copy link
Contributor

This PR is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 10 days.

@github-actions github-actions bot added the Stale label Dec 14, 2024
This it to verify compilation.

It's not trivial to use this flag otherwise because a user needs to put their config in the Docker images 🤔

Signed-off-by: Bryce Gibson <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants