Problem Statement:
Pipeline failure may occur with cannot be parsed by json.loads() method. This is caused by the json string not being passed with variables as a template input. The error will appear in the UI console log output as below.
INFO Job could not get triggered
ERROR Traceback (most recent call last):
ERROR File "", line xxx, in
ERROR File "", line xx, in trigger_github_action_workflow
ERROR File "/usr/lib64/python3.6/json/__init__.py", line xxx, in loads
ERROR return _default_decoder.decode(s)
ERROR File "/usr/lib64/python3.6/json/decoder.py", line xxx, in decode
ERROR obj, end = self.raw_decode(s, idx=_w(s, 0).end())
ERROR File "/usr/lib64/python3.6/json/decoder.py", line xxx, in raw_decode
ERROR raise JSONDecodeError("Expecting value", s, err.value) from None
ERRORjson.decoder.JSONDecodeError: Expecting value: line x column x (char xx)
ERRORCommandExecution failed with exit code: (1)
Solution:
You can add quotes to the variable as Harness doesn’t treat this as a literal string.
While the variable maybe be stored as:
“{"environment": "<+stage.variables.environment>","domain": "<+execution.steps.set_squad_env_vars.output.outputVariables.readme_domain>"}”
This can be changed to:
{“environment”: “<+stage.variables.environment>”,“domain”: “<+execution.steps.set_squad_env_vars.output.outputVariables.readme_domain>”}