Skip to content

Restore the beats submodule dir after building osqueryd#12767

Open
swiatekm wants to merge 1 commit intomainfrom
mage/restore-submodule-after-osqueryd
Open

Restore the beats submodule dir after building osqueryd#12767
swiatekm wants to merge 1 commit intomainfrom
mage/restore-submodule-after-osqueryd

Conversation

@swiatekm
Copy link
Contributor

@swiatekm swiatekm commented Feb 13, 2026

What does this PR do?

After building osquerybeat, it restores the previous state of the beats submodule directory by calling git submodule update --no-fetch.

Why is it important?

In the beats submodule directory, .git is a reference to the parent's .git/modules/beats. When we try to call into the beats mage target to build osquerybeat, only the beats directory gets mounted into the crossbuild container. As a result, the reference is invalid and the build fails.

To work around this problem, we copy the contents of .git/modules/beats into beats/.git before building. However, when building locally, this later causes issues when switching branches, with git complaining about not being able to migrate from beats/.git to .git/modules/beats.

How to test this PR locally

Run mage otel:osquerybeatCrossBuildExt and check beats/.git.

In the beats submodule directory, .git is a symlink to the parent's
.git/modules. When we try to call into the beats mage target to build
osquerybeat, only the beats directory gets mounted into the crossbuild
container. As a result, the symlink is invalid and the build fails.

To work around this problem, we copy the contents of .git/modules/beats
into beats/.git before building. However, when building locally, this
later causes issues when switching branches, with git complaining about
not being able to migrate from beats/.git to .git/modules/beats.

Fix this by restoring the previous state after building osquerybeat by
calling `git submodule update --no-fetch`.
@swiatekm swiatekm requested a review from a team as a code owner February 13, 2026 16:24
@swiatekm swiatekm added Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team skip-changelog labels Feb 13, 2026
@swiatekm swiatekm added chore Tasks that just need to be done, they are neither bug, nor enhancements backport-active-all Automated backport with mergify to all the active branches labels Feb 13, 2026
@elasticmachine
Copy link
Contributor

Pinging @elastic/elastic-agent-control-plane (Team:Elastic-Agent-Control-Plane)

@elasticmachine
Copy link
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

cc @swiatekm

@swiatekm swiatekm added backport-9.3 Automated backport to the 9.3 branch and removed backport-active-all Automated backport with mergify to all the active branches labels Feb 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-9.3 Automated backport to the 9.3 branch chore Tasks that just need to be done, they are neither bug, nor enhancements skip-changelog Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants