feat: support binaryContent for inline Score files #120
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I've been investigating a long standing issue of dealing with non-utf-8 files when normalising a score spec. Normally when we 'normalise' the spec, we convert any files specified via
source
into inline files withcontent
. However, since the score file itself is utf-8, not any old binary content can be written as valid unicode into the yaml file. It breaks if any non-utf-8 sequences are used, and the user will be left wondering why their file contains magic\xEF\xBF\xBD
bytes instead.I think the solution is instead to allow a separate
binaryContent
field which clearly contains base64. This is similar to kubernetes config maps which contain abinaryData
section alongside thedata
section and allows for better validation routines and checking in the implementation.An example score file might look like:
This will be supported without trouble in
score-compose
andscore-k8s
, and Humanitec may implement an extension to their existing "variables" with a similar base64 marker or alternative.