Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion internal/server/dashboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ func getRegistryConfigs(baseURL string) []RegistryConfig {
if strings.HasPrefix(strings.ToLower(baseURL), "http://") {
swiftInsecureFlag = "--allow-insecure-http "
}
dockerHost := strings.TrimPrefix(strings.TrimPrefix(baseURL, "https://"), "http://")

return []RegistryConfig{
{
Expand Down Expand Up @@ -433,7 +434,7 @@ using Pkg; Pkg.update()</code></pre>`),
sudo systemctl restart docker

# Or pull directly
docker pull ` + baseURL[8:] + `/library/nginx:latest</code></pre>`),
docker pull ` + dockerHost + `/library/nginx:latest</code></pre>`),
},
{
ID: "deb",
Expand Down
15 changes: 15 additions & 0 deletions internal/server/templates_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,21 @@ func TestEcosystemBadgeLabel(t *testing.T) {
}
}

func TestOCIRegistryInstructionsDockerPull(t *testing.T) {
registries := getRegistryConfigs("http://package-proxy:8080")
for _, registry := range registries {
if registry.ID != "oci" {
continue
}
want := "docker pull package-proxy:8080/library/nginx:latest"
if !strings.Contains(string(registry.Instructions), want) {
t.Errorf("OCI instructions = %q, want substring %q", registry.Instructions, want)
}
return
}
t.Fatal("OCI registry instructions not found")
}

func TestSwiftRegistryInstructionsAllowLocalHTTP(t *testing.T) {
registries := getRegistryConfigs("http://localhost:8080")
for _, registry := range registries {
Expand Down
Loading