Skip to content

Commit

Permalink
Stash buildspec in S3 Asset bucket when not team account
Browse files Browse the repository at this point in the history
  • Loading branch information
skmcgrail committed Apr 25, 2023
1 parent cab2212 commit c09e6f9
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions tests/ci/cdk/util/build_spec_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from aws_cdk import aws_codebuild as codebuild, aws_s3_assets
from util.metadata import CAN_AUTOLOAD, TEAM_ACCOUNT, AWS_ACCOUNT, DEFAULT_REGION, AWS_REGION
import yaml
import tempfile


class BuildSpecLoader(object):
Expand All @@ -27,9 +27,10 @@ def load(file_path):
TEAM_ACCOUNT: AWS_ACCOUNT,
DEFAULT_REGION: AWS_REGION,
}
with open(file_path) as file:
file_text = file.read()
with open(file_path) as original_file:
file_text = original_file.read()
for key in placeholder_map.keys():
file_text = file_text.replace(key, placeholder_map[key])
build_spec_content = yaml.safe_load(file_text)
return codebuild.BuildSpec.from_object(build_spec_content)
with tempfile.NamedTemporaryFile(mode='w+', delete=False) as temp_file:
temp_file.write(file_text)
return codebuild.BuildSpec.from_asset(temp_file.name)

0 comments on commit c09e6f9

Please sign in to comment.