diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-06-14 13:44:03 +0200 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-06-14 13:44:03 +0200 |
commit | ab9a8643d80c178d4d16c15f4f72deb65210074c (patch) | |
tree | 9c0ff13c7aaaac4624389a640c1a5d45a40358bb /app/services/ci | |
parent | d8c4556d3c8623bf48e689f3734c9c35cda34c2f (diff) | |
parent | 066020fcd015ca92397b794342a49a46dd02582c (diff) | |
download | gitlab-ce-ab9a8643d80c178d4d16c15f4f72deb65210074c.tar.gz |
Merge branch 'master' into fix/status-of-pipeline-without-builds
* master: (538 commits)
Fix broken URI joining for `teamcity_url` with suffixes
Factorize duplicated code into a method in BambooService and update specs
Fix broken URI joining for `bamboo_url` with suffixes
Honor credentials on calling Bamboo CI trigger
Update CHANGELOG
Use Issue.visible_to_user in Notes.search to avoid query duplication
Project members with guest role can't access confidential issues
Allow users to create confidential issues in private projects
Update CHANGELOG
Remove deprecated issues_tracker and issues_tracker_id from project
Schema doesn’t reflect the changes of the last 3 migrations
Apply reviewer notes: update CHANGELOG, adjust code formatting
Move issue rendering tests into separate contexts
Move change description to proper release and fix typo
Add more information into RSS fead for issues
Revert CHANGELOG
Also rename "find" in the specs
Change to new Notes styleguide
Add guide on changing a document's location
Change logs.md location in README
...
Conflicts:
app/services/ci/create_builds_service.rb
app/services/ci/create_pipeline_service.rb
app/services/create_commit_builds_service.rb
spec/models/ci/commit_spec.rb
spec/services/ci/create_builds_service_spec.rb
spec/services/create_commit_builds_service_spec.rb
Diffstat (limited to 'app/services/ci')
-rw-r--r-- | app/services/ci/create_builds_service.rb | 26 | ||||
-rw-r--r-- | app/services/ci/create_pipeline_service.rb | 2 | ||||
-rw-r--r-- | app/services/ci/create_trigger_request_service.rb | 6 | ||||
-rw-r--r-- | app/services/ci/image_for_build_service.rb | 6 |
4 files changed, 20 insertions, 20 deletions
diff --git a/app/services/ci/create_builds_service.rb b/app/services/ci/create_builds_service.rb index f458dee49a6..f7f73aff989 100644 --- a/app/services/ci/create_builds_service.rb +++ b/app/services/ci/create_builds_service.rb @@ -1,12 +1,12 @@ module Ci class CreateBuildsService - def initialize(commit) - @commit = commit - @config = commit.config_processor + def initialize(pipeline) + @pipeline = pipeline + @config = pipeline.config_processor end def execute(stage, user, status, trigger_request = nil) - builds_attrs = @config.builds_for_stage_and_ref(stage, @commit.ref, @commit.tag, trigger_request) + builds_attrs = @config.builds_for_stage_and_ref(stage, @pipeline.ref, @pipeline.tag, trigger_request) # check when to create next build builds_attrs = builds_attrs.select do |build_attrs| @@ -22,9 +22,9 @@ module Ci # don't create the same build twice builds_attrs.reject! do |build_attrs| - @commit.builds.find_by(ref: @commit.ref, tag: @commit.tag, - trigger_request: trigger_request, - name: build_attrs[:name]) + @pipeline.builds.find_by(ref: @pipeline.ref, tag: @pipeline.tag, + trigger_request: trigger_request, + name: build_attrs[:name]) end builds_attrs.map do |build_attrs| @@ -36,18 +36,18 @@ module Ci :stage, :stage_idx) - build_attrs.merge!(commit: @commit, - ref: @commit.ref, - tag: @commit.tag, + build_attrs.merge!(pipeline: @pipeline, + ref: @pipeline.ref, + tag: @pipeline.tag, trigger_request: trigger_request, user: user, - project: @commit.project) + project: @pipeline.project) ## # We do not persist new builds here. - # Those will be persisted when @commit is saved. + # Those will be persisted when @pipeline is saved. # - @commit.builds.new(build_attrs) + @pipeline.builds.new(build_attrs) end end end diff --git a/app/services/ci/create_pipeline_service.rb b/app/services/ci/create_pipeline_service.rb index 864415ef747..b1ee6874190 100644 --- a/app/services/ci/create_pipeline_service.rb +++ b/app/services/ci/create_pipeline_service.rb @@ -1,7 +1,7 @@ module Ci class CreatePipelineService < BaseService def execute - pipeline = project.ci_commits.new(params) + pipeline = project.pipelines.new(params) unless ref_names.include?(params[:ref]) pipeline.errors.add(:base, 'Reference not found') diff --git a/app/services/ci/create_trigger_request_service.rb b/app/services/ci/create_trigger_request_service.rb index 993acf11db9..1e629cf119a 100644 --- a/app/services/ci/create_trigger_request_service.rb +++ b/app/services/ci/create_trigger_request_service.rb @@ -7,14 +7,14 @@ module Ci # check if ref is tag tag = project.repository.find_tag(ref).present? - ci_commit = project.ci_commits.create(sha: commit.sha, ref: ref, tag: tag) + pipeline = project.pipelines.create(sha: commit.sha, ref: ref, tag: tag) trigger_request = trigger.trigger_requests.create!( variables: variables, - commit: ci_commit, + pipeline: pipeline, ) - if ci_commit.create_builds(nil, trigger_request) + if pipeline.create_builds(nil, trigger_request) trigger_request end end diff --git a/app/services/ci/image_for_build_service.rb b/app/services/ci/image_for_build_service.rb index 3018f27ec05..75d847d5bee 100644 --- a/app/services/ci/image_for_build_service.rb +++ b/app/services/ci/image_for_build_service.rb @@ -3,9 +3,9 @@ module Ci def execute(project, opts) sha = opts[:sha] || ref_sha(project, opts[:ref]) - ci_commits = project.ci_commits.where(sha: sha) - ci_commits = ci_commits.where(ref: opts[:ref]) if opts[:ref] - image_name = image_for_status(ci_commits.status) + pipelines = project.pipelines.where(sha: sha) + pipelines = pipelines.where(ref: opts[:ref]) if opts[:ref] + image_name = image_for_status(pipelines.status) image_path = Rails.root.join('public/ci', image_name) OpenStruct.new(path: image_path, name: image_name) |