Skip to content

Commit

Permalink
imagefilter: make short output format as unstable
Browse files Browse the repository at this point in the history
This commit changes the "short" output format so that it is
marked as "unstable". There are some open questions about this
format and how it relates to e.g.
osbuild/osbuild-composer#4336
which adds very similar API is a slightly different format.

So to prevent users from relying on the API before that is resolved
we need to at least make them aware that this may still change.
  • Loading branch information
mvo5 committed Jan 28, 2025
1 parent aa79e76 commit ae045a9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 6 additions & 0 deletions pkg/imagefilter/formatter.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,12 @@ type textShortResultsFormatter struct{}
func (*textShortResultsFormatter) Output(w io.Writer, all []Result) error {
var errs []error

// deliberately break the yaml until the feature is stable, there
// are open questions, e.g. how this relates to:
// https://github.com/osbuild/osbuild-composer/pull/4336
// which adds a similar but slightly different API
fmt.Fprint(w, "@WARNING - the output format is not stable yet and may change\n")

outputMap := make(map[string]map[string][]string)
for _, res := range all {
if _, ok := outputMap[res.Distro.Name()]; !ok {
Expand Down
6 changes: 3 additions & 3 deletions pkg/imagefilter/formatter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,23 +73,23 @@ func TestResultsFormatter(t *testing.T) {
{
"short",
[]string{"test-distro-1:qcow2:test_arch3"},
"test-distro-1:\n qcow2: [ test_arch3 ]\n",
"@WARNING - the output format is not stable yet and may change\ntest-distro-1:\n qcow2: [ test_arch3 ]\n",
},
{
"short",
[]string{
"test-distro-1:qcow2:test_arch3",
"test-distro-2:qcow2:test_arch3",
},
"test-distro-1:\n qcow2: [ test_arch3 ]\ntest-distro-2:\n qcow2: [ test_arch3 ]\n",
"@WARNING - the output format is not stable yet and may change\ntest-distro-1:\n qcow2: [ test_arch3 ]\ntest-distro-2:\n qcow2: [ test_arch3 ]\n",
},
{
"short",
[]string{
"test-distro-1:test_type:test_arch",
"test-distro-1:test_type:test_arch2",
},
"test-distro-1:\n test_type: [ test_arch, test_arch2 ]\n",
"@WARNING - the output format is not stable yet and may change\ntest-distro-1:\n test_type: [ test_arch, test_arch2 ]\n",
},
} {
res := make([]imagefilter.Result, len(tc.fakeResults))
Expand Down

0 comments on commit ae045a9

Please sign in to comment.