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

refactor(tag-generator): include server group coordinates in generate… #1634

Merged
merged 2 commits into from
Sep 20, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,11 @@ class AddServerGroupEntityTagsTask extends AbstractCloudProviderAwareTask implem
def operations = []
((StageData) stage.mapTo(StageData)).deployServerGroups.each { String region, Set<String> serverGroups ->
serverGroups.each { String serverGroup ->
Collection<Map<String, Object>> tags = tagGenerators ? tagGenerators.findResults { it.generateTags(stage) }.flatten() : []
Collection<Map<String, Object>> tags = tagGenerators ?
tagGenerators.findResults {
it.generateTags(stage, serverGroup, getCredentials(stage), region, getCloudProvider(stage))
}.flatten() :
[]
if (!tags) {
return []
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
public class ContextBasedServerGroupEntityTagGenerator implements ServerGroupEntityTagGenerator {

@Override
public List<Map<String, Object>> generateTags(Stage stage) {
public List<Map<String, Object>> generateTags(Stage stage, String serverGroup, String account, String location, String cloudProvider) {
Map context = stage.getContext();

if (context.containsKey("entityTags")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ public interface ServerGroupEntityTagGenerator {
* @param stage the stage that performed the deployment
* @return a collection of maps representing tags to send to Clouddriver
*/
Collection<Map<String, Object>> generateTags(Stage stage);
Collection<Map<String, Object>> generateTags(Stage stage, String serverGroup, String account, String location, String cloudProvider);
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
public class SpinnakerMetadataServerGroupTagGenerator implements ServerGroupEntityTagGenerator {

@Override
public Collection<Map<String, Object>> generateTags(Stage stage) {
public Collection<Map<String, Object>> generateTags(Stage stage, String serverGroup, String account, String location, String cloudProvider) {
Execution execution = stage.getExecution();
Map context = stage.getContext();

Expand Down