summaryrefslogtreecommitdiff
path: root/lib/api/projects.rb
diff options
context:
space:
mode:
authorMichel Courtine <michaK@ivoltage.me>2015-02-12 09:56:55 +0100
committerMichel Courtine <michaK@ivoltage.me>2015-02-12 09:56:55 +0100
commit76256521e42df08cb7ecbd22bcde55c11a97290f (patch)
tree373dce82ec708fed88946d9ccc3b25868457383e /lib/api/projects.rb
parent02a1d95fb2503106443feaea82a20ac472c40ecf (diff)
downloadgitlab-ci-76256521e42df08cb7ecbd22bcde55c11a97290f.tar.gz
project jobs api: exposed active, build_branches, build_tags, tags. Implemented tests and updated documentation
Diffstat (limited to 'lib/api/projects.rb')
-rw-r--r--lib/api/projects.rb17
1 files changed, 15 insertions, 2 deletions
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