Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions hack/bundle-automation/generate-shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,14 @@ def cleanup_script_dependencies(copied_files):
shutil.rmtree(utils_dest)
logging.debug(f"Removed utils directory")

def prepare_and_execute(operation, operation_data, args):
def prepare_and_execute(operation, operation_data, args, extra_args):
"""Prepares and executes the operation based on the provided operation data.

Args:
operation (_type_): _description_
operation_data (_type_): _description_
args (_type_): _description_
extra_args (_type_): _description_
"""
logging.info(f"Executing operator: {operation}")

Expand All @@ -161,6 +162,10 @@ def prepare_and_execute(operation, operation_data, args):
if args.config:
operations_args += " --config {}".format(args.config)

# Add any extra arguments passed through
if extra_args:
operations_args += " " + " ".join(extra_args)

Comment thread
cameronmwall marked this conversation as resolved.
# Execute the script
execute_script(script_file, operations_args)

Expand Down Expand Up @@ -188,11 +193,12 @@ def execute_script(script_path, args):
logging.error(f"Script {script_path.name} failed with exit code {e.returncode}")
sys.exit(e.returncode)

def main(args):
def main(args, extra_args):
"""_summary_

Args:
args (_type_): _description_
extra_args (_type_): _description_
"""
logging.basicConfig(level=logging.INFO)

Expand All @@ -205,7 +211,7 @@ def main(args):

for operation, operation_data in SUPPORTED_OPERATIONS.items():
if getattr(args, operation.replace('-', '_'), False):
prepare_and_execute(operation, operation_data, args)
prepare_and_execute(operation, operation_data, args, extra_args)
break

end_time = time.time() # Record the end time and log the duration of the script execution
Expand Down Expand Up @@ -237,5 +243,6 @@ def main(args):
parser.set_defaults(bundle=False, commit=False, lint=False)

# Parse command-line arguments and call the main function
args = parser.parse_args()
main(args)
# Use parse_known_args to capture unknown arguments and pass them through
args, extra_args = parser.parse_known_args()
main(args, extra_args)
Loading