From 74669e0b879c643b397574dc730a4d304ab02c3a Mon Sep 17 00:00:00 2001 From: Kevin Green Date: Fri, 17 Jun 2022 16:13:33 -0400 Subject: [PATCH] Use a build specific workdir so there's no conflict between runs (#1) --- lib/test_summary_buildkite_plugin/input.rb | 6 +++++- lib/test_summary_buildkite_plugin/runner.rb | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/test_summary_buildkite_plugin/input.rb b/lib/test_summary_buildkite_plugin/input.rb index b92ea73..fe1abbd 100644 --- a/lib/test_summary_buildkite_plugin/input.rb +++ b/lib/test_summary_buildkite_plugin/input.rb @@ -6,7 +6,7 @@ module TestSummaryBuildkitePlugin module Input - WORKDIR = 'tmp/test-summary' + WORKDIR = "/tmp/test-summary/#{ENV['BUILDKITE_BUILD_ID']}" DEFAULT_JOB_ID_REGEX = /(?[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})/ def self.create(type:, **options) @@ -15,6 +15,10 @@ def self.create(type:, **options) TYPES[type].new(options) end + def self.clean_up + FileUtils.rm_rf(WORKDIR) + end + class Base attr_reader :label, :artifact_path, :options diff --git a/lib/test_summary_buildkite_plugin/runner.rb b/lib/test_summary_buildkite_plugin/runner.rb index dbac504..c98a3b5 100644 --- a/lib/test_summary_buildkite_plugin/runner.rb +++ b/lib/test_summary_buildkite_plugin/runner.rb @@ -22,6 +22,8 @@ def run else annotate(markdown) end + + Input.clean_up end def annotate(markdown)