diff options
author | Kamil Trzciński <ayufan@ayufan.eu> | 2018-09-04 08:08:43 +0000 |
---|---|---|
committer | Kamil Trzciński <ayufan@ayufan.eu> | 2018-09-04 08:08:43 +0000 |
commit | 05ee94beb70a2969b85563a0c41bf5afe48a3699 (patch) | |
tree | 5a575fa48d6e39633272602f50ab9b33977e9f7d /app | |
parent | 8ff02cf7c43b7f7a2f5ca46aa678cfce67eab39b (diff) | |
parent | 71433c5525c68bbf25f171e760e3817af7f217d4 (diff) | |
download | gitlab-ce-05ee94beb70a2969b85563a0c41bf5afe48a3699.tar.gz |
Merge branch '50101-add-artifact-information-to-job-api' into 'master'
Add artifact information in job API
See merge request gitlab-org/gitlab-ce!21328
Diffstat (limited to 'app')
-rw-r--r-- | app/serializers/build_details_entity.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/app/serializers/build_details_entity.rb b/app/serializers/build_details_entity.rb index b887b99d31c..271ff668eda 100644 --- a/app/serializers/build_details_entity.rb +++ b/app/serializers/build_details_entity.rb @@ -9,6 +9,28 @@ class BuildDetailsEntity < JobEntity expose :metadata, using: BuildMetadataEntity + expose :artifact, if: -> (*) { can?(current_user, :read_build, build) } do + expose :download_path, if: -> (*) { build.artifacts? } do |build| + download_project_job_artifacts_path(project, build) + end + + expose :browse_path, if: -> (*) { build.browsable_artifacts? } do |build| + browse_project_job_artifacts_path(project, build) + end + + expose :keep_path, if: -> (*) { build.has_expiring_artifacts? && can?(current_user, :update_build, build) } do |build| + keep_project_job_artifacts_path(project, build) + end + + expose :expire_at, if: -> (*) { build.artifacts_expire_at.present? } do |build| + build.artifacts_expire_at + end + + expose :expired, if: -> (*) { build.artifacts_expire_at.present? } do |build| + build.artifacts_expired? + end + end + expose :erased_by, if: -> (*) { build.erased? }, using: UserEntity expose :erase_path, if: -> (*) { build.erasable? && can?(current_user, :erase_build, build) } do |build| erase_project_job_path(project, build) |