Project

General

Profile

Revision f6a9acbd

Added by Sebastian Gräßl over 5 years ago

Fixes #18518 - Add proper validation for container image

For now the image has only been validate via the result
of the search, but not enforced on the server side.

The model validation brings now proper feedback when
the form has been submitted to the server.

View differences:

app/models/service/registry_api.rb
59 59
      get('/v2/'.freeze).is_a? Hash
60 60
    end
61 61

  
62
    def ok?
63
      get('/v1/').match("Docker Registry API")
64
    rescue
65
      get('/v2/').is_a? Hash
66
    end
67

  
68 62
    def self.docker_hub
69 63
      @@docker_hub ||= new(url: DOCKER_HUB)
70 64
    end
......
87 81

  
88 82
    def tags_v2(image_name)
89 83
      get("/v2/#{image_name}/tags/list")['tags'].map { |tag| { 'name' => tag } }
84
    rescue Docker::Error::NotFoundError
85
      []
90 86
    end
91 87

  
92 88
    def credentials

Also available in: Unified diff