Commit de3c878d authored by Imre Farkas's avatar Imre Farkas

Merge branch '323709-add-package-file-sha-to-api' into 'master'

Add missing file shas to package file API

See merge request gitlab-org/gitlab!60631
parents 08344e29 2bd10563
---
title: Add sha256 to package file API payload
merge_request: 60631
author:
type: changed
...@@ -287,6 +287,7 @@ Example response: ...@@ -287,6 +287,7 @@ Example response:
"size": 2421, "size": 2421,
"file_md5": "58e6a45a629910c6ff99145a688971ac", "file_md5": "58e6a45a629910c6ff99145a688971ac",
"file_sha1": "ebd193463d3915d7e22219f52740056dfd26cbfe", "file_sha1": "ebd193463d3915d7e22219f52740056dfd26cbfe",
"file_sha256": "a903393463d3915d7e22219f52740056dfd26cbfeff321b",
"pipelines": [ "pipelines": [
{ {
"id": 123, "id": 123,
...@@ -310,7 +311,8 @@ Example response: ...@@ -310,7 +311,8 @@ Example response:
"file_name": "my-app-1.5-20181107.152550-1.pom", "file_name": "my-app-1.5-20181107.152550-1.pom",
"size": 1122, "size": 1122,
"file_md5": "d90f11d851e17c5513586b4a7e98f1b2", "file_md5": "d90f11d851e17c5513586b4a7e98f1b2",
"file_sha1": "9608d068fe88aff85781811a42f32d97feb440b5" "file_sha1": "9608d068fe88aff85781811a42f32d97feb440b5",
"file_sha256": "2987d068fe88aff85781811a42f32d97feb4f092a399"
}, },
{ {
"id": 27, "id": 27,
...@@ -319,7 +321,8 @@ Example response: ...@@ -319,7 +321,8 @@ Example response:
"file_name": "maven-metadata.xml", "file_name": "maven-metadata.xml",
"size": 767, "size": 767,
"file_md5": "6dfd0cce1203145a927fef5e3a1c650c", "file_md5": "6dfd0cce1203145a927fef5e3a1c650c",
"file_sha1": "d25932de56052d320a8ac156f745ece73f6a8cd2" "file_sha1": "d25932de56052d320a8ac156f745ece73f6a8cd2",
"file_sha256": "ac849d002e56052d320a8ac156f745ece73f6a8cd2f3e82"
} }
] ]
``` ```
......
...@@ -5,7 +5,7 @@ module API ...@@ -5,7 +5,7 @@ module API
class PackageFile < Grape::Entity class PackageFile < Grape::Entity
expose :id, :package_id, :created_at expose :id, :package_id, :created_at
expose :file_name, :size expose :file_name, :size
expose :file_md5, :file_sha1 expose :file_md5, :file_sha1, :file_sha256
expose :pipelines, if: ->(package_file) { package_file.pipelines.present? }, using: Package::Pipeline expose :pipelines, if: ->(package_file) { package_file.pipelines.present? }, using: Package::Pipeline
end end
end end
......
...@@ -205,6 +205,8 @@ FactoryBot.define do ...@@ -205,6 +205,8 @@ FactoryBot.define do
file_fixture { 'spec/fixtures/packages/maven/my-app-1.0-20180724.124855-1.jar' } file_fixture { 'spec/fixtures/packages/maven/my-app-1.0-20180724.124855-1.jar' }
file_name { 'my-app-1.0-20180724.124855-1.jar' } file_name { 'my-app-1.0-20180724.124855-1.jar' }
file_sha1 { '4f0bfa298744d505383fbb57c554d4f5c12d88b3' } file_sha1 { '4f0bfa298744d505383fbb57c554d4f5c12d88b3' }
file_md5 { '0a7392d24f42f83068fa3767c5310052' }
file_sha256 { '440e5e148a25331bbd7991575f7d54933c0ebf6cc735a18ee5066ac1381bb590' }
size { 100.kilobytes } size { 100.kilobytes }
end end
...@@ -212,6 +214,8 @@ FactoryBot.define do ...@@ -212,6 +214,8 @@ FactoryBot.define do
file_fixture { 'spec/fixtures/packages/maven/my-app-1.0-20180724.124855-1.pom' } file_fixture { 'spec/fixtures/packages/maven/my-app-1.0-20180724.124855-1.pom' }
file_name { 'my-app-1.0-20180724.124855-1.pom' } file_name { 'my-app-1.0-20180724.124855-1.pom' }
file_sha1 { '19c975abd49e5102ca6c74a619f21e0cf0351c57' } file_sha1 { '19c975abd49e5102ca6c74a619f21e0cf0351c57' }
file_md5 { '0a7392d24f42f83068fa3767c5310052' }
file_sha256 { '440e5e148a25331bbd7991575f7d54933c0ebf6cc735a18ee5066ac1381bb590' }
size { 200.kilobytes } size { 200.kilobytes }
end end
...@@ -219,6 +223,8 @@ FactoryBot.define do ...@@ -219,6 +223,8 @@ FactoryBot.define do
file_fixture { 'spec/fixtures/packages/maven/maven-metadata.xml' } file_fixture { 'spec/fixtures/packages/maven/maven-metadata.xml' }
file_name { 'maven-metadata.xml' } file_name { 'maven-metadata.xml' }
file_sha1 { '42b1bdc80de64953b6876f5a8c644f20204011b0' } file_sha1 { '42b1bdc80de64953b6876f5a8c644f20204011b0' }
file_md5 { '0a7392d24f42f83068fa3767c5310052' }
file_sha256 { '440e5e148a25331bbd7991575f7d54933c0ebf6cc735a18ee5066ac1381bb590' }
size { 300.kilobytes } size { 300.kilobytes }
end end
......
...@@ -8,6 +8,8 @@ ...@@ -8,6 +8,8 @@
"package_id": { "type": "integer" }, "package_id": { "type": "integer" },
"file_name": { "type": "string" }, "file_name": { "type": "string" },
"file_sha1": { "type": "string" }, "file_sha1": { "type": "string" },
"file_sha256": { "type": "string" },
"file_md5": { "type": "string" },
"pipelines": { "pipelines": {
"items": { "$ref": "../pipeline.json" } "items": { "$ref": "../pipeline.json" }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment