Skip to content
Snippets Groups Projects
Commit ff7c8e97 authored by Daniel Göbel's avatar Daniel Göbel
Browse files

Merge branch 'bugfix/50-escape-workflow-parameters-for-bash' into 'development'

Resolve "Escape workflow parameters for bash"

Closes #50

See merge request !47
parents 4a2e5230 30984abf
No related branches found
No related tags found
2 merge requests!69Delete dev branch,!47Resolve "Escape workflow parameters for bash"
Pipeline #37115 canceled
......@@ -289,7 +289,7 @@ async def download_workflow_documentation(
if document is DocumentationEnum.PARAMETER_SCHEMA:
path = workflow_mode.schema_path
return StreamingResponse(repo.download_file_stream(path, client))
return StreamingResponse(repo.download_file_stream(path, client), headers={"Cache-Control": "max-age=86400"})
@router.post(
......
import json
import re
import shlex
from io import BytesIO
from tempfile import SpooledTemporaryFile
from typing import TYPE_CHECKING, Any, BinaryIO, Dict, Optional, Sequence, Union
......@@ -173,6 +174,10 @@ async def start_workflow_execution(
f.write(json.dumps(parameters).encode("utf-8"))
f.seek(0)
s3.Bucket(name=settings.PARAMS_BUCKET).Object(key=params_file_name).upload_fileobj(f)
for key in parameters.keys():
if isinstance(parameters[key], str):
# Escape string parameters for bash shell
parameters[key] = shlex.quote(parameters[key]).replace("$", "\$")
# Check if the there is an SCM file for the workflow
scm_file_name = None
......
......@@ -18,5 +18,5 @@ ${nx_bin} run ${repo.repo_url} \
% endif
-revision ${repo.git_commit_hash} \
% for param_name, param_value in parameters.items():
--${param_name} "${param_value}" \
--${param_name} ${param_value} \
% endfor
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment