def _render_publish_vars(
        action_node,
        action_parameters,
        execution_result,
        previous_execution_results,
        chain_vars,
    ):
        """
        If no output is specified on the action_node the output is the entire execution_result.
        If any output is specified then only those variables are published as output of an
        execution of this action_node.
        The output variable can refer to a variable from the execution_result,
        previous_execution_results or chain_vars.
        """
        if not action_node.publish:
            return {}

        context = {}
        context.update(action_parameters)
        context.update({action_node.name: execution_result})
        context.update(previous_execution_results)
        context.update(chain_vars)
        context.update({RESULTS_KEY: previous_execution_results})

        context.update(
            {
                kv_constants.SYSTEM_SCOPE: kv_service.KeyValueLookup(
                    scope=kv_constants.SYSTEM_SCOPE
                )
            }
        )

        context.update(
            {
                kv_constants.DATASTORE_PARENT_SCOPE: {
                    kv_constants.SYSTEM_SCOPE: kv_service.KeyValueLookup(
                        scope=kv_constants.FULL_SYSTEM_SCOPE
                    )
                }
            }
        )

        try:
            rendered_result = jinja_utils.render_values(
                mapping=action_node.publish, context=context
            )
        except Exception as e:
            key = getattr(e, "key", None)
            value = getattr(e, "value", None)
            msg = (
                'Failed rendering value for publish parameter "%s" in task "%s" '
                "(template string=%s): %s"
                % (key, action_node.name, value, six.text_type(e))
            )
            raise action_exc.ParameterRenderingFailedException(msg)

        return rendered_result

        If no output is specified on the action_node the output is the entire execution_result.
        If any output is specified then only those variables are published as output of an
        execution of this action_node.
        The output variable can refer to a variable from the execution_result,
        previous_execution_results or chain_vars.
        
contrib/runners/action_chain_runner/action_chain_runner/action_chain_runner.py