diff --git a/lib/kubernetes-deploy/runner_task.rb b/lib/kubernetes-deploy/runner_task.rb index 57ecde636..0b57124ea 100644 --- a/lib/kubernetes-deploy/runner_task.rb +++ b/lib/kubernetes-deploy/runner_task.rb @@ -164,7 +164,9 @@ def build_pod_definition(base_template) def set_container_overrides!(pod_definition, entrypoint, args, env_vars) container = pod_definition.spec.containers.find { |cont| cont.name == 'task-runner' } if container.nil? - raise TaskConfigurationError, "Pod spec does not contain a template container called 'task-runner'" + message = "Pod spec does not contain a template container called 'task-runner'" + @logger.summary.add_paragraph(message) + raise TaskConfigurationError, message end container.command = entrypoint diff --git a/test/integration/runner_task_test.rb b/test/integration/runner_task_test.rb index 2bde99948..fb9977c92 100644 --- a/test/integration/runner_task_test.rb +++ b/test/integration/runner_task_test.rb @@ -206,6 +206,26 @@ def test_run_with_template_missing end end + def test_run_with_pod_spec_template_missing + deploy_task_template do |fixtures| + template = fixtures["template-runner.yml"]["PodTemplate"].first["template"] + template["spec"]["containers"].first["name"] = "bad-name" + end + + task_runner = build_task_runner + assert_task_run_failure(task_runner.run(run_params)) + message = "Pod spec does not contain a template container called 'task-runner'" + + assert_raises_message(KubernetesDeploy::RunnerTask::TaskConfigurationError, message) do + task_runner.run!(run_params) + end + + assert_logs_match_all([ + "Result: FAILURE", + message + ], in_order: true) + end + def test_run_adds_env_vars_provided_to_the_task_container deploy_task_template