Commit 2f96e5d3 authored by Thong Kuah's avatar Thong Kuah

Populate cluster_id when creating a deployment

parent 525edec7
......@@ -18,6 +18,7 @@ module Deployable
return unless environment.persisted?
create_deployment!(
cluster_id: environment.deployment_platform&.cluster_id,
project_id: environment.project_id,
environment: environment,
ref: ref,
......
---
title: Persist the cluster a deployment was deployed to
merge_request: 29960
author:
type: fixed
......@@ -7,10 +7,6 @@ describe Deployable do
let(:deployment) { job.deployment }
let(:environment) { deployment&.environment }
before do
job.reload
end
context 'when the deployable object will deploy to production' do
let!(:job) { create(:ci_build, :start_review_app) }
......@@ -26,6 +22,16 @@ describe Deployable do
end
end
context 'when the deployable object will deploy to a cluster' do
let(:project) { create(:project) }
let!(:cluster) { create(:cluster, :provided_by_user, projects: [project]) }
let!(:job) { create(:ci_build, :start_review_app, project: project) }
it 'creates a deployment with cluster association' do
expect(deployment.cluster).to eq(cluster)
end
end
context 'when the deployable object will stop an environment' do
let!(:job) { create(:ci_build, :stop_review_app) }
......
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