diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/api/entities.rb | 2 | ||||
-rw-r--r-- | lib/api/projects.rb | 17 |
2 files changed, 16 insertions, 3 deletions
diff --git a/lib/api/entities.rb b/lib/api/entities.rb index bc21e22..8c4b3c1 100644 --- a/lib/api/entities.rb +++ b/lib/api/entities.rb @@ -29,7 +29,7 @@ module API end class Job < Grape::Entity - expose :id, :name, :commands + expose :id, :project_id, :commands, :active, :name, :build_branches, :build_tags, :tags end end end diff --git a/lib/api/projects.rb b/lib/api/projects.rb index 7d94c89..1226a02 100644 --- a/lib/api/projects.rb +++ b/lib/api/projects.rb @@ -40,7 +40,6 @@ module API not_found! if project.blank? unauthorized! unless current_user.can_access_project?(project.gitlab_id) - # present job, with: Entities::Job project.jobs end @@ -50,6 +49,10 @@ module API # id (required) - The ID of a project # name (required) - The job name # commands (required) - The command line script for the job + # active (optional) - The command is active of not + # build_branches (optional) - Trigger commit builds + # build_tags (optional) - Trigger tag builds + # tags (optional) - The tags associated with this job # Example Request # POST /projects/:id/jobs post ":id/jobs" do @@ -60,7 +63,17 @@ module API not_found! if project.blank? unauthorized! unless current_user.can_access_project?(project.gitlab_id) - job_params = { name: params[:name], commands: params[:commands] } + job_params = + { + name: params[:name], + commands: params[:commands], + } + + job_params[:active] = params[:active] unless params[:active].nil? + job_params[:build_branches] = params[:build_branches] unless params[:build_branches].nil? + job_params[:build_tags] = params[:build_tags] unless params[:build_tags].nil? + job_params[:tag_list] = params[:tags] unless params[:tags].nil? + job = project.jobs.new(job_params) if job.save present job, with: Entities::Job |