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(artifacts): Resolving is broken in multiple places #4526

Merged
merged 4 commits into from
Sep 19, 2023

Conversation

xibz
Copy link
Contributor

@xibz xibz commented Sep 15, 2023

8df68b7 broke custom triggers to Spinnaker integration. Prior to this commit if getBoundArtifactForStage failed to find a bound artifact, resolution would happen much later by utilizing the triggers field in stages. However, getBoundArtifactForStage now throws an exception, which causes custom triggers to fail prematurely. Also if a custom trigger calls orchestrate directly and any pipeline contains getBoundArtifactForStage, this will throw an exception and prevent any resolution.

@jervi: please take a look at this as I noticed a couple of your PRs made some changes to artifact resolving, but I believe they only partially implemented the needed solution.

@xibz xibz force-pushed the broken-artifact-resolver branch 5 times, most recently from 59ec773 to 275b0aa Compare September 15, 2023 22:29
8df68b7 broke custom triggers to Spinnaker integration. Prior to
this commit if `getBoundArtifactForStage` failed to find a bound artifact,
resolution would happen much later by utilizing the `triggers` field in
stages.  However, `getBoundArtifactForStage` now throws an exception, which
causes custom triggers to fail prematurely. Also if a custom trigger calls
orchestrate directly and any pipeline contains `getBoundArtifactForStage`,
this will throw an exception and prevent any resolution.

Signed-off-by: benjamin-j-powell <[email protected]>
Copy link
Contributor

@jervi jervi left a comment

Choose a reason for hiding this comment

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

I think this makes sense 😅 Thanks for fixing @xibz, and I'm sorry for introducing any breaking changes... The artifact resolving code is complicated - it's hard to introduce/fix anything there without inadvertently ruining someone else's workflows 🥴 (some of those workflows are being dependent on what I would call bugs in earlier Orca versions though)

@xibz
Copy link
Contributor Author

xibz commented Sep 19, 2023

@jervi awesome thank you! And no worries for the breaking changes; it happens :p especially as something as complex as the artifact resolving logic.

One thing I plan on doing is documenting all my findings and knowledge in a README to help explain the whole complicated process, which may help facilitate discussion on the architecture. I do think it's overly complicated and there is room for improving the logic where we can simplify it, but that can be a separate discussion. So with that said, I'll ping you as well so we can have a group effort on updating this future README so we get everyone who's touched artifact resolving ensure that the knowledge gets dumped.

// potentially return an empty list or null back, which will throw an
// exception. Before this commit, when getBoundArtifactForStage was called,
// the method would just retrieve the bound artifact from the stage context,
// and return it as an ExpectedArtifact type instead of a map. "Resolution"
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure I understand the instead of a map part. Looking at 8df68b7#diff-b25c50ecaceee2f8b0ae1ddc77fc92d48d16fb7ff9d15d27612685f1985b2a1eL136-R144, didn't both the "before" and "after" code return an Artifact?

This means I don't understand how getBoundArtifactForStage can return an empty list since the return type is Artifact.

I'm also a little unclear why there's a comment here, in resolveArtifacts about the behavior of getBoundArtifactForStage. I could use a bit more connecting of the dots.

@dbyron-sf dbyron-sf added the ready to merge Approved and ready for merge label Sep 19, 2023
@mergify mergify bot added the auto merged Merged automatically by a bot label Sep 19, 2023
@mergify mergify bot merged commit 98b814b into spinnaker:master Sep 19, 2023
4 checks passed
@xibz xibz deleted the broken-artifact-resolver branch September 19, 2023 20:24
nemesisOsorio added a commit to armory-io/orca that referenced this pull request Oct 30, 2023
mergify bot pushed a commit that referenced this pull request Nov 6, 2023
…en if you have 2 or more of the same type (#4579)

* refactor(artifacts): partially reverting #4397

* refactor(artifacts): reverted #4489

* refactor(artifacts): reverted #4526

* test(artifacts): added test when parent pipeline does not provide expected artifacts

* test(artifacts): resolve artifacts for default and prior artifacts

---------

Co-authored-by: Cameron Motevasselani <[email protected]>
mergify bot pushed a commit that referenced this pull request Nov 6, 2023
…en if you have 2 or more of the same type (#4579)

* refactor(artifacts): partially reverting #4397

* refactor(artifacts): reverted #4489

* refactor(artifacts): reverted #4526

* test(artifacts): added test when parent pipeline does not provide expected artifacts

* test(artifacts): resolve artifacts for default and prior artifacts

---------

Co-authored-by: Cameron Motevasselani <[email protected]>
(cherry picked from commit 645059d)

# Conflicts:
#	orca-core/src/test/groovy/com/netflix/spinnaker/orca/pipeline/util/ArtifactUtilsSpec.groovy
mergify bot pushed a commit that referenced this pull request Nov 6, 2023
…en if you have 2 or more of the same type (#4579)

* refactor(artifacts): partially reverting #4397

* refactor(artifacts): reverted #4489

* refactor(artifacts): reverted #4526

* test(artifacts): added test when parent pipeline does not provide expected artifacts

* test(artifacts): resolve artifacts for default and prior artifacts

---------

Co-authored-by: Cameron Motevasselani <[email protected]>
(cherry picked from commit 645059d)

# Conflicts:
#	orca-core/src/test/groovy/com/netflix/spinnaker/orca/pipeline/util/ArtifactUtilsSpec.groovy
mergify bot pushed a commit that referenced this pull request Nov 6, 2023
…en if you have 2 or more of the same type (#4579)

* refactor(artifacts): partially reverting #4397

* refactor(artifacts): reverted #4489

* refactor(artifacts): reverted #4526

* test(artifacts): added test when parent pipeline does not provide expected artifacts

* test(artifacts): resolve artifacts for default and prior artifacts

---------

Co-authored-by: Cameron Motevasselani <[email protected]>
(cherry picked from commit 645059d)

# Conflicts:
#	orca-core/src/test/groovy/com/netflix/spinnaker/orca/pipeline/util/ArtifactUtilsSpec.groovy
edgarulg pushed a commit that referenced this pull request Nov 7, 2023
…en if you have 2 or more of the same type (backport #4579) (#4587)

* fix(artifacts): Automated triggers with artifact constraints are broken if you have 2 or more of the same type (#4579)

* refactor(artifacts): partially reverting #4397

* refactor(artifacts): reverted #4489

* refactor(artifacts): reverted #4526

* test(artifacts): added test when parent pipeline does not provide expected artifacts

* test(artifacts): resolve artifacts for default and prior artifacts

---------

Co-authored-by: Cameron Motevasselani <[email protected]>
(cherry picked from commit 645059d)

# Conflicts:
#	orca-core/src/test/groovy/com/netflix/spinnaker/orca/pipeline/util/ArtifactUtilsSpec.groovy

* fix(artifacts): resolving git conflicts from #4579 for release-1.31.x (#4590)

---------

Co-authored-by: Nemesis Osorio <[email protected]>
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.33
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants