Skip to content

Commit

Permalink
Lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
filippomc committed Sep 17, 2024
1 parent 18c47cd commit 0eae79b
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 46 deletions.
2 changes: 1 addition & 1 deletion lint-check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ diff_output=$(autopep8 --select=E1,E2,E3,W,E4,E7,E502 --recursive --diff --excl
# Check if the output is non-empty
if [ -n "$diff_output" ]; then
echo $diff_output
echo "Code style issues found in the above files. Please run autopep8 to fix them."
echo "Code style issues found in the above files. Please run autopep8 to fix."
exit 1
fi
23 changes: 10 additions & 13 deletions tools/deployment-cli-tools/ch_cli_tools/codefresh.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,9 +245,6 @@ def codefresh_steps_from_base_path(base_path, build_step, fixed_context=None, in
environment=e2e_test_environment(app_config)
)




def add_unit_test_step(app_config: ApplicationHarnessConfig):
# Create a run step for each application with tests/unit.yaml file using the corresponding image built at the previous step

Expand All @@ -264,24 +261,24 @@ def add_unit_test_step(app_config: ApplicationHarnessConfig):

if helm_values[KEY_TASK_IMAGES]:
codefresh_steps_from_base_path(join(root_path, BASE_IMAGES_PATH), CD_BUILD_STEP_BASE,
fixed_context=relpath(root_path, os.getcwd()), include=helm_values[KEY_TASK_IMAGES].keys())
fixed_context=relpath(root_path, os.getcwd()), include=helm_values[KEY_TASK_IMAGES].keys())
codefresh_steps_from_base_path(join(root_path, STATIC_IMAGES_PATH), CD_BUILD_STEP_STATIC,
include=helm_values[KEY_TASK_IMAGES].keys())
include=helm_values[KEY_TASK_IMAGES].keys())

codefresh_steps_from_base_path(join(
root_path, APPS_PATH), CD_BUILD_STEP_PARALLEL)

if CD_E2E_TEST_STEP in steps:
name = "test-e2e"
codefresh_steps_from_base_path(join(
root_path, TEST_IMAGES_PATH), CD_BUILD_STEP_TEST, include=(name,), publish=False)
steps[CD_E2E_TEST_STEP]["image"] = image_tag_with_variables(name, app_specific_tag_variable(name), base_name=base_image_name)
name = "test-e2e"
codefresh_steps_from_base_path(join(
root_path, TEST_IMAGES_PATH), CD_BUILD_STEP_TEST, include=(name,), publish=False)
steps[CD_E2E_TEST_STEP]["image"] = image_tag_with_variables(name, app_specific_tag_variable(name), base_name=base_image_name)

if CD_API_TEST_STEP in steps:
name = "test-api"
codefresh_steps_from_base_path(join(
root_path, TEST_IMAGES_PATH), CD_BUILD_STEP_TEST, include=(name,), fixed_context=relpath(root_path, os.getcwd()), publish=False)
steps[CD_API_TEST_STEP]["image"] = image_tag_with_variables(name, app_specific_tag_variable(name), base_name=base_image_name)
name = "test-api"
codefresh_steps_from_base_path(join(
root_path, TEST_IMAGES_PATH), CD_BUILD_STEP_TEST, include=(name,), fixed_context=relpath(root_path, os.getcwd()), publish=False)
steps[CD_API_TEST_STEP]["image"] = image_tag_with_variables(name, app_specific_tag_variable(name), base_name=base_image_name)

if not codefresh:
logging.warning(
Expand Down
2 changes: 1 addition & 1 deletion tools/deployment-cli-tools/ch_cli_tools/helm.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def create_app_values_spec(self, app_name, app_path, base_image_name=None):
specific_template_path = os.path.join(app_path, 'deploy', 'values.yaml')
if os.path.exists(specific_template_path):
logging.info("Specific values template found: " +
specific_template_path)
specific_template_path)
values = get_template(specific_template_path)
else:
values = {}
Expand Down
2 changes: 1 addition & 1 deletion tools/deployment-cli-tools/harness-application
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ if __name__ == "__main__":
description='Creates a new Application.')
parser.add_argument('name', metavar='name', type=str,
help='Application name')
parser.add_argument('-t', '--template', dest='templates', action="append", default=['base',],
parser.add_argument('-t', '--template', dest='templates', action="append", default=['base', ],
help="""Add a template name.
Available templates:
Expand Down
59 changes: 29 additions & 30 deletions tools/deployment-cli-tools/harness-deployment
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,10 @@ if __name__ == "__main__":
parser.add_argument('-N', '--no-cd', dest='no_cd_gen', action="store_const", default=None, const=True,
help=f'Do not generate ci/cd files')
parser.add_argument('-we', '--write-env', dest='write_env', action="store_const", default=None, const=True,
help=f'Write build env to .env file in {DEPLOYMENT_PATH}')
help=f'Write build env to .env file in {DEPLOYMENT_PATH}')
parser.add_argument('--docker-compose', dest='docker_compose', action="store_true",
help='Generate docker-compose.yaml and dedicated Skaffold configuration')


args, unknown = parser.parse_known_args(sys.argv[1:])

root_paths = [os.path.join(os.getcwd(), path) for path in args.paths]
Expand All @@ -87,36 +86,36 @@ if __name__ == "__main__":

if not args.docker_compose:
helm_values = create_helm_chart(
root_paths,
tag=args.tag,
registry=args.registry,
domain=args.domain,
local=args.local,
secured=not args.unsecured,
output_path=args.output_path,
exclude=args.exclude,
include=args.include,
registry_secret=args.registry_secret,
tls=not args.no_tls,
env=envs,
namespace=args.namespace
)
root_paths,
tag=args.tag,
registry=args.registry,
domain=args.domain,
local=args.local,
secured=not args.unsecured,
output_path=args.output_path,
exclude=args.exclude,
include=args.include,
registry_secret=args.registry_secret,
tls=not args.no_tls,
env=envs,
namespace=args.namespace
)
else:
helm_values = create_docker_compose_configuration(
root_paths,
tag=args.tag,
registry=args.registry,
domain=args.domain,
local=args.local,
secured=not args.unsecured,
output_path=args.output_path,
exclude=args.exclude,
include=args.include,
registry_secret=args.registry_secret,
tls=not args.no_tls,
env=envs,
namespace=args.namespace,
)
root_paths,
tag=args.tag,
registry=args.registry,
domain=args.domain,
local=args.local,
secured=not args.unsecured,
output_path=args.output_path,
exclude=args.exclude,
include=args.include,
registry_secret=args.registry_secret,
tls=not args.no_tls,
env=envs,
namespace=args.namespace,
)

merged_root_paths = preprocess_build_overrides(
root_paths=root_paths, helm_values=helm_values)
Expand Down

0 comments on commit 0eae79b

Please sign in to comment.