-
Notifications
You must be signed in to change notification settings - Fork 808
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
feat(orca) Place produced artifacts in global context #1441
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,7 @@ package com.netflix.spinnaker.orca.clouddriver.tasks.cluster | |
import com.fasterxml.jackson.core.type.TypeReference | ||
import com.fasterxml.jackson.databind.ObjectMapper | ||
import com.netflix.frigga.Names | ||
import com.netflix.spinnaker.kork.artifacts.model.Artifact | ||
import com.netflix.spinnaker.moniker.Moniker | ||
import com.netflix.spinnaker.orca.ExecutionStatus | ||
import com.netflix.spinnaker.orca.RetryableTask | ||
|
@@ -229,8 +230,45 @@ class FindImageFromClusterTask extends AbstractCloudProviderAwareTask implements | |
} | ||
}.flatten() | ||
|
||
List<Artifact> artifacts = imageSummaries.collect { placement, summaries -> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this meant to be an interim solution to make it appear like all stages emit artifacts rather than image summaries? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes. The idea is to do this in two takes. This first PR to make artifacts available where we produce/find images. Then the next iteration will be to actually use these artifacts for deployments which will in turn make them even more available. |
||
Artifact artifact = new Artifact() | ||
summaries.findResults { summary -> | ||
if (config.imageNamePattern && !(summary.imageName ==~ config.imageNamePattern)) { | ||
return null | ||
} | ||
def location = "global" | ||
|
||
if (placement.type == Location.Type.REGION) { | ||
location = placement.value | ||
} else if (placement.type == Location.Type.ZONE) { | ||
location = placement.value | ||
} | ||
|
||
def metadata = [ | ||
sourceServerGroup: summary.serverGroupName, | ||
refId: stage.refId | ||
] | ||
|
||
try { | ||
metadata.putAll(summary.image ?: [:]) | ||
metadata.putAll(summary.buildInfo ?: [:]) | ||
} catch (Exception e) { | ||
log.error("Unable to merge server group image/build info (summary: ${summary})", e) | ||
} | ||
|
||
artifact.metadata = metadata | ||
artifact.name = summary.imageName | ||
artifact.location = location | ||
artifact.type = "${cloudProvider}/image" | ||
artifact.reference = "${summary.imageId}" | ||
artifact.uuid = UUID.randomUUID().toString() | ||
} | ||
return artifact | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This seems a little odd - instead of assigning to |
||
}.flatten() | ||
|
||
return new TaskResult(ExecutionStatus.SUCCEEDED, [ | ||
amiDetails: deploymentDetails | ||
amiDetails: deploymentDetails, | ||
artifacts: artifacts | ||
], [ | ||
deploymentDetails: deploymentDetails | ||
]) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be a list, right? We can produce multiple images per bake.