Screwdriver: Metadata is unintentionally overwritten

Created on 22 Apr 2021  Â·  5Comments  Â·  Source: screwdriver-cd/screwdriver

What happened:

After apply https://github.com/screwdriver-cd/launcher/pull/410 accidents can occur in our user's application.

Our template sets the host name of the application to meta at build time. The meta is used to test in the child job. If metadata of the same key is set in parallel, it will refer to the unintended value in child build. Testing with an unintended host name results in an unintended production deployment.

スクリーンショット 2021-04-22 14 15 51

What you expected to happen:

(Just example)
If meta is set in the parent build, skip meta overwriting of parallel build.

How to reproduce it:

bug

Most helpful comment

ok I see the bug, it's the wrong order of arguments, First argument is destination https://github.com/peterbourgon/mergemap/blob/master/mergemap.go#L17

We've been using it in reverse all over the place.

All 5 comments

Is that in same event ? This could be a bug in how merge happens. Immediate parent build's meta should always overwrite event meta, if same key exists in both. cc @tkyi

Yes, this is in the same event.

We have to look at how mergemap.merge is working, I think it's skipping same key from source if it already exist in destination object

I saw similar behavior from other merging libraries while refactoring triggerNextJob and had to use a custom merge logic to always prefer value fro source https://github.com/screwdriver-cd/screwdriver/blob/master/plugins/builds/index.js#L405-L408

ok I see the bug, it's the wrong order of arguments, First argument is destination https://github.com/peterbourgon/mergemap/blob/master/mergemap.go#L17

We've been using it in reverse all over the place.

Should be fixed with above

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jithine picture jithine  Â·  5Comments

yokawara picture yokawara  Â·  5Comments

tk3fftk picture tk3fftk  Â·  3Comments

petey picture petey  Â·  8Comments

jeffreytolar picture jeffreytolar  Â·  3Comments