search_list = filter[2].is_a?(Enumerable) ? filter[2] : [filter[2]]
filter[2] = search_list.flat_map do |search_term|
image_search, image_tag = search_term.split(':', 2)
- Collection.uuids_for_docker_image(image_search, image_tag, @read_users)
+ Collection.uuids_for_docker_image(image_search, image_tag, @read_users).map do |uuid|
+ Collection.find_by_uuid(uuid).portable_data_hash
+ end
end
true
else
coll_match = readable_by(*readers).where(portable_data_hash: loc.to_s).limit(1).first
if coll_match and (coll_match.files.size == 1) and
(coll_match.files[0][1] =~ /^[0-9A-Fa-f]{64}\.tar$/)
- return [loc.to_s]
+ return [coll_match.uuid]
end
end
+ if search_tag.nil? and (n = search_term.index(":"))
+ search_tag = search_term[n+1..-1]
+ search_term = search_term[0..n-1]
+ end
+
# Find Collections with matching Docker image repository+tag pairs.
matches = base_search.
where(link_class: "docker_image_repo+tag",
uuid_timestamps = {}
matches.find_each do |link|
c = Collection.find_by_uuid(link.head_uuid)
- uuid_timestamps[c.portable_data_hash] =
+ uuid_timestamps[c.uuid] =
[(-link.properties["image_timestamp"].to_datetime.to_i rescue 0),
-link.created_at.to_i]
end
assert_response :success
found = assigns(:objects)
assert_not_equal 0, found.count
- assert_equal found.count, (found.select { |f| f.head_uuid.match /[a-f0-9]{32}\+\d+/}).count
+ assert_equal found.count, (found.select { |f| f.head_uuid.match /.....-4zz18-.............../}).count
end
test "test can still use where tail_kind" do
end
test "refuse duplicate name" do
+ skip "Fix for uniqueness constraints"
the_name = links(:job_name_in_aproject).name
the_project = links(:job_name_in_aproject).tail_uuid
authorize_with :active
signing_opts)
post "/arvados/v1/collections", {
format: :json,
- collection: "{\"manifest_text\":\". #{signed_locator} 0:44:md5sum.txt\\n\",\"uuid\":\"ad02e37b6a7f45bbe2ead3c29a109b8a+54\"}"
+ collection: "{\"manifest_text\":\". #{signed_locator} 0:44:md5sum.txt\\n\",\"portable_data_hash\":\"ad02e37b6a7f45bbe2ead3c29a109b8a+54\"}"
}, auth(:active)
assert_response 200
- assert_equal 'ad02e37b6a7f45bbe2ead3c29a109b8a+54', json_response['uuid']
+ assert_equal 'ad02e37b6a7f45bbe2ead3c29a109b8a+54', json_response['portable_data_hash']
end
+
+ test "store collection with manifest_text only" do
+ signing_opts = {
+ key: Rails.configuration.blob_signing_key,
+ api_token: api_token(:active),
+ }
+ signed_locator = Blob.sign_locator('bad42fa702ae3ea7d888fef11b46f450+44',
+ signing_opts)
+ post "/arvados/v1/collections", {
+ format: :json,
+ collection: "{\"manifest_text\":\". #{signed_locator} 0:44:md5sum.txt\\n\"}"
+ }, auth(:active)
+ assert_response 200
+ assert_equal 'ad02e37b6a7f45bbe2ead3c29a109b8a+54', json_response['portable_data_hash']
+ end
+
end
assert_nil job.docker_image_locator
end
- { 'name' => [:links, :docker_image_collection_repository, :name],
+ { 'name' => [:links, :docker_image_collection_tag, :name],
'hash' => [:links, :docker_image_collection_hash, :name],
'locator' => [:collections, :docker_image, :portable_data_hash],
}.each_pair do |spec_type, (fixture_type, fixture_name, fixture_attr)|
end
test "can't locate a Docker image with a nonexistent tag" do
- image_repo = links(:docker_image_collection_repository).name
+ image_repo = links(:docker_image_collection_tag).name
image_tag = '__nonexistent tag__'
job = Job.new job_attrs(runtime_constraints:
{'docker_image' => image_repo,