Screwdriver: Meta-cli overwrites object when adding new key

Created on 5 May 2017  路  3Comments  路  Source: screwdriver-cd/screwdriver

This issue occurs when trying to add in a new key value to the object that already exists in meta. When trying to add in a new key, the object gets overridden.

This can be reproduced by a simple screwdriver.yaml that looks like
shared: image: node:6 jobs: main: steps: - test: meta set foo.a true - test1: meta set foo.b true - test3: echo `meta get foo`

The actual output of the echo is "{ "b" : true }", and the expected output would be "{ "a": true, "b": true}"

I'm using the latest launcher

Most helpful comment

@minz1027 I will fix it. Please assign me this issue.
Thank you for finding this @nkatzman!

All 3 comments

@tk3fftk Hiroki, can u take a look at this?
I think that in the object case, the previous metadata is not correctly copied over.
https://github.com/screwdriver-cd/meta-cli/blob/master/meta.go#L237

In the array case, it is okay:

meta set foo[0] foo
meta set foo[1] bar

@minz1027 I will fix it. Please assign me this issue.
Thank you for finding this @nkatzman!

The change is in LAUNCHER v4.0.19. I also tagged it as stable now.
Confirmed that it is working:
screen shot 2017-05-10 at 10 47 55 am

Thanks @tk3fftk for fixing it so fast!
Please reopen if it's still not working for you @nkatzman.

Was this page helpful?
0 / 5 - 0 ratings