feat: add additional preset environment variables#328
Merged
Conversation
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>
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
Signed-off-by: Patrick Stephens <pat@telemetryforge.io>
There was a problem hiding this comment.
Pull request overview
This PR adds additional “preset” environment variables to the agent’s internal environment (flb_env) so configs can reliably reference OS and build/package metadata, while still honoring any values already provided by the process environment.
Changes:
- Add preset env vars:
OS_TYPE,TELEMETRY_FORGE_AGENT_DISTRO,TELEMETRY_FORGE_AGENT_PACKAGE_TYPE,TELEMETRY_FORGE_AGENT_VERSION(defaults only applied when not already set). - Add internal tests covering preset defaults and override behavior.
- Move build-metadata CMake defines into
source/cmake/enterprise.cmakeand update macOS package workflow to pass distro/package type.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
source/src/flb_env.c |
Adds new preset env vars for OS + Telemetry Forge agent build metadata. |
source/tests/internal/env.c |
Adds internal tests for preset defaults and override behavior. |
source/CMakeLists.txt |
Removes build-metadata defines from the top-level CMake file (moved elsewhere). |
source/cmake/enterprise.cmake |
Adds validation/definition of build metadata values for builds using enterprise cmake include. |
.github/workflows/call-build-macos-packages.yaml |
Passes distro/package type into macOS package builds. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Coverage Report for CI Build 28161193752Warning Build has drifted: This PR's base is out of sync with its target branch, so coverage data may include unrelated changes. Coverage increased (+0.01%) to 57.875%Details
Uncovered ChangesNo uncovered changes found. Coverage Regressions293 previously-covered lines in 5 files lost coverage.
Coverage Stats💛 - Coveralls |
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>
Signed-off-by: Patrick Stephens <pat@telemetryforge.io>
Signed-off-by: Patrick Stephens <pat@telemetryforge.io>
Signed-off-by: Patrick Stephens <pat@telemetryforge.io>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #224 by adding preset environment variables based on the host or build metadata
linux,windowsormacoscentos/7>CONTAINERorPACKAGEIn each case it will always check for an overridden variable in the environment first and then only set a default if not defined already.
Tests were added as well for the environment variables including the existing
HOSTNAMEone.The macOS CI was not setting some variables either.
Summary by cubic
Adds preset env vars for OS and agent metadata, shows them in --help, and makes distro/package type mandatory for enterprise builds. CI and packaging pass the required flags; unit and integration tests verify defaults and overrides, addressing #224.
New Features
OS_TYPEto linux, windows, or macos.AGENT_DISTRO,AGENT_PACKAGE_TYPE,AGENT_VERSION; derived from build metadata, respect overrides, fall back to "unknown".TELEMETRY_FORGE_AGENT_DISTROandTELEMETRY_FORGE_AGENT_PACKAGE_TYPEfor enterprise builds;TELEMETRY_FORGE_AGENT_VERSIONdefaults toFLB_VERSION_STR.--help.CI and Tests
source/cmake/enterprise.cmake.-DTELEMETRY_FORGE_*from packaging Dockerfiles,Dockerfile.ubi, macOS and unit-test workflows.build-and-test-container.shto build a test image and run container integration tests.Written for commit b218e0f. Summary will update on new commits.