@@ -111,7 +111,7 @@ func (s *composeService) ensureImagesExists(ctx context.Context, project *types.
111
111
if quietPull {
112
112
mode = xprogress .PrinterModeQuiet
113
113
}
114
- opts , imagesToBuild , err := s .getBuildOptions (project , images )
114
+ opts , err := s .getBuildOptions (project , images )
115
115
if err != nil {
116
116
return err
117
117
}
@@ -120,7 +120,7 @@ func (s *composeService) ensureImagesExists(ctx context.Context, project *types.
120
120
return err
121
121
}
122
122
123
- if len (imagesToBuild ) > 0 {
123
+ if len (builtImages ) > 0 {
124
124
utils .DisplayScanSuggestMsg ()
125
125
}
126
126
for name , digest := range builtImages {
@@ -130,18 +130,17 @@ func (s *composeService) ensureImagesExists(ctx context.Context, project *types.
130
130
for i , service := range project .Services {
131
131
digest , ok := images [getImageName (service , project .Name )]
132
132
if ok {
133
- project .Services [i ].Image = digest
133
+ project .Services [i ].Labels [ api . ImageDigestLabel ] = digest
134
134
}
135
135
}
136
136
return nil
137
137
}
138
138
139
- func (s * composeService ) getBuildOptions (project * types.Project , images map [string ]string ) (map [string ]build.Options , [] string , error ) {
139
+ func (s * composeService ) getBuildOptions (project * types.Project , images map [string ]string ) (map [string ]build.Options , error ) {
140
140
opts := map [string ]build.Options {}
141
- imagesToBuild := []string {}
142
141
for _ , service := range project .Services {
143
142
if service .Image == "" && service .Build == nil {
144
- return nil , nil , fmt .Errorf ("invalid service %q. Must specify either image or build" , service .Name )
143
+ return nil , fmt .Errorf ("invalid service %q. Must specify either image or build" , service .Name )
145
144
}
146
145
imageName := getImageName (service , project .Name )
147
146
_ , localImagePresent := images [imageName ]
@@ -150,16 +149,15 @@ func (s *composeService) getBuildOptions(project *types.Project, images map[stri
150
149
if localImagePresent && service .PullPolicy != types .PullPolicyBuild {
151
150
continue
152
151
}
153
- imagesToBuild = append (imagesToBuild , imageName )
154
152
opt , err := s .toBuildOptions (project , service , imageName )
155
153
if err != nil {
156
- return nil , nil , err
154
+ return nil , err
157
155
}
158
156
opts [imageName ] = opt
159
157
continue
160
158
}
161
159
}
162
- return opts , imagesToBuild , nil
160
+ return opts , nil
163
161
164
162
}
165
163
0 commit comments