Skip to content

generate bundle: keep CSV formatting with --use-image-digests - #7137

Open
SaiPisey2 wants to merge 1 commit into
operator-framework:masterfrom
SaiPisey2:fix/bundle-digests-keep-csv-format
Open

SaiPisey2 wants to merge 1 commit into
operator-framework:masterfrom
SaiPisey2:fix/bundle-digests-keep-csv-format

Conversation

@SaiPisey2

Copy link
Copy Markdown

Description of the change:

With --use-image-digests, pinImages passes the bundle to operator-manifest-tools, which rewrites the whole CSV with gopkg.in/yaml.v3. That encoder indents sequences, while the CSV was first written with sigs.k8s.io/yaml, which does not. So a pinned CSV differs from an unpinned one on nearly every list, not just the images.

This re-encodes the CSV with sigs.k8s.io/yaml after pinning. Content is unchanged.

Motivation for the change:

Closes #7068

On the reproducer from the issue, the diff between the two bundles goes from 87 lines to 8: the digest in place of the tag, and the relatedImages block.

The fix stays in operator-sdk rather than changing ToYaml in operator-manifest-tools, since other projects use that output as is.

Tests cover the round trip, non-CSV manifests being left alone, and a symlinked manifest outside manifests/, which the fix must still follow.

Checklist

If the pull request includes user-facing changes, extra documentation is required:

With --use-image-digests, pinImages hands the bundle to
operator-manifest-tools, which rewrites the whole CSV with gopkg.in/yaml.v3.
That encoder indents sequences, while the CSV was written with
sigs.k8s.io/yaml, which does not, so a pinned bundle differed from an
unpinned one on nearly every list rather than only on its images.

Re-encode the CSVs with sigs.k8s.io/yaml once they are pinned. The content
is unchanged; on the reproducer from the issue the diff between the two
bundles drops from 87 lines to the image reference and relatedImages.

Closes operator-framework#7068

Signed-off-by: SaiPisey2 <piseysai0202@gmail.com>

This branch has not been deployed

No deployments
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.

Adding --use-image-digests changes the indentation of the rendered csv yaml file

1 participant