This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

core / spindle / engines / microvm / models.go
1.7 kB 51 lines
1package microvm 2 3import ( 4 "fmt" 5 "slices" 6 7 "tangled.org/core/spindle/models" 8) 9 10type manifestWorkflow struct { 11 Image string `yaml:"image"` 12 Services map[string]any `yaml:"services"` 13 Virtualisation map[string]any `yaml:"virtualisation"` 14 Dependencies []string `yaml:"dependencies"` 15 Registry map[string]any `yaml:"registry"` 16 Environment map[string]string `yaml:"environment"` 17 Substituters map[string]string `yaml:"substituters"` 18 Cache []models.CacheEntry `yaml:"cache"` 19 Steps []struct { 20 Name string `yaml:"name"` 21 Command string `yaml:"command"` 22 Environment map[string]string `yaml:"environment"` 23 } `yaml:"steps"` 24} 25 26// sorted so the guest env is deterministic 27func workflowSubstituters(substituters map[string]string) (urls []string, keys []string, err error) { 28 for cacheURL, key := range substituters { 29 urls = append(urls, cacheURL) 30 if key != "" { 31 keys = append(keys, key) 32 } 33 } 34 if _, err := parseSubstituterUpstreams(urls); err != nil { 35 return nil, nil, fmt.Errorf("substituters: %w", err) 36 } 37 slices.Sort(urls) 38 slices.Sort(keys) 39 return urls, keys, nil 40} 41 42type manifestConfig struct { 43 Services map[string]any `yaml:"services" json:"services,omitempty"` 44 Virtualisation map[string]any `yaml:"virtualisation" json:"virtualisation,omitempty"` 45 Dependencies []string `yaml:"dependencies" json:"dependencies,omitempty"` 46 Registry map[string]any `yaml:"registry" json:"registry,omitempty"` 47} 48 49func (c manifestConfig) Enabled() bool { 50 return len(c.Services) > 0 || len(c.Virtualisation) > 0 || len(c.Dependencies) > 0 || len(c.Registry) > 0 51}