Merge pull request #2700 from tonistiigi/fix-link-itself

bake: fix validation for linking to itself
This commit is contained in:
CrazyMax 2024-09-17 09:25:26 +02:00 committed by GitHub
commit 8d3d32e376
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 1 deletions

View File

@ -480,7 +480,7 @@ func (c Config) loadLinks(name string, t *Target, m map[string]*Target, o map[st
for _, v := range t.Contexts {
if strings.HasPrefix(v, "target:") {
target := strings.TrimPrefix(v, "target:")
if target == t.Name {
if target == name {
return errors.Errorf("target %s cannot link to itself", target)
}
for _, v := range visited {