Skip to content

Conversation

@ChristofferNissen
Copy link
Owner

@ChristofferNissen ChristofferNissen commented Mar 30, 2025

Change from using native go libraries to CLIs managed outside Helmper to reduce dependencies.

Add scanning to build pipeline

@ChristofferNissen ChristofferNissen changed the title Feat/use clis instead of libs [choreuse clis instead of libs Mar 30, 2025
@ChristofferNissen ChristofferNissen changed the title [choreuse clis instead of libs [chore] use clis instead of libs Mar 30, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR transitions the project from using native Go libraries for scanning and patching to relying on external CLIs, thereby reducing dependencies and streamlining the build process. Key changes include:

  • Replacing internal Trivy library usage in pkg/trivy/main.go with CLI invocation via os/exec.
  • Removing pkg/copa/patch.go and refactoring patch functionality in pkg/copa/main.go to utilize external commands.
  • Updating workflow steps to install and execute Trivy, and making minor improvements in condition checks and comment clarity.

Reviewed Changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated no comments.

Show a summary per file
File Description
pkg/trivy/main.go Refactored scan function to use Trivy CLI and removed unused library imports.
pkg/flow/spsOption.go Improved condition check for image count.
pkg/copa/util.go Added SupportedOS helper with clear logic.
pkg/copa/patch.go Removed outdated patch implementation.
pkg/copa/main.go Updated patch execution to call external CLI and adjusted error messages.
internal/program.go Reordered variable initialization for clarity.
internal/bootstrap/viper.go Corrected a spelling mistake in a comment.
internal/bootstrap/helm.go Minor import reorder.
.github/workflows/build.yml Added steps to install Trivy and run file system scan.
Comments suppressed due to low confidence (2)

pkg/trivy/main.go:43

  • [nitpick] Consider appending the command output (e.g. string(output)) to the error log to aid in diagnosing failures during Trivy CLI execution.
slog.Error("Trivy CLI execution failed", slog.Any("error", err))

pkg/copa/main.go:101

  • [nitpick] For consistency, consider using the same image identifier (such as 'ref') in error messages instead of mixing identifiers (i.Tag) which might confuse troubleshooting.
return fmt.Errorf("error saving image %s to tar :: %w :: %s", i.Tag, err, string(output))

@ChristofferNissen ChristofferNissen marked this pull request as ready for review April 7, 2025 12:16
@ChristofferNissen ChristofferNissen merged commit fc10c1d into main Jul 19, 2025
6 checks passed
@ChristofferNissen ChristofferNissen deleted the feat/use-clis-instead-of-libs branch July 19, 2025 22:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants