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

fix(pkg/driverbuilder): multiple small fixes to local builder. #342

Merged
merged 2 commits into from
May 7, 2024

Conversation

FedeDP
Copy link
Contributor

@FedeDP FedeDP commented May 7, 2024

What type of PR is this?

/kind bug
/kind cleanup

Any specific area of the project related to this PR?

/area pkg

What this PR does / why we need it:

This PR contains small fixes on top of local builder.
Also, support bumping dkms log file if dkms build fails.

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

NOTE: this PR bumps falcoctl to latest main, to take advantage of falcosecurity/falcoctl#550.
That is needed to avoid importing pkg/options package in driverkit that would lead to an import cycle when later driverkit gets imported in falcoctl.

Does this PR introduce a user-facing change?:

NONE

@FedeDP
Copy link
Contributor Author

FedeDP commented May 7, 2024

NOTE: this is wip because i need to fix a small thing on falcoctl before proceeding.

@@ -44,6 +44,7 @@ func NewLocalCmd(configOpts *ConfigOptions, rootOpts *RootOptions, rootFlags *pf
}
return driverbuilder.NewLocalBuildProcessor(opts.useDKMS,
opts.downloadHeaders,
false,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Always print command output from within driverkit.
Falcoctl will, instead, only print on error to avoid being too noisy.

@@ -20,7 +20,7 @@
# looking for it in a bunch of ways. Convenient when running Falco inside
# a container or in other weird environments.
#
set -xeo pipefail
set -xeuo pipefail
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same as other tempaltes.

@@ -166,6 +169,12 @@ func (lbp *LocalBuildProcessor) Start(b *builder.Build) error {

for _, gcc := range gccs {
vv.GccPath = gcc
if c.ModuleFilePath != "" {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added some debug info.

}
err = cmd.Wait()
}
out, err := cmd.CombinedOutput()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

No need to pipe and scan stdout/stderr: we are always behind a stylish spinner now, therefore we will never print these lines in real time.

}

// If we built the probe, disable its build for subsequent attempts (with other available gccs)
if c.ProbeFilePath != "" {
if _, err = os.Stat(srcProbePath); !os.IsNotExist(err) {
if err = copyDataToLocalPath(srcProbePath, b.ProbeFilePath); err != nil {
if err = copyDataToLocalPath(srcProbePath, c.ProbeFilePath); err != nil {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Use c. instead of b. for coherence everywhere.

@FedeDP FedeDP changed the title wip: fix(pkg/driverbuilder): multiple small fixes to local builder. fix(pkg/driverbuilder): multiple small fixes to local builder. May 7, 2024
@poiana poiana added size/XL and removed size/L labels May 7, 2024
FedeDP added a commit to falcosecurity/falcoctl that referenced this pull request May 7, 2024
This fixes the build.

Signed-off-by: Federico Di Pierro <[email protected]>
Copy link
Contributor

@EXONER4TED EXONER4TED left a comment

Choose a reason for hiding this comment

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

looks good to me 🙂

@poiana
Copy link

poiana commented May 7, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: EXONER4TED, FedeDP

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@poiana poiana merged commit 5be1caf into master May 7, 2024
7 of 8 checks passed
@poiana poiana deleted the fix/local_builder branch May 7, 2024 18:50
poiana pushed a commit to falcosecurity/falcoctl that referenced this pull request May 8, 2024
This fixes the build.

Signed-off-by: Federico Di Pierro <[email protected]>
FedeDP added a commit that referenced this pull request May 10, 2024
Fix on top of #342.

Signed-off-by: Federico Di Pierro <[email protected]>
poiana pushed a commit that referenced this pull request May 10, 2024
Fix on top of #342.

Signed-off-by: Federico Di Pierro <[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.

3 participants