Skip to content

Put a newline before each separator in the release manifest - #9

Open
bhouse-nexthop wants to merge 1 commit into
cloudstack:mainfrom
bhouse-nexthop:fix-manifest-separators
Open

bhouse-nexthop wants to merge 1 commit into
cloudstack:mainfrom
bhouse-nexthop:fix-manifest-separators

Conversation

@bhouse-nexthop

Copy link
Copy Markdown

Issue #, if available: none (issues are disabled on this repository)

Description of changes:

The manifest.yaml asset of release v3.0.0 has a document separator glued to the end of line 121:

roleRef:
  kind: ClusterRole
  name: cloudstack-csi-snapshotter-role
  apiGroup: rbac.authorization.k8s.io---
apiVersion: storage.k8s.io/v1
kind: CSIDriver

The cloudstack-csi-snapshotter-binding ClusterRoleBinding and the csi.cloudstack.apache.org CSIDriver become one
document. kubectl apply -f manifest.yaml refuses it, so a cluster installed from the manifest has neither the
CSIDriver nor the snapshotter's ClusterRoleBinding, and kubectl apply exits non-zero. Apache CloudStack's Kubernetes service
installs the driver from this asset.

The cause is that deploy/k8s/rbac.yaml has no newline at its end, and the release workflow appends --- right after it.

#4 changed echo "---" to printf "---\n", but that doesn't fix it:

  • printf still writes no newline before the ---.

  • printf reads a format that starts with - as an option. It writes nothing and fails:

    $ bash -c 'printf "---\n" >> manifest.yaml'; echo $?
    bash: line 1: printf: --: invalid option
    printf: usage: printf [-v var] format [arguments]
    2
    

    The run step uses bash -e, so the next tag's release job stops at its first printf. Without -e, the manifest
    would have no separators at all. No app release has run since Fix of some minor bugs when using the driver manifest and update helm chart versions #4. 3.0.1 and 3.0.2 are chart releases.

This PR writes printf '\n---\n'. It puts a newline before every separator, so a source file without a final
newline can't glue the next document onto it. An extra blank line is harmless where the file already ends with one.

Could the v3.0.0 manifest.yaml asset also be replaced with a fixed one, or a v3.0.1 app release be cut? Consumers
that pin the v3.0.0 URL keep getting the broken file. Until then they can split it with:

sed -i '/^[[:space:]]*#/!s/^\(.*[^-[:space:]]\)---$/\1\n---/' manifest.yaml

Testing performed:

  • Ran the "Create manifest" step with these changes in bash, on deploy/k8s/ of main: 12 documents, among them
    ClusterRoleBinding/cloudstack-csi-snapshotter-binding and CSIDriver/csi.cloudstack.apache.org as separate
    documents. The v3.0.0 asset parses as 11 documents: the binding is lost.
  • Ran the same step with printf "---\n" (as on main) in bash and sh: exit status 2 and nothing written.
  • In a k3s v1.33 cluster: the v3.0.0 manifest fails to apply the merged document and creates neither object; split as above, both are created.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

deploy/k8s/rbac.yaml has no newline at its end, so the separator
appended after it lands on its last line ("apiGroup:
rbac.authorization.k8s.io---") and merges the snapshotter
ClusterRoleBinding into the CSIDriver: the v3.0.0 manifest.yaml
applies neither. printf "---\n" does not fix that, and fails because
printf reads a format starting with "-" as an option.

Signed-off-by: Brad House <bhouse@nexthop.ai>
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.

1 participant