Skip to content

Commit

Permalink
ci: allow passing a dict/list as a step parameter
Browse files Browse the repository at this point in the history
In some cases we may want to pass a complex value to a step. For
example:

  .buildkite/pipeline_pr.py \
    --step-param 'retry/automatic=[{"exit_status": "*", "limit": 2}]'

Signed-off-by: Pablo Barbáchano <[email protected]>
  • Loading branch information
pb8o committed Dec 18, 2024
1 parent 56306be commit c6add4f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .buildkite/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"""

import argparse
import ast
import json
import os
import random
Expand Down Expand Up @@ -138,7 +139,7 @@ def __call__(self, parser, namespace, value, option_string=None):
res = getattr(namespace, self.dest, {})
key_str, val = value.split("=", maxsplit=1)
keys = key_str.split("/")
update = {keys[-1]: val}
update = {keys[-1]: ast.literal_eval(val)}
for key in list(reversed(keys))[1:]:
update = {key: update}
res = overlay_dict(res, update)
Expand Down

0 comments on commit c6add4f

Please sign in to comment.