mirror of
https://github.com/wahyd4/gitlabhq.git
synced 2026-08-10 21:26:07 +10:00
Fix builds API response that did not include commit data ## What does this MR do? This is fix for problem with builds API response not including information about commit this build is created for. ## What are the relevant issue numbers? Closes #18476 ## Does this MR meet the acceptance criteria? - [x] [CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG) entry added - [x] [Documentation created/updated](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/development/doc_styleguide.md) - [x] API support added - Tests - [x] Added for this feature/bug - [x] All builds are passing - [x] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides) - [x] Branch has no merge conflicts with `master` (if you do - rebase it please) - [x] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits) See merge request !4827
60 lines
1.6 KiB
Ruby
60 lines
1.6 KiB
Ruby
class Projects::PipelinesController < Projects::ApplicationController
|
|
before_action :pipeline, except: [:index, :new, :create]
|
|
before_action :commit, only: [:show]
|
|
before_action :authorize_read_pipeline!
|
|
before_action :authorize_create_pipeline!, only: [:new, :create]
|
|
before_action :authorize_update_pipeline!, only: [:retry, :cancel]
|
|
|
|
def index
|
|
@scope = params[:scope]
|
|
all_pipelines = project.pipelines
|
|
@pipelines_count = all_pipelines.count
|
|
@running_or_pending_count = all_pipelines.running_or_pending.count
|
|
@pipelines = PipelinesFinder.new(project).execute(all_pipelines, @scope)
|
|
@pipelines = @pipelines.order(id: :desc).page(params[:page]).per(30)
|
|
end
|
|
|
|
def new
|
|
@pipeline = project.pipelines.new(ref: @project.default_branch)
|
|
end
|
|
|
|
def create
|
|
@pipeline = Ci::CreatePipelineService.new(project, current_user, create_params).execute
|
|
unless @pipeline.persisted?
|
|
render 'new'
|
|
return
|
|
end
|
|
|
|
redirect_to namespace_project_pipeline_path(project.namespace, project, @pipeline)
|
|
end
|
|
|
|
def show
|
|
end
|
|
|
|
def retry
|
|
pipeline.retry_failed(current_user)
|
|
|
|
redirect_back_or_default default: namespace_project_pipelines_path(project.namespace, project)
|
|
end
|
|
|
|
def cancel
|
|
pipeline.cancel_running
|
|
|
|
redirect_back_or_default default: namespace_project_pipelines_path(project.namespace, project)
|
|
end
|
|
|
|
private
|
|
|
|
def create_params
|
|
params.require(:pipeline).permit(:ref)
|
|
end
|
|
|
|
def pipeline
|
|
@pipeline ||= project.pipelines.find_by!(id: params[:id])
|
|
end
|
|
|
|
def commit
|
|
@commit ||= @pipeline.commit
|
|
end
|
|
end
|