renewMirroring: delete funzionante
This commit is contained in:
+12
-16
@@ -7,7 +7,7 @@ $startTime = (Get-Date).toString("yyyy/MM/dd HH:mm:ss")
|
||||
$mainStopWatch = [system.diagnostics.stopwatch]::StartNew()
|
||||
|
||||
#token per autenticazione gitlab.steamware.net
|
||||
$head = @{"PRIVATE-TOKEN"="glpat-dQsUhS-GxNomkh1GnjHZ"}
|
||||
$head = @{"PRIVATE-TOKEN"="glpat-pmkiVSJMhNyAySEKp2nA"}
|
||||
|
||||
#nome utente che effettua i mirror push
|
||||
$userName = "replica"
|
||||
@@ -22,10 +22,7 @@ $tokenNembro = "glpat-TzZkRUoYAdKikgwFXW_E"
|
||||
$projectCount = 1
|
||||
|
||||
#numero massimo di progetti da analizzare
|
||||
$projectNumber = 5
|
||||
|
||||
#conteggio progetti trovati
|
||||
$existingProjects = 0
|
||||
$projectNumber = 1
|
||||
|
||||
#livello di log: 0=log sintetico, 1=log errori, 2=log full, 3=log ampolloso
|
||||
$logLevel = 3
|
||||
@@ -96,20 +93,21 @@ do
|
||||
#verifico se i mirroring trovati per il progetto corrente contengono "azzano" nell'url
|
||||
if($item.url.Contains("azzano"))
|
||||
{
|
||||
#salvo id mirror e url mirror
|
||||
$id = $($item.id)
|
||||
$url = $($item.url)
|
||||
WriteLogOutput 2 "ID: $id - URL: $url"
|
||||
|
||||
}
|
||||
#verifico se i mirroring trovati per il progetto corrente contengono "nembro" nell'url
|
||||
if($item.url.Contains("nembro"))
|
||||
{
|
||||
$id = $($item.id)
|
||||
$url = $($item.url)
|
||||
WriteLogOutput 2 "ID: $id - URL: $url"
|
||||
$trunk = $url.Remove(0, ($url.Length - 18))
|
||||
WriteLogOutput 2 "Truncated: $trunk"
|
||||
#chiamata api con method delete che cancella mirror con id specificato
|
||||
$callUrlDeleteMirror = "https://gitlab.steamware.net/api/v4/projects/" + $projectCount + "/remote_mirrors/" + $id
|
||||
Invoke-WebRequest -URI $callUrlDeleteMirror -Method Delete -Headers $head -ContentType "application/json" -UseBasicParsing
|
||||
#chiamata api con method post che crea mirror con username e token specificati
|
||||
#$callUrlCreateMirror = "https://gitlab.steamware.net/api/v4/projects/" + $projectCount + "/remote_mirrors"
|
||||
#$newMirrorUrl = "https://" + $userName + ":" + $tokenAzzano + "@gitlab-azzano.steamware.net" + $trunk
|
||||
#Invoke-WebRequest -Method Post -URI $callUrlCreateMirror -Headers $head -ContentType "application/json" -UseBasicParsing
|
||||
}
|
||||
}
|
||||
$existingProjects=$existingProjects+1
|
||||
}
|
||||
#scrivo se trovo un errore (in particolare progetto ID non trovato) durante il try/catch
|
||||
catch
|
||||
@@ -132,8 +130,6 @@ $endTime = (Get-Date).toString("yyyy/MM/dd HH:mm:ss")
|
||||
|
||||
#scrivo a video le statistiche
|
||||
WriteLogOutput 0 ""
|
||||
WriteLogOutput 0 "PROGETTI ANALIZZATI: $existingProjects"
|
||||
WriteLogOutput 0 ""
|
||||
WriteLogOutput 0 "Fine Esecuzione Script: $endTime"
|
||||
WriteLogOutput 0 ""
|
||||
WriteLogOutput 0 "Durata Esecuzione Script: $durataScript secondi"
|
||||
|
||||
Reference in New Issue
Block a user