Пример #1
0
// PrepareRenderData constructs new renderdata based on pipeline config + latest BOSH deployments data
func PrepareRenderData(config *config.PipelinesConfig, db data.DeploymentsPerBOSH, filterByTag string) *RenderData {
	tiers := make([]*Tier, len(config.Tiers))
	filterTags := filterTagsForReleaseNames(db.ReleaseNames())
	renderdata := &RenderData{
		Config:     config,
		FilterTags: filterTags,
		Tiers:      tiers,
	}
	for tierIndex, configTier := range config.Tiers {
		slots := make([]*Slot, len(configTier.Slots))
		tiers[tierIndex] = &Tier{
			Name:  configTier.Name,
			Slots: slots,
		}

		for slotIndex, configSlot := range configTier.Slots {
			deployments := renderdata.DiscoverDeploymentsForSlot(db, configTier, configSlot, filterByTag)
			slots[slotIndex] = &Slot{
				Deployments: deployments,
			}
		}
	}
	return renderdata
}