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

fix(preconfigured): Allow PreconfiguredJobStage parameters to map to one-dimensional array property values #3830

Merged
merged 13 commits into from
Aug 6, 2020
Merged

Conversation

jaydee864
Copy link
Contributor

Addresses spinnaker/spinnaker#5889 by checking for property nodes which end in array notation and extracting them from the parent node as a List, then returning the Object at the desired index.

Notably, this PR does not support 2+ dimensional arrays (eg. "foo[0][1]"). I struggled to come up with a clean and viable solution for handling that scenario, but I'm also not entirely sure it's needed for the object models that Orca is currently working with.

Copy link
Contributor

@marchello2000 marchello2000 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, @jaydee864! Apologies this took me a while to review.
All looks good minor comment about the exception.

@jaydee864
Copy link
Contributor Author

@marchello2000 @cfieber @srekapalli Are there any further changes needed from my side on this PR?

@ezimanyi ezimanyi added the ready to merge Approved and ready for merge label Aug 6, 2020
@mergify mergify bot merged commit 3fa29ca into spinnaker:master Aug 6, 2020
@mergify mergify bot added the auto merged Merged automatically by a bot label Aug 6, 2020
@kevinawoo
Copy link
Member

kevinawoo commented Aug 6, 2020

This is a great candidate for backporting

@Mergifyio backport release-1.19.x release-1.20.x release-1.21.x

edit the fix is for 1.21 so the 1.19 and 1.20 backports will fail 🤣

mergify bot pushed a commit that referenced this pull request Aug 6, 2020
…one-dimensional array property values (#3830)

* fix(preconfigured): Update setNestedValue to handle one-dimensional array objects

* fix(preconfigured): Handle case where array property is missing from root object

* refactor(preconfigured): Use Groovy regex syntax

* refactor(preconfigured): Update exception message to be more meaningful

Co-authored-by: Mark Vulfson <markvu@live.com>

Co-authored-by: Mark Vulfson <markvu@live.com>
(cherry picked from commit 3fa29ca)
@mergify
Copy link
Contributor

mergify bot commented Aug 6, 2020

Command backport release-1.19.x release-1.20.x release-1.21.x: failure

No backport have been created

  • Backport to branch release-1.19.x failed

Cherry-pick of 3fa29ca has failed:

On branch mergify/bp/release-1.19.x/pr-3830
Your branch is up to date with 'origin/release-1.19.x'.

You are currently cherry-picking commit 3fa29ca79.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:

	modified:   orca-clouddriver/src/test/groovy/com/netflix/spinnaker/orca/clouddriver/pipeline/job/PreconfiguredJobStageSpec.groovy

Unmerged paths:
  (use "git add <file>..." to mark resolution)

	both modified:   orca-clouddriver/src/main/groovy/com/netflix/spinnaker/orca/clouddriver/pipeline/job/PreconfiguredJobStage.groovy

  • Backport to branch release-1.20.x failed

Cherry-pick of 3fa29ca has failed:

On branch mergify/bp/release-1.20.x/pr-3830
Your branch is up to date with 'origin/release-1.20.x'.

You are currently cherry-picking commit 3fa29ca79.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:

	modified:   orca-clouddriver/src/test/groovy/com/netflix/spinnaker/orca/clouddriver/pipeline/job/PreconfiguredJobStageSpec.groovy

Unmerged paths:
  (use "git add <file>..." to mark resolution)

	both modified:   orca-clouddriver/src/main/groovy/com/netflix/spinnaker/orca/clouddriver/pipeline/job/PreconfiguredJobStage.groovy

kevinawoo pushed a commit that referenced this pull request Aug 6, 2020
…one-dimensional array property values (bp #3830) (#3846)

* fix(preconfigured): Update setNestedValue to handle one-dimensional array objects

* fix(preconfigured): Handle case where array property is missing from root object

* refactor(preconfigured): Use Groovy regex syntax

* refactor(preconfigured): Update exception message to be more meaningful

Co-authored-by: Mark Vulfson <markvu@live.com>

Co-authored-by: Mark Vulfson <markvu@live.com>
(cherry picked from commit 3fa29ca)

Co-authored-by: Joe DeStefano <jld864@gmail.com>
KathrynLewis pushed a commit to KathrynLewis/orca that referenced this pull request Jan 31, 2021
…one-dimensional array property values (spinnaker#3830)

* fix(preconfigured): Update setNestedValue to handle one-dimensional array objects

* fix(preconfigured): Handle case where array property is missing from root object

* refactor(preconfigured): Use Groovy regex syntax

* refactor(preconfigured): Update exception message to be more meaningful

Co-authored-by: Mark Vulfson <markvu@live.com>

Co-authored-by: Mark Vulfson <markvu@live.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto merged Merged automatically by a bot ready to merge Approved and ready for merge target-release/1.22
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants