From 4968f226a0730de12c5f50b23e8e08360d906c3d Mon Sep 17 00:00:00 2001 From: Lin Jen-Shin Date: Fri, 2 Jun 2017 21:00:56 +0800 Subject: [PATCH] Make sure that environment was created before deploying --- db/fixtures/development/14_pipelines.rb | 4 ++++ spec/support/cycle_analytics_helpers.rb | 2 ++ 2 files changed, 6 insertions(+) diff --git a/db/fixtures/development/14_pipelines.rb b/db/fixtures/development/14_pipelines.rb index 68767f0e585..5de5339b70e 100644 --- a/db/fixtures/development/14_pipelines.rb +++ b/db/fixtures/development/14_pipelines.rb @@ -112,6 +112,10 @@ class Gitlab::Seeder::Pipelines setup_artifacts(build) setup_build_log(build) + + build.project.environments. + find_or_create_by(name: build.expanded_environment_name) + build.save end end diff --git a/spec/support/cycle_analytics_helpers.rb b/spec/support/cycle_analytics_helpers.rb index 7317ce6b907..6e1eb5c678d 100644 --- a/spec/support/cycle_analytics_helpers.rb +++ b/spec/support/cycle_analytics_helpers.rb @@ -78,6 +78,8 @@ module CycleAnalyticsHelpers end def new_dummy_job(environment) + project.environments.find_or_create_by(name: environment) + Ci::Build.new( project: project, user: user,