@@ -178,6 +178,15 @@ func (ars *ArtifactoryReleaseSource) findReleaseVersion(spec, searchSpec cargo.B
178178 return cargo.BOSHReleaseTarballLock {}, err
179179 }
180180
181+ names := re .SubexpNames ()
182+ hasStemcellGroup := false
183+ for _ , name := range names {
184+ if name == reStemcellVersionGroup {
185+ hasStemcellGroup = true
186+ break
187+ }
188+ }
189+
181190 foundRelease := cargo.BOSHReleaseTarballLock {}
182191 for _ , artifactoryFile := range artifactoryFiles {
183192 if artifactoryFile .Folder {
@@ -187,7 +196,6 @@ func (ars *ArtifactoryReleaseSource) findReleaseVersion(spec, searchSpec cargo.B
187196 if matches == nil {
188197 continue
189198 }
190- names := re .SubexpNames ()
191199 matchedGroups := map [string ]string {}
192200 for i , n := range names {
193201 if i == 0 || n == "" {
@@ -197,9 +205,7 @@ func (ars *ArtifactoryReleaseSource) findReleaseVersion(spec, searchSpec cargo.B
197205 }
198206
199207 version := matchedGroups [reReleaseVersionGroup ]
200- stemcellVersion := matchedGroups [reStemcellVersionGroup ]
201- // we aren't updating stemcell version
202- if stemcellVersion != spec .StemcellVersion {
208+ if hasStemcellGroup && matchedGroups [reStemcellVersionGroup ] != spec .StemcellVersion {
203209 continue
204210 }
205211
0 commit comments