Skip to content

Commit 47e6820

Browse files
fix scope problem
1 parent abfd410 commit 47e6820

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

pkg/buildtest/run.go

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ func DoRun(originalIndy, targetIndy, indyProxyUrl, migrateTargetIndy, packageTyp
101101
fmt.Printf("Waiting 60s...\n")
102102
time.Sleep(60 * time.Second) // wait for Indy event handled
103103
for _, down := range migrateArtifacts {
104-
broken = !migrateFunc(down[0], down[2], down[1])
104+
broken = !migrateFunc(down[0], down[1], down[2])
105105
if broken {
106106
break
107107
}
@@ -278,29 +278,29 @@ func prepareMigrateEntriesByFolo(targetIndyURL, migrateTargetIndyHost, packageTy
278278
broken := false
279279
migratePath := setHostname(down.LocalUrl, migrateTargetIndyHost)
280280
fmt.Printf("[%s] Deleting %s\n", time.Now().Format(DATA_TIME), migratePath)
281-
broken = !delRequest(migratePath)
281+
broken = !delArtifact(migratePath)
282282

283283
if down.StoreKey != packageType+":hosted:shared-imports" {
284284
extra, _ := url.JoinPath("http://"+migrateTargetIndyHost, "/api/content", packageType, "/hosted/shared-imports", down.Path)
285285
fmt.Printf("[%s] Deleting %s\n", time.Now().Format(DATA_TIME), extra)
286-
broken = !delRequest(extra)
286+
broken = !delArtifact(extra)
287287
}
288288

289289
if down.StoreKey == "npm:remote:npmjs" || down.StoreKey == "maven:remote:central" {
290-
migratePath, _ := url.JoinPath("http://"+migrateTargetIndyHost, "/api/content", packageType, "/hosted/shared-imports", down.Path)
290+
migratePath, _ = url.JoinPath("http://"+migrateTargetIndyHost, "/api/content", packageType, "/hosted/shared-imports", down.Path)
291291
fmt.Printf("[%s] Deleting %s\n", time.Now().Format(DATA_TIME), migratePath)
292-
broken = !delRequest(migratePath)
292+
broken = !delArtifact(migratePath)
293293
} else if down.StoreKey == "maven:remote:mrrc-ga-rh" || strings.HasPrefix(down.StoreKey, "maven:hosted:build-") {
294-
migratePath, _ := url.JoinPath("http://"+migrateTargetIndyHost, "/api/content", packageType, "/hosted/pnc-builds", down.Path)
294+
migratePath, _ = url.JoinPath("http://"+migrateTargetIndyHost, "/api/content", packageType, "/hosted/pnc-builds", down.Path)
295295
fmt.Printf("[%s] Deleting %s\n", time.Now().Format(DATA_TIME), migratePath)
296-
broken = !delRequest(migratePath)
296+
broken = !delArtifact(migratePath)
297297
}
298298

299299
if broken {
300300
fmt.Printf("[%s] Deletion failed for %s\n", time.Now().Format(DATA_TIME), migratePath)
301301
}
302302

303-
result[down.Path] = []string{down.Md5, migratePath, downUrl}
303+
result[down.Path] = []string{down.Md5, downUrl, migratePath}
304304
}
305305
return result
306306
}
@@ -381,3 +381,8 @@ func setHostname(addr, hostname string) string {
381381
u.Host = hostname
382382
return u.String()
383383
}
384+
385+
func delArtifact(url string) bool {
386+
_, _, succeeded := common.HTTPRequest(url, common.MethodDelete, nil, false, nil, nil, "", false)
387+
return succeeded
388+
}

0 commit comments

Comments
 (0)