Merge branch 'main' into fix/container-interface

This commit is contained in:
nils måsén 2023-04-12 17:17:28 +02:00 committed by GitHub
commit f28ffc611f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
36 changed files with 1207 additions and 486 deletions

View file

@ -145,6 +145,22 @@ func (c Container) IsMonitorOnly() bool {
return parsedBool
}
// IsNoPull returns the value of the no-pull label. If the label is not set
// then false is returned.
func (c Container) IsNoPull() bool {
rawBool, ok := c.getLabelValue(noPullLabel)
if !ok {
return false
}
parsedBool, err := strconv.ParseBool(rawBool)
if err != nil {
return false
}
return parsedBool
}
// Scope returns the value of the scope UID label and if the label
// was set.
func (c Container) Scope() (string, bool) {
@ -164,7 +180,14 @@ func (c Container) Links() []string {
dependsOnLabelValue := c.getLabelValueOrEmpty(dependsOnLabel)
if dependsOnLabelValue != "" {
links := strings.Split(dependsOnLabelValue, ",")
for _, link := range strings.Split(dependsOnLabelValue, ",") {
// Since the container names need to start with '/', let's prepend it if it's missing
if !strings.HasPrefix(link, "/") {
link = "/" + link
}
links = append(links, link)
}
return links
}