Skip to content
Snippets Groups Projects
Commit 41f41911 authored by Kamil Trzcińśki's avatar Kamil Trzcińśki
Browse files

Remove save_yaml_error from config_processor and don't create Ci::Commit if no builds were created

parent ba81c912
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -131,10 +131,10 @@ module Ci
@config_processor ||= begin
Ci::GitlabCiYamlProcessor.new(ci_yaml_file, project.path_with_namespace)
rescue Ci::GitlabCiYamlProcessor::ValidationError, Psych::SyntaxError => e
save_yaml_error(e.message)
self.yaml_errors = e.message
nil
rescue
save_yaml_error("Undefined error")
self.yaml_errors = "Undefined error"
nil
end
end
Loading
Loading
@@ -169,11 +169,5 @@ module Ci
self.duration = statuses.latest.duration
save
end
def save_yaml_error(error)
return if self.yaml_errors?
self.yaml_errors = error
update_state
end
end
end
Loading
Loading
@@ -18,22 +18,19 @@ module Ci
return pipeline
end
 
begin
Ci::Commit.transaction do
pipeline.sha = commit.id
unless pipeline.config_processor
pipeline.errors.add(:base, pipeline.yaml_errors || 'Missing .gitlab-ci.yml file')
raise ActiveRecord::Rollback
end
pipeline.save!
pipeline.create_builds(current_user)
end
rescue
pipeline.errors.add(:base, 'The pipeline could not be created. Please try again.')
unless pipeline.config_processor
pipeline.errors.add(:base, pipeline.yaml_errors || 'Missing .gitlab-ci.yml file')
return pipeline
end
pipeline.sha = commit.id
unless pipeline.create_builds(current_user)
pipeline.errors.add(:base, 'No builds created')
return pipeline
end
 
pipeline.touch
pipeline
end
 
Loading
Loading
module Ci
class ImageForBuildService
def execute(project, opts)
# sha - commit sha
# ref - commit reference
sha = opts[:sha] || ref_sha(project, opts[:ref])
 
ci_commits = project.ci_commits.where(sha: sha)
Loading
Loading
Loading
Loading
@@ -25,13 +25,12 @@ class CreateCommitBuildsService
return false
end
 
# Create a new ci_commit
commit.save!
# Skip creating builds for commits that have [ci skip]
unless commit.skip_ci?
# Create builds for commit
commit.create_builds(user)
unless commit.create_builds(user)
return false
end
end
 
commit.touch
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment