diff options
author | Matija Čupić <matteeyah@gmail.com> | 2018-03-12 01:51:10 +0300 |
---|---|---|
committer | Matija Čupić <matteeyah@gmail.com> | 2018-03-12 01:53:02 +0300 |
commit | 92d361c8d34d3ef29ff546ed1f7b74ce9a8f81f4 (patch) | |
tree | 30ffe667f77dce921ed15feca7bf805b3043165b /app/controllers/projects/pipelines_settings_controller.rb | |
parent | afd2d381119c3778140c3dd63c7ef24ecdb4c62e (diff) |
Add empty repo check before running AutoDevOps pipeline
Diffstat (limited to 'app/controllers/projects/pipelines_settings_controller.rb')
-rw-r--r-- | app/controllers/projects/pipelines_settings_controller.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/app/controllers/projects/pipelines_settings_controller.rb b/app/controllers/projects/pipelines_settings_controller.rb index 06ce7328fb5..6ccefb7e562 100644 --- a/app/controllers/projects/pipelines_settings_controller.rb +++ b/app/controllers/projects/pipelines_settings_controller.rb @@ -11,8 +11,12 @@ class Projects::PipelinesSettingsController < Projects::ApplicationController flash[:notice] = "Pipelines settings for '#{@project.name}' were successfully updated." if service.run_auto_devops_pipeline? - CreatePipelineWorker.perform_async(project.id, current_user.id, project.default_branch, :web, ignore_skip_ci: true, save_on_errors: false) - flash[:success] = "A new Auto DevOps pipeline has been created, go to <a href=\"#{project_pipelines_path(@project)}\">Pipelines page</a> for details".html_safe + if @project.empty_repo? + flash[:warning] = "This repository is currently empty. A new Auto DevOps pipeline will be created after a new file has been pushed to a branch." + else + CreatePipelineWorker.perform_async(project.id, current_user.id, project.default_branch, :web, ignore_skip_ci: true, save_on_errors: false) + flash[:success] = "A new Auto DevOps pipeline has been created, go to <a href=\"#{project_pipelines_path(@project)}\">Pipelines page</a> for details".html_safe + end end redirect_to project_settings_ci_cd_path(@project) |