Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: YAML serialization of git sha1 #15

Closed
leafty opened this issue Jun 13, 2018 · 3 comments · Fixed by #16
Closed

Bug: YAML serialization of git sha1 #15

leafty opened this issue Jun 13, 2018 · 3 comments · Fixed by #16

Comments

@leafty
Copy link
Contributor

leafty commented Jun 13, 2018

In the event that the git short hash of a repository is something like 01234567, then the image tag is serialized unquoted, resulting in a broken values.yaml.

This is a bit hard to reproduce, as it would happen on only ~0.4% of the commits.

You can reproduce the issue by running:

git clone https://github.com/SwissDataScienceCenter/renku-ui
cd renku-ui
git checkout -b test 0192117
cd helm-chart
chartpress

Then, you can check the values.yaml file contents:

cat renku-ui/values.yaml
[...]
image:
  name: renku/renku-ui
  repository: renku/renku-ui
  tag: 0192117
  pullPolicy: IfNotPresent
[...]

As you can see, this will result in image.tag equals to 192117 and not 0192117.

A potential fix would be to always quote sha1 tags.

@minrk
Copy link
Member

minrk commented Jul 14, 2018

This is a super weird bug in ruamel.yaml, where it skips quotes for numbers that start with 0 but can't be octal (i.e. contain 8 or 9 somewhere):

In [11]: from ruamel.yaml import YAML
In [12]: yaml = YAML(typ='rt')
In [13]: for i in range(100):
    ...:     yaml.dump({'x': '%03i' % i}, sys.stdout)
x: '000'
x: '001'
x: '002'
x: '003'
x: '004'
x: '005'
x: '006'
x: '007'
x: 008
x: 009
x: '010'
x: '011'
x: '012'
x: '013'
x: '014'
x: '015'
x: '016'
x: '017'
x: 018
x: 019
x: '020'
x: '021'
x: '022'
x: '023'
x: '024'
x: '025'
x: '026'
x: '027'
x: 028
x: 029
x: '030'
x: '031'
x: '032'
x: '033'
x: '034'
x: '035'
x: '036'
x: '037'
x: 038
x: 039
x: '040'
x: '041'
x: '042'
x: '043'
x: '044'
x: '045'
x: '046'
x: '047'
x: 048
x: 049
x: '050'
x: '051'
x: '052'
x: '053'
x: '054'
x: '055'
x: '056'
x: '057'
x: 058
x: 059
x: '060'
x: '061'
x: '062'
x: '063'
x: '064'
x: '065'
x: '066'
x: '067'
x: 068
x: 069
x: '070'
x: '071'
x: '072'
x: '073'
x: '074'
x: '075'
x: '076'
x: '077'
x: 078
x: 079
x: 080
x: 081
x: 082
x: 083
x: 084
x: 085
x: 086
x: 087
x: 088
x: 089
x: 090
x: 091
x: 092
x: 093
x: 094
x: 095
x: 096
x: 097
x: 098
x: 099

I think we can tell it to ensure there are quotes

@leafty
Copy link
Contributor Author

leafty commented Jul 14, 2018

Good work digging that out 👍

@consideRatio
Copy link
Member

This was apparently fixed in 0.15.44 :)

image

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 a pull request may close this issue.

3 participants