Skip to content

Commit 9f78822

Browse files
committed
include build secrets when validating/normalizing project resources
Signed-off-by: Nicolas De Loof <[email protected]>
1 parent c8637f7 commit 9f78822

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

loader/validate.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,11 @@ func checkConsistency(project *types.Project) error {
5555
}
5656
}
5757
}
58-
for _, secret := range s.Secrets {
59-
if _, ok := project.Secrets[secret.Source]; !ok {
60-
return errors.Wrap(errdefs.ErrInvalid, fmt.Sprintf("service %q refers to undefined secret %s", s.Name, secret.Source))
58+
if s.Build != nil {
59+
for _, secret := range s.Build.Secrets {
60+
if _, ok := project.Secrets[secret.Source]; !ok {
61+
return errors.Wrap(errdefs.ErrInvalid, fmt.Sprintf("service %q refers to undefined build secret %s", s.Name, secret.Source))
62+
}
6163
}
6264
}
6365
for _, config := range s.Configs {

types/project.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,11 @@ func (p *Project) WithoutUnnecessaryResources() {
246246
for _, v := range s.Secrets {
247247
requiredSecrets[v.Source] = struct{}{}
248248
}
249+
if s.Build != nil {
250+
for _, v := range s.Build.Secrets {
251+
requiredSecrets[v.Source] = struct{}{}
252+
}
253+
}
249254
for _, v := range s.Configs {
250255
requiredConfigs[v.Source] = struct{}{}
251256
}

0 commit comments

Comments
 (0)