Skip to content

Commit 009df65

Browse files
committed
[sync git] fixed syncer [lwpm]
Signed-off-by: Kang Huaishuai <khs1994@khs1994.com>
1 parent 242581a commit 009df65

File tree

5 files changed

+32
-25
lines changed

5 files changed

+32
-25
lines changed

kubernetes/addons/coredns/cn/kustomization.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ images:
44
- name: ghcr.io/khs1994-docker/registry.k8s.io/coredns/coredns:v1.12.1
55
# newName: gcr.mirror/google-containers/coredns
66
# newName: ccr.ccs.tencentyun.com/gcr-mirror/coredns
7-
newName: docker.cnb.cool/khs1994-docker/registry.k8s.io/coredns-coredns:v1.12.1
7+
newName: docker.cnb.cool/khs1994-docker/registry.k8s.io/coredns-coredns

kubernetes/addons/metrics-server/base/kustomization.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ commonLabels:
77
k8s-app: metrics-server
88
images:
99
- name: registry.k8s.io/metrics-server/metrics-server:v0.8.0
10-
newName: ghcr.io/khs1994-docker/registry.k8s.io/metrics-server/metrics-server:v0.8.0
10+
newName: ghcr.io/khs1994-docker/registry.k8s.io/metrics-server/metrics-server

windows/sdk/dockerhub/blobs/get.psm1

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -70,24 +70,6 @@ function Get-Blob([string]$token, [string]$image, [string]$digest, [string]$head
7070

7171
return $false
7272
}
73-
elseif ($statusCode -lt 400 -and $statusCode -gt 200) {
74-
$url = $response.Headers.Location
75-
76-
Write-Host "==> Redirect to $url" -ForegroundColor Magenta
77-
78-
try {
79-
Invoke-WebRequest `
80-
"$url" `
81-
-PassThru `
82-
-OutFile $distTemp `
83-
-UserAgent "Docker-Client/20.10.16 (Windows)" > $null 2>&1
84-
}
85-
catch {
86-
Write-Host $_.Exception
87-
88-
return $false
89-
}
90-
}
9173
elseif ($statusCode -eq 400) {
9274
try {
9375
$response = Invoke-WebRequest `
@@ -110,6 +92,24 @@ function Get-Blob([string]$token, [string]$image, [string]$digest, [string]$head
11092
return $false
11193
}
11294
}
95+
elseif (($statusCode -lt 400 -and $statusCode -gt 200) -or ($statusCode -eq 403)) {
96+
$url = $response.Headers.Location
97+
98+
Write-Host "==> Redirect to $url" -ForegroundColor Magenta
99+
100+
try {
101+
Invoke-WebRequest `
102+
"$url" `
103+
-PassThru `
104+
-OutFile $distTemp `
105+
-UserAgent "Docker-Client/20.10.16 (Windows)" > $null 2>&1
106+
}
107+
catch {
108+
Write-Host $_.Exception
109+
110+
return $false
111+
}
112+
}
113113
else {
114114
Write-Host "==> Get blob failed [ $statusCode ]" -ForegroundColor Red
115115

windows/sdk/dockerhub/manifests/get.psm1

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,10 @@ function Get-Manifest([string]$token, [string]$image, $ref, $header, $registry =
7272
return $false
7373
}
7474

75-
write-host $result.Headers.'RateLimit-Limit'
76-
write-host $result.Headers.'RateLimit-Remaining'
75+
if ($result.Headers.'RateLimit-Limit') {
76+
write-host $result.Headers.'RateLimit-Limit'
77+
write-host $result.Headers.'RateLimit-Remaining'
78+
}
7779

7880
write-host "==> Digest: $($result.Headers.'Docker-Content-Digest')" -ForegroundColor Green
7981

windows/sdk/dockerhub/rootfs.ps1

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env pwsh
22

33
Import-Module $PSScriptRoot/tags/list.psm1
4-
Import-Module $PSScriptRoot/manifests/get.psm1
4+
Import-Module $PSScriptRoot/manifests/get.psm1 -Force
55
Import-Module $PSScriptRoot/blobs/get.psm1 -Force
66
Import-Module $PSScriptRoot/auth/auth.psm1 -Force
77
Import-Module $PSScriptRoot/registry/registry.psm1
@@ -67,7 +67,7 @@ function rootfs([string]$image = "alpine",
6767
$env:DOCKER_ROOTFS_PHASE = "manifest list"
6868
}
6969

70-
if(!$phase){
70+
if (!$phase) {
7171
$env:DOCKER_ROOTFS_PHASE = $null
7272
}
7373

@@ -80,7 +80,12 @@ function rootfs([string]$image = "alpine",
8080
$FormatEnumerationLimit = -1
8181

8282
if (!($image | select-string '/')) {
83-
$image = "library/$image"
83+
if ($env:DOCKER_NAMESPACE_LESS) {
84+
$image = "$image"
85+
}
86+
else {
87+
$image = "library/$image"
88+
}
8489
}
8590

8691
if (!$arch) { $arch = "amd64" }

0 commit comments

Comments
 (0)