falcosecurity / falcoctl

Administrative tooling for Falco
Apache License 2.0
82 stars 57 forks source link

feat: Add --platform option to artifact/install #554

Closed kpaulisse closed 1 month ago

kpaulisse commented 1 month ago

What type of PR is this?

/kind failing-test

/kind feature

Any specific area of the project related to this PR?

/area cli

What this PR does / why we need it:

This PR adds a --platform CLI option to the artifact install command.

For example: falcoctl artifact install --platform linux/amd64 ...

There are various other commands that accept a --platform argument so I implemented this in the same way.

Reason: We are deploying Falco into environments that may be air gapped so we want to produce a single OCI image with the appropriate rule sets and plugins. We want to use falcoctl to download the artifacts. However, this always downloads the artifacts for the architecture that the CI system (or developer laptop) is running, and this often produces errors, e.g. "unable to find a manifest matching the given platform: darwin/arm64". With this new option it's possible to specify --platform=linux/amd64 and have this work even on an ARM build host or a local mac environment.

Additionally, when I was building this, I noticed that the tests for artifact install were failing on my local Mac machine, so I added this new --platform CLI flag to the tests that were failing so it would align with the linux/amd64 that is hard-coded elsewhere in the test. I marked this as solving a failing test for that reason.

Which issue(s) this PR fixes:

N/A

Special notes for your reviewer:

N/A

poiana commented 1 month ago

Welcome @kpaulisse! It looks like this is your first PR to falcosecurity/falcoctl 🎉

poiana commented 1 month ago

LGTM label has been added.

Git tree hash: 52b3f632c77caf57e59406ed10c584a577e036e2

poiana commented 1 month ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: alacuku, kpaulisse

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: - ~~[OWNERS](https://github.com/falcosecurity/falcoctl/blob/main/OWNERS)~~ [alacuku] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment