File tree Expand file tree Collapse file tree 5 files changed +37
-15
lines changed Expand file tree Collapse file tree 5 files changed +37
-15
lines changed Original file line number Diff line number Diff line change @@ -98,16 +98,6 @@ phases:
9898 --amend ${PUBLIC_REGISTRY}/ecs-files-composer:${VERSION}-amd64 \
9999 --amend ${PUBLIC_REGISTRY}/ecs-files-composer:${VERSION}-arm64v8;
100100 docker manifest push ${PUBLIC_REGISTRY}/ecs-files-composer:latest;
101-
102- docker manifest create ${AWS_MARKET_REGISTRY}/ecs-files-composer:latest \
103- --amend ${AWS_MARKET_REGISTRY}/files-composer:${VERSION}-amd64 \
104- --amend ${AWS_MARKET_REGISTRY}/files-composer:${VERSION}-arm64v8;
105- docker manifest push ${AWS_MARKET_REGISTRY}/files-composer:latest;
106-
107- docker manifest create ${AWS_MARKET_REGISTRY}/ecs-files-composer:latest \
108- --amend ${AWS_MARKET_REGISTRY}/ecs-files-composer:${VERSION}-amd64 \
109- --amend ${AWS_MARKET_REGISTRY}/ecs-files-composer:${VERSION}-arm64v8;
110- docker manifest push ${AWS_MARKET_REGISTRY}/ecs-files-composer:latest;
111101 fi
112102
113103 finally :
Original file line number Diff line number Diff line change @@ -79,11 +79,12 @@ def init_config(
7979 return config
8080
8181
82- def start_jobs (config ):
82+ def start_jobs (config , override_session = None ):
8383 """
8484 Starting point to run the files job
8585
8686 :param config:
87+ :param override_session:
8788 :return:
8889 """
8990 if not keyisset ("files" , config ):
@@ -96,5 +97,5 @@ def start_jobs(config):
9697 job .files [file_path ] = file_def
9798 file_def .path = file_path
9899 for file in job .files .values ():
99- file .handler (job .iam_override )
100+ file .handler (job .iam_override , override_session )
100101 LOG .info (f"Tasks for { file .path } completed." )
Original file line number Diff line number Diff line change 55"""Main module."""
66
77import base64
8+ import pathlib
89import subprocess
910import warnings
1011from os import path
@@ -30,14 +31,25 @@ class File(FileDef, object):
3031 def __init__ (self , ** data : Any ):
3132 super ().__init__ (** data )
3233 self .templates_dir = None
34+ self .dir_path = None
3335
34- def handler (self , iam_override , session_override = None ):
36+ def set_dir_path (self ):
37+ if self .path :
38+ self .dir_path = path .abspath (path .dirname (self .path ))
39+
40+ def handler (self , iam_override = None , session_override = None ):
3541 """
3642 Main entrypoint for files to relate
3743
3844 :param ecs_files_composer.input.IamOverrideDef iam_override:
3945 :param boto3.session.Session session_override:
4046 """
47+ if not self .dir_path :
48+ self .set_dir_path ()
49+ if self .dir_path and not path .exists (self .dir_path ):
50+ print (f"Creating { self .dir_path } folder" )
51+ dir_path = pathlib .Path (path .abspath (self .dir_path ))
52+ dir_path .mkdir (parents = True , exist_ok = True )
4153 if (
4254 self .context
4355 and isinstance (self .context , Context )
Original file line number Diff line number Diff line change @@ -67,6 +67,20 @@ force_grid_wrap = 0
6767use_parentheses = true
6868known_first_party = " kelvin"
6969
70+ [tool .coverage .run ]
71+ source = [" ecs_files_composer" ]
72+ branch = true
73+
74+ [tool .coverage .report ]
75+ ignore_errors = true
76+ exclude_lines = [
77+ " if self.debug:" ,
78+ " pragma: no cover" ,
79+ " raise NotImplementedError" ,
80+ " if __name__ == .__main__.:"
81+ ]
82+
83+ omit = [" ecs_files_composer/cli.py" ]
7084
7185[tool .tbump ]
7286github_url = " https://github.com/compose-x/ecs-files-composer"
Original file line number Diff line number Diff line change 44# Copyright 2020-2021 John Mille<[email protected] > 55
66"""Tests for `ecs_files_composer` package."""
7-
7+ import uuid
88from os import path
99
10+ import boto3 .session
1011import pytest
1112
1213from ecs_files_composer import input
@@ -53,7 +54,9 @@ def simple_json_config_with_certs():
5354 return {
5455 "files" : {
5556 "/tmp/test_raw.txt" : {"content" : raw_content },
56- "/tmp/test.txt" : {"content" : "THIS IS A TEST" },
57+ f"/tmp/{ str (uuid .uuid1 ())} /test.txt" : {
58+ "content" : "THIS IS A ${SHELL:-test}\n "
59+ },
5760 "/tmp/dedoded.txt" : {
5861 "content" : "VEhJUyBJUyBFTkRPREVEIE1FU1NBR0U=" ,
5962 "encoding" : "base64" ,
@@ -77,6 +80,8 @@ def test_simple_job_import(simple_json_config):
7780
7881def test_s3_files_simple (s3_files_config ):
7982 start_jobs (s3_files_config )
83+ test_session = boto3 .session .Session ()
84+ start_jobs (s3_files_config , override_session = test_session )
8085
8186
8287def test_simple_cert (simple_json_config_with_certs ):
You can’t perform that action at this time.
0 commit comments