19 char *report_json = NULL;
20 if (target_id_json == NULL || conf_path_json == NULL || apps_dir_json == NULL) {
26 report_json = (
char *)malloc(strlen(target_id_json) + strlen(conf_path_json) + strlen(apps_dir_json) + 256);
27 if (report_json != NULL) {
28 snprintf(report_json, strlen(target_id_json) + strlen(conf_path_json) + strlen(apps_dir_json) + 256,
29 "{\"report_id\":\"pharos-runtime-build-v1\",\"target_kind\":\"runtime\",\"target_id\":%s,\"status\":\"built\",\"app_count\":%zu,\"config_path\":%s,\"apps_dir\":%s}\n",
30 target_id_json, app_count, conf_path_json, apps_dir_json);
41 char *host_target_json;
43 char *artifact_dir_json;
47 char *state_path_json;
50 char *log_format_json;
51 char *error_report_path_json;
53 char *host_profile_json;
54 char *compiled_entrypoint_json;
55 char *runtime_conf_path_json;
78 if (report_id_json == NULL || verb_json == NULL || host_target_json == NULL || host_mode_json == NULL || artifact_dir_json == NULL || app_id_json == NULL || app_root_json == NULL || build_dir_json == NULL || state_path_json == NULL || base_path_json == NULL || log_path_json == NULL || log_format_json == NULL || error_report_path_json == NULL || debug_json == NULL || host_profile_json == NULL || compiled_entrypoint_json == NULL || runtime_conf_path_json == NULL) {
81 free(host_target_json);
83 free(artifact_dir_json);
87 free(state_path_json);
90 free(log_format_json);
91 free(error_report_path_json);
93 free(host_profile_json);
94 free(compiled_entrypoint_json);
95 free(runtime_conf_path_json);
98 report_json = (
char *)malloc(strlen(report_id_json) + strlen(verb_json) + strlen(host_target_json) + strlen(host_mode_json) + strlen(artifact_dir_json) + strlen(app_id_json) + strlen(app_root_json) + strlen(build_dir_json) + strlen(state_path_json) + strlen(base_path_json) + strlen(log_path_json) + strlen(log_format_json) + strlen(error_report_path_json) + strlen(debug_json) + strlen(host_profile_json) + strlen(compiled_entrypoint_json) + strlen(runtime_conf_path_json) + 768);
99 if (report_json != NULL) {
100 snprintf(report_json, strlen(report_id_json) + strlen(verb_json) + strlen(host_target_json) + strlen(host_mode_json) + strlen(artifact_dir_json) + strlen(app_id_json) + strlen(app_root_json) + strlen(build_dir_json) + strlen(state_path_json) + strlen(base_path_json) + strlen(log_path_json) + strlen(log_format_json) + strlen(error_report_path_json) + strlen(debug_json) + strlen(host_profile_json) + strlen(compiled_entrypoint_json) + strlen(runtime_conf_path_json) + 768,
101 "{\"report_id\":%s,\"verb\":%s,\"target_kind\":\"app\",\"target_id\":%s,\"status\":\"ok\",\"artifact_dir\":%s,\"runtime_launcher\":true,\"host_target\":%s,\"host_mode\":%s,\"generated_by\":\"pharos-native-runtime\",\"runtime_summary\":{\"app_id\":%s,\"mount_path\":%s,\"app_root\":%s,\"build_dir\":%s,\"state_path\":%s,\"log_path\":%s,\"log_format\":%s,\"error_report_path\":%s,\"debug\":%s,\"host_profile\":%s,\"compiled_entrypoint\":%s,\"runtime_conf_path\":%s}}\n",
102 report_id_json, verb_json, app_id_json, artifact_dir_json, host_target_json, host_mode_json, app_id_json, base_path_json, app_root_json, build_dir_json, state_path_json, log_path_json, log_format_json, error_report_path_json, debug_json, host_profile_json, compiled_entrypoint_json, runtime_conf_path_json);
104 free(report_id_json);
106 free(host_target_json);
107 free(host_mode_json);
108 free(artifact_dir_json);
111 free(build_dir_json);
112 free(state_path_json);
113 free(base_path_json);
115 free(log_format_json);
116 free(error_report_path_json);
118 free(host_profile_json);
119 free(compiled_entrypoint_json);
120 free(runtime_conf_path_json);
136 for (index = 0; index < stack->
count; index++) {
150 if (app_id_json == NULL || mount_json == NULL || app_root_json == NULL || build_dir_json == NULL || state_path_json == NULL || log_path_json == NULL || log_format_json == NULL || error_report_path_json == NULL || debug_json == NULL || host_profile_json == NULL || compiled_entrypoint_json == NULL) {
154 free(build_dir_json);
155 free(state_path_json);
157 free(log_format_json);
158 free(error_report_path_json);
160 free(host_profile_json);
161 free(compiled_entrypoint_json);
165 snprintf(row,
sizeof(row),
"%s{\"app_id\":%s,\"mount_path\":%s,\"app_root\":%s,\"build_dir\":%s,\"state_path\":%s,\"log_path\":%s,\"log_format\":%s,\"error_report_path\":%s,\"debug\":%s,\"host_profile\":%s,\"compiled_entrypoint\":%s}",
166 index == 0 ?
"" :
",", app_id_json, mount_json, app_root_json, build_dir_json, state_path_json, log_path_json, log_format_json, error_report_path_json, debug_json, host_profile_json, compiled_entrypoint_json);
171 free(build_dir_json);
172 free(state_path_json);
174 free(log_format_json);
175 free(error_report_path_json);
177 free(host_profile_json);
178 free(compiled_entrypoint_json);
185 free(build_dir_json);
186 free(state_path_json);
188 free(log_format_json);
189 free(error_report_path_json);
191 free(host_profile_json);
192 free(compiled_entrypoint_json);
198 if (host_json == NULL || port_json == NULL || socket_json == NULL || apps_dir_json == NULL) {
206 report_json = (
char *)malloc(strlen(host_json) + strlen(port_json) + strlen(socket_json) + strlen(apps_dir_json) + apps_json.
len + 512);
207 if (report_json != NULL) {
208 snprintf(report_json, strlen(host_json) + strlen(port_json) + strlen(socket_json) + strlen(apps_dir_json) + apps_json.
len + 512,
209 "{\"report_id\":\"pharos-runtime-status-v1\",\"status\":\"ok\",\"host\":%s,\"port\":%s,\"socket_path\":%s,\"apps_dir\":%s,\"app_count\":%zu,\"apps\":[%s]}\n",
210 host_json, port_json, socket_json, apps_dir_json, stack->
count, apps_json.
data != NULL ? apps_json.
data :
"");
char * build_native_app_runtime_report_json(const char *report_id, const char *verb, const char *host_target, const char *host_mode, const char *artifact_dir, const AppRuntime *app)
Builds a JSON runtime report for one app artifact and host surface.
char * build_native_runtime_build_report_json(const char *target_id, const char *conf_path, const char *apps_dir, size_t app_count)
Builds a JSON report describing a native runtime build result.
int buffer_append(Buffer *buffer, const void *data, size_t len)
Appends bytes to a growable buffer and maintains a trailing NUL byte.