Skip to content

Commit

Permalink
Fix detection of http pull urls
Browse files Browse the repository at this point in the history
  • Loading branch information
WanzenBug committed Jul 6, 2021
1 parent 51800fb commit 3d286e6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ sync-images:
- if: $CI_PIPELINE_SOURCE == "schedule"
- if: $CI_MERGE_REQUEST_ID
when: manual
allow_failure: true
tags:
- libvirt
script:
Expand All @@ -67,4 +68,3 @@ sync-images:
- ./virter image pull $name $url
- ./virter image push $name ${LINBIT_DOCKER_REGISTRY}/vm/${name}:latest
- done < <(./virter image ls --available | tail -n +2)
- ./virter image pull
4 changes: 3 additions & 1 deletion cmd/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,10 @@ func GetLocalImage(ctx context.Context, imageName string, source string, v *virt
return nil, fmt.Errorf("unknown pull policy %s", policy)
}

isHttpUrl := strings.HasPrefix(source, "http://") || strings.HasPrefix(source, "https://")

parsedRef, err := name.ParseReference(source, name.WithDefaultRegistry(""))
if err != nil || parsedRef.Context().Registry.Name() == "" {
if isHttpUrl || err != nil || parsedRef.Context().Registry.Name() == "" {
log.Tracef("Source %s failed to parse or has no registry location, trying non-registry pull", source)
return pullNonContainerRegistry(ctx, v, localName, source, p)
}
Expand Down

0 comments on commit 3d286e6

Please sign in to comment.