BigW Consortium Gitlab

Commit 8979567e by Z.J. van de Weg Committed by blackst0ne

Use deployment IID when saving refs

parent 25d00ea8
...@@ -102,6 +102,6 @@ class Deployment < ActiveRecord::Base ...@@ -102,6 +102,6 @@ class Deployment < ActiveRecord::Base
private private
def ref_path def ref_path
File.join(environment.ref_path, 'deployments', id.to_s) File.join(environment.ref_path, 'deployments', iid.to_s)
end end
end end
...@@ -71,8 +71,8 @@ class Environment < ActiveRecord::Base ...@@ -71,8 +71,8 @@ class Environment < ActiveRecord::Base
return nil unless ref return nil unless ref
deployment_id = ref.split('/').last deployment_iid = ref.split('/').last
deployments.find(deployment_id) deployments.find_by(iid: deployment_iid)
end end
def ref_path def ref_path
......
...@@ -913,7 +913,7 @@ describe Projects::MergeRequestsController do ...@@ -913,7 +913,7 @@ describe Projects::MergeRequestsController do
end end
describe 'GET ci_environments_status' do describe 'GET ci_environments_status' do
context 'when the environment is from a forked project' do context 'the environment is from a forked project' do
let!(:forked) { create(:project) } let!(:forked) { create(:project) }
let!(:environment) { create(:environment, project: forked) } let!(:environment) { create(:environment, project: forked) }
let!(:deployment) { create(:deployment, environment: environment, sha: forked.commit.id, ref: 'master') } let!(:deployment) { create(:deployment, environment: environment, sha: forked.commit.id, ref: 'master') }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment