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): consider requiredArtifactIds in expected artifacts when trigger is pipeline type #4489

Merged
merged 1 commit into from
Jul 21, 2023

Conversation

nemesisOsorio
Copy link
Member

@nemesisOsorio nemesisOsorio commented Jul 19, 2023

fixes spinnaker/spinnaker#6850

Expected artifacts can be used in automated triggers and stages,
as in the following example:

artifacts

if we trigger the previous pipeline with a pipeline stage like the next image

trigger-pipeline-using-stage

you will get the following error even if the parent pipeline provides the artifact

trigger-pipeline

in the example, I'm using a Find Artifacts From Resource (Manifest) stage
and producing a docker image as an artifact, I believe this is a similar case for building
the docker image using Jenkins like is mentioned in spinnaker/spinnaker#6850

Before the following PRs (i.e. in spinnaker < 1.30) Deploy (Manifest) stage was working
#4322
#4397
#4404

the intent of this PR is to restore the previous behavior

Here are the pipelines

pr-pipelines.zip

@@ -93,7 +98,7 @@ class DependentPipelineStarter implements ApplicationContextAware {
parameters : [:],
strategy : suppliedParameters.strategy == true,
correlationId : "${parentPipeline.id}_${parentPipelineStageId}_${pipelineConfig.id}_${parentPipeline.startTime}".toString(),
expectedArtifactIds : expectedArtifactIds
expectedArtifactIds : expectedArtifactIds.toSet().toList()
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this necessary?

Copy link
Member Author

Choose a reason for hiding this comment

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

only to avoid duplications between trigger and stages

@dbyron-sf
Copy link
Contributor

It would also help to connect the dots to show if this ever worked in previous versions of spinnaker, what PR broke it, and ideally why.

@nemesisOsorio
Copy link
Member Author

It would also help to connect the dots to show if this ever worked in previous versions of spinnaker, what PR broke it, and ideally why.

Absolutely, I tested it out in 1.28 and 1.27 and it was working
There is a chance the intention for expectedArtifacts was never to use them in stages like Deploy (Manifest), but right now, you can select an expectedArtifacts in the UI.

These are the related PRs
#4322
#4397
#4404

@dbyron-sf
Copy link
Contributor

It would also help to connect the dots to show if this ever worked in previous versions of spinnaker, what PR broke it, and ideally why.

Absolutely, I tested it out in 1.28 and 1.27 and it was working There is a chance the intention for expectedArtifacts was never to use them in stages like Deploy (Manifest), but right now, you can select an expectedArtifacts in the UI.

These are the related PRs #4322 #4397 #4404

Great. Those PRs look like they went in to 1.30, so I assume it's been broken since then. Any idea about 1.29?

@dbyron-sf
Copy link
Contributor

Also, cc: @jervi since you made those PRs.

@nemesisOsorio
Copy link
Member Author

nemesisOsorio commented Jul 20, 2023

It would also help to connect the dots to show if this ever worked in previous versions of spinnaker, what PR broke it, and ideally why.

Absolutely, I tested it out in 1.28 and 1.27 and it was working There is a chance the intention for expectedArtifacts was never to use them in stages like Deploy (Manifest), but right now, you can select an expectedArtifacts in the UI.
These are the related PRs #4322 #4397 #4404

Great. Those PRs look like they went in to 1.30, so I assume it's been broken since then. Any idea about 1.29?

I tested it out in orca release-1.29.x and it is working, so you are right it's been broken since 1.30

Copy link
Contributor

@edgarulg edgarulg left a comment

Choose a reason for hiding this comment

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

Overall these changes looks good to me. This is an issue present in 1.30 & 1.31 only. I left my approve but I want @dbyron-sf or @xibz to have last word on approve these changes.

I also added @jervi as reviewer because these seems to be related with his PRs.

@edgarulg edgarulg requested a review from jervi July 20, 2023 20:02
@edgarulg
Copy link
Contributor

Also I'm seeing the build failing so would be good to rerun it because seems to be a false-positive error in the tests.

@dbyron-sf
Copy link
Contributor

@nemesisOsorio I'm still hoping for a bit more in the description I think. Something like

Before PR XYZ (i.e. in spinnaker < 1.30), when pipeline B contained a trigger on
the completion of pipeline A with an artifact constraint, pipeline B only
triggered when pipeline A provided that artifact via the XXX field in the
pipeline execution context.  If pipeline A didn't provide that artifact,
pipeline B wouldn't trigger.  After that PR, pipeline B wouldn't trigger either
way -- even if pipeline A provided that artifact.  This PR restores the pre-PR
XYZ behavior.

but with the important missing bits filled in.

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.

Sorry for overlooking this artifact flow when creating the aforementioned PR's 😬
But I think this is a good fix @nemesisOsorio.

@xibz
Copy link
Contributor

xibz commented Jul 21, 2023

@nemesisOsorio Thank you for the changes and updates! This looks a lot better :).

Sorry for overlooking this artifact flow

@jervi No worries! It happens. Im trying to think of any major features I've written that contained 0 bugs. Yep, can't think of one haha.

@dbyron-sf dbyron-sf added ready to merge Approved and ready for merge backport-candidate Add to PRs to designate release branch patch candidates. labels Jul 21, 2023
@mergify mergify bot added the auto merged Merged automatically by a bot label Jul 21, 2023
@mergify mergify bot merged commit 45de5bc into spinnaker:master Jul 21, 2023
4 checks passed
@dbyron-sf
Copy link
Contributor

@Mergifyio backport release-1.30.x release-1.31.x

@mergify
Copy link
Contributor

mergify bot commented Jul 21, 2023

backport release-1.30.x release-1.31.x

✅ Backports have been created

mergify bot pushed a commit that referenced this pull request Jul 21, 2023
…en trigger is pipeline type (#4489)

(cherry picked from commit 45de5bc)
mergify bot pushed a commit that referenced this pull request Jul 21, 2023
…en trigger is pipeline type (#4489)

(cherry picked from commit 45de5bc)
mergify bot added a commit that referenced this pull request Jul 21, 2023
…en trigger is pipeline type (#4489) (#4490)

(cherry picked from commit 45de5bc)

Co-authored-by: Nemesis Osorio <nemesis211_6@hotmail.com>
mergify bot added a commit that referenced this pull request Jul 21, 2023
…en trigger is pipeline type (#4489) (#4491)

(cherry picked from commit 45de5bc)

Co-authored-by: Nemesis Osorio <nemesis211_6@hotmail.com>
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 <cmotevasselani@gmail.com>
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 <cmotevasselani@gmail.com>
(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 <cmotevasselani@gmail.com>
(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 <cmotevasselani@gmail.com>
(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 <cmotevasselani@gmail.com>
(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 <nemesis211_6@hotmail.com>
nemesisOsorio added a commit to OpsMx/orca-oes that referenced this pull request May 20, 2024
…en trigger is pipeline type (spinnaker#4489) (spinnaker#4490)

(cherry picked from commit 45de5bc)

Co-authored-by: Nemesis Osorio <nemesis211_6@hotmail.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 backport-candidate Add to PRs to designate release branch patch candidates. ready to merge Approved and ready for merge target-release/1.32
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"Required Artifacts to Bind" is broken since 1.30
6 participants