summaryrefslogtreecommitdiff
path: root/app/serializers/build_details_entity.rb
diff options
context:
space:
mode:
authorSteve Azzopardi <steveazz@outlook.com>2018-08-21 14:47:55 +0200
committerSteve Azzopardi <steveazz@outlook.com>2018-09-03 18:49:51 +0200
commit4ee2ae14f5bb4349ac4a42388321f49786501484 (patch)
tree64e9376c52b453d96425ed9a3eabb827f5e8bf69 /app/serializers/build_details_entity.rb
parentd79218fcea1fb4a85f4155e0cc3638e17a600249 (diff)
downloadgitlab-ce-4ee2ae14f5bb4349ac4a42388321f49786501484.tar.gz
Add artifact information for job controller
gitlab-org/gitlab-ce#50101
Diffstat (limited to 'app/serializers/build_details_entity.rb')
-rw-r--r--app/serializers/build_details_entity.rb22
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)