diff options
author | Steve Azzopardi <steveazz@outlook.com> | 2018-09-04 09:51:00 +0200 |
---|---|---|
committer | Steve Azzopardi <steveazz@outlook.com> | 2018-09-12 11:00:39 +0200 |
commit | 1b388c798b01d950ad8692e34938a2a457c6ad0f (patch) | |
tree | 96471170bf1da744b6c043212a78c09df768a17d /app/serializers | |
parent | f87809f78de9da04f38134ba5ce0cf9ddebf2f63 (diff) | |
download | gitlab-ce-1b388c798b01d950ad8692e34938a2a457c6ad0f.tar.gz |
Add trigger information for job API
Create new entity called TriggerVariablesEnitity for trigger variables,
to aid reuseablity in the future.
Update JSON schema to include trigger information in the response.
Refactor rspec tests a bit to reduce duplication and for the `context`
to make sense.
closes https://gitlab.com/gitlab-org/gitlab-ce/issues/50989
Diffstat (limited to 'app/serializers')
-rw-r--r-- | app/serializers/build_details_entity.rb | 6 | ||||
-rw-r--r-- | app/serializers/trigger_variable_entity.rb | 7 |
2 files changed, 13 insertions, 0 deletions
diff --git a/app/serializers/build_details_entity.rb b/app/serializers/build_details_entity.rb index b107fc26f18..6f8194d9856 100644 --- a/app/serializers/build_details_entity.rb +++ b/app/serializers/build_details_entity.rb @@ -59,6 +59,12 @@ class BuildDetailsEntity < JobEntity raw_project_job_path(project, build) end + expose :trigger, if: -> (*) { build.trigger_request } do + expose :trigger_short_token, as: :short_token + + expose :trigger_variables, as: :variables, using: TriggerVariableEntity + end + private def build_failed_issue_options diff --git a/app/serializers/trigger_variable_entity.rb b/app/serializers/trigger_variable_entity.rb new file mode 100644 index 00000000000..56203113631 --- /dev/null +++ b/app/serializers/trigger_variable_entity.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +class TriggerVariableEntity < Grape::Entity + include RequestAwareEntity + + expose :key, :value, :public +end |