@@ -154,9 +154,15 @@ func (d *depot) SetCacheSize(mb int) {
154154 d .cacheSize = int64 (mb ) * MB
155155}
156156
157- func (d * depot ) Exists (id strfmt.UUID ) bool {
158- _ , ok := d .artifacts [id ]
159- return ok
157+ // Note: the returned artifactInfo may be nil for depot artifacts that predate this functionality.
158+ func (d * depot ) Exists (id strfmt.UUID ) (bool , * artifactInfo ) {
159+ if _ , ok := d .artifacts [id ]; ok {
160+ if artifact , exists := d .config .Cache [id ]; exists {
161+ return true , artifact
162+ }
163+ return true , nil
164+ }
165+ return false , nil
160166}
161167
162168func (d * depot ) Path (id strfmt.UUID ) string {
@@ -184,7 +190,7 @@ func (d *depot) DeployViaLink(id strfmt.UUID, relativeSrc, absoluteDest string)
184190 d .fsMutex .Lock ()
185191 defer d .fsMutex .Unlock ()
186192
187- if ! d .Exists (id ) {
193+ if exists , _ := d .Exists (id ); ! exists {
188194 return errs .New ("artifact not found in depot" )
189195 }
190196
@@ -237,7 +243,7 @@ func (d *depot) DeployViaCopy(id strfmt.UUID, relativeSrc, absoluteDest string)
237243 d .fsMutex .Lock ()
238244 defer d .fsMutex .Unlock ()
239245
240- if ! d .Exists (id ) {
246+ if exists , _ := d .Exists (id ); ! exists {
241247 return errs .New ("artifact not found in depot" )
242248 }
243249
@@ -327,6 +333,13 @@ func (d *depot) Track(id strfmt.UUID, deploy *deployment, artifact *buildplan.Ar
327333 return nil
328334}
329335
336+ func (d * depot ) Deployments (id strfmt.UUID ) []deployment {
337+ if deployments , ok := d .config .Deployments [id ]; ok {
338+ return deployments
339+ }
340+ return nil
341+ }
342+
330343// Untrack will remove an artifact deployment.
331344// It does not actually delete files; it just tells the depot a previously tracked artifact should
332345// no longer be tracked.
@@ -342,7 +355,7 @@ func (d *depot) Undeploy(id strfmt.UUID, relativeSrc, path string) error {
342355 d .fsMutex .Lock ()
343356 defer d .fsMutex .Unlock ()
344357
345- if ! d .Exists (id ) {
358+ if exists , _ := d .Exists (id ); ! exists {
346359 return errs .New ("artifact not found in depot" )
347360 }
348361
0 commit comments