From 4ee2ae14f5bb4349ac4a42388321f49786501484 Mon Sep 17 00:00:00 2001 From: Steve Azzopardi Date: Tue, 21 Aug 2018 14:47:55 +0200 Subject: Add artifact information for job controller gitlab-org/gitlab-ce#50101 --- app/serializers/build_details_entity.rb | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'app/serializers/build_details_entity.rb') 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) -- cgit v1.2.1