Skip to content
This repository was archived by the owner on Sep 1, 2026. It is now read-only.

renaming arguments - #82

Merged
supakeen merged 6 commits into
osbuild:mainfrom
supakeen:renaming-arguments
Jan 20, 2025
Merged

renaming arguments#82
supakeen merged 6 commits into
osbuild:mainfrom
supakeen:renaming-arguments

Conversation

@supakeen

Copy link
Copy Markdown
Member

This PR, after some discussion with @achilleas-k, @schuellerf, and @mvo5 to rename some arguments.

This PR:

  1. Renames --store to --cache (#77).
  2. Renames the --extra-artifacts

Closes #77.

Signed-off-by: Simon de Vlieger <supakeen@redhat.com>
Split out `--extra-artifacts` into `--with-sbom` and `--with-manifest`.

Signed-off-by: Simon de Vlieger <supakeen@redhat.com>
mvo5
mvo5 previously approved these changes Jan 20, 2025

@mvo5 mvo5 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thank you, lets merge it to unblock fedora

@mvo5
mvo5 added this pull request to the merge queue Jan 20, 2025
@mvo5
mvo5 removed this pull request from the merge queue due to a manual request Jan 20, 2025
@mvo5

mvo5 commented Jan 20, 2025

Copy link
Copy Markdown
Contributor

Meh, sorry, actually - we need to update the README too I think

schuellerf
schuellerf previously approved these changes Jan 20, 2025

@schuellerf schuellerf left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM, despite my comment

Comment thread cmd/image-builder/main_test.go
Comment thread cmd/image-builder/main.go Outdated

var extraArtifacts []string

if withSBOM {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If there is a new push required, lets add:

diff --git a/cmd/image-builder/main.go b/cmd/image-builder/main.go
index 43af781..14bb9fc 100644
--- a/cmd/image-builder/main.go
+++ b/cmd/image-builder/main.go
@@ -133,18 +133,12 @@ func cmdManifestWrapper(cmd *cobra.Command, args []string, w io.Writer, archChec
                }
        }
 
-       var extraArtifacts []string
-
-       if withSBOM {
-               extraArtifacts = append(extraArtifacts, "sbom")
-       }
-
        opts := &manifestOptions{
-               OutputDir:      outputDir,
-               BlueprintPath:  blueprintPath,
-               Ostree:         ostreeImgOpts,
-               RpmDownloader:  rpmDownloader,
-               ExtraArtifacts: extraArtifacts,
+               OutputDir:     outputDir,
+               BlueprintPath: blueprintPath,
+               Ostree:        ostreeImgOpts,
+               RpmDownloader: rpmDownloader,
+               WithSBOM:      withSBOM,
        }
        err = generateManifest(dataDir, img, w, opts)
        return img, err
diff --git a/cmd/image-builder/manifest.go b/cmd/image-builder/manifest.go
index eb8fc83..2604c6f 100644
--- a/cmd/image-builder/manifest.go
+++ b/cmd/image-builder/manifest.go
@@ -4,7 +4,6 @@ import (
        "io"
        "os"
        "path/filepath"
-       "slices"
 
        "github.com/osbuild/images/pkg/distro"
        "github.com/osbuild/images/pkg/imagefilter"
@@ -16,11 +15,12 @@ import (
 )
 
 type manifestOptions struct {
-       OutputDir      string
-       BlueprintPath  string
-       Ostree         *ostree.ImageOptions
-       RpmDownloader  osbuild.RpmDownloader
-       ExtraArtifacts []string
+       OutputDir     string
+       BlueprintPath string
+       Ostree        *ostree.ImageOptions
+       RpmDownloader osbuild.RpmDownloader
+
+       WithSBOM bool
 }
 
 func sbomWriter(outputDir, filename string, content io.Reader) error {
@@ -46,7 +46,7 @@ func generateManifest(dataDir string, img *imagefilter.Result, output io.Writer,
                Output:        output,
                RpmDownloader: opts.RpmDownloader,
        }
-       if slices.Contains(opts.ExtraArtifacts, "sbom") {
+       if opts.WithSBOM {
                outputDir := opts.OutputDir
                if outputDir == "" {
                        outputDir = outputNameFor(img)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

But I can do it in a followup if time is of the essence

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I'll add a commit for this.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Done.

Signed-off-by: Simon de Vlieger <supakeen@redhat.com>
@supakeen
supakeen dismissed stale reviews from schuellerf and mvo5 via 686199a January 20, 2025 15:10
supakeen and others added 2 commits January 20, 2025 16:12
Remove all slice operations.

Co-authored-by: Michael Vogt <michael.vogt@gmail.com>
Signed-off-by: Simon de Vlieger <supakeen@redhat.com>
Signed-off-by: Simon de Vlieger <supakeen@redhat.com>
Comment thread README.md
[osbuild](https://github.com/osbuild/osbuild) manifest will be
placed in the output directory too.

With the `--with-sbom` option an SPDX SBOM document will be

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

There is a ### SBOMs section in the README a little bit below that would also need this update

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Ah yea, I had just spotted that one as well; I've adjusted the last commit to also change it there.

Signed-off-by: Simon de Vlieger <supakeen@redhat.com>
@supakeen
supakeen added this pull request to the merge queue Jan 20, 2025
Merged via the queue into osbuild:main with commit c136684 Jan 20, 2025
@supakeen
supakeen deleted the renaming-arguments branch January 20, 2025 15:42
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants