Skip to content

Commit

Permalink
update cache_files_list to list file only for specific test_suit_id
Browse files Browse the repository at this point in the history
  • Loading branch information
EdwinPhilip committed Mar 11, 2024
1 parent 868b6d9 commit f1eb6aa
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/rspec_tracer/remote_cache/aws.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ class AwsError < StandardError; end
def initialize
@s3_bucket, @s3_path = setup_s3
@aws_cli = RSpecTracer.use_local_aws ? 'awslocal' : 'aws'
@use_test_suite_id_cache = ENV['USE_TEST_SUITE_ID_CACHE'] == 'true'
@test_suite_id = ENV['TEST_SUITE_ID'] if @use_test_suite_id_cache
end

def branch_refs?(branch_name)
Expand Down Expand Up @@ -60,7 +62,11 @@ def upload_branch_refs(branch_name, file_name)
end

def cache_files_list(ref)
prefix = "s3://#{@s3_bucket}/#{@s3_path}/#{ref}/"
if @use_test_suite_id_cache && !@test_suite_id.nil?
prefix = "s3://#{@s3_bucket}/#{@s3_path}/#{ref}/#{@test_suite_id}/"
else
prefix = "s3://#{@s3_bucket}/#{@s3_path}/#{ref}/"
end

`#{@aws_cli} s3 ls #{prefix} --recursive`.chomp.split("\n")
end
Expand Down

0 comments on commit f1eb6aa

Please sign in to comment.