aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2024-04-12 15:57:32 -0400
committerJoseph Hunkeler <jhunkeler@gmail.com>2024-04-12 15:57:32 -0400
commit507c003a36584fae29cba00ca8e264488f39476e (patch)
treed1062275360e96071ca3e8bf8b3d0be9df4a9a06
parent4049e0de876611d1d94fbd0185a0ab9722cb8ce1 (diff)
downloadstasis-507c003a36584fae29cba00ca8e264488f39476e.tar.gz
Save raw and rendered versions of the input configuration.
-rw-r--r--include/deliverable.h1
-rw-r--r--src/deliverable.c2
-rw-r--r--src/main.c27
3 files changed, 30 insertions, 0 deletions
diff --git a/include/deliverable.h b/include/deliverable.h
index 2cb49e8..c818df1 100644
--- a/include/deliverable.h
+++ b/include/deliverable.h
@@ -66,6 +66,7 @@ struct Delivery {
char *tmpdir; ///< Temporary storage area (within root)
char *output_dir; ///< Base path to where all artifacts are stored
char *delivery_dir; ///< Delivery artifact output directory
+ char *cfgdump_dir; ///< Base path to where input configuration dumps are stored
char *tools_dir; ///< Tools storage
char *mission_dir; ///< Mission data storage
char *package_dir; ///< Base path to where all packages are stored
diff --git a/src/deliverable.c b/src/deliverable.c
index b7331e0..4c29fa4 100644
--- a/src/deliverable.c
+++ b/src/deliverable.c
@@ -228,6 +228,8 @@ void delivery_init_dirs_stage2(struct Delivery *ctx) {
path_store(&ctx->storage.delivery_dir, PATH_MAX, ctx->storage.output_dir, "delivery");
path_store(&ctx->storage.results_dir, PATH_MAX, ctx->storage.output_dir, "results");
path_store(&ctx->storage.package_dir, PATH_MAX, ctx->storage.output_dir, "packages");
+ path_store(&ctx->storage.cfgdump_dir, PATH_MAX, ctx->storage.output_dir, "config");
+
path_store(&ctx->storage.conda_artifact_dir, PATH_MAX, ctx->storage.package_dir, "conda");
path_store(&ctx->storage.wheel_artifact_dir, PATH_MAX, ctx->storage.package_dir, "wheels");
path_store(&ctx->storage.docker_artifact_dir, PATH_MAX, ctx->storage.package_dir, "docker");
diff --git a/src/main.c b/src/main.c
index 6608299..7c20ae7 100644
--- a/src/main.c
+++ b/src/main.c
@@ -532,6 +532,33 @@ int main(int argc, char *argv[]) {
conda_exec("list");
msg(OMC_MSG_L1, "Creating release\n");
+ msg(OMC_MSG_L2, "Exporting delivery configuration\n");
+ if (!pushd(ctx.storage.cfgdump_dir)) {
+ char filename[PATH_MAX] = {0};
+ sprintf(filename, "%s.ini", ctx.info.release_name);
+ FILE *spec = fopen(filename, "w+");
+ if (!spec) {
+ msg(OMC_MSG_ERROR | OMC_MSG_L2, "failed %s\n", filename);
+ exit(1);
+ }
+ ini_write(ctx._omc_ini_fp.delivery, &spec, INI_WRITE_RAW);
+ fclose(spec);
+
+ memset(filename, 0, sizeof(filename));
+ sprintf(filename, "%s-rendered.ini", ctx.info.release_name);
+ spec = fopen(filename, "w+");
+ if (!spec) {
+ msg(OMC_MSG_ERROR | OMC_MSG_L2, "failed %s\n", filename);
+ exit(1);
+ }
+ ini_write(ctx._omc_ini_fp.delivery, &spec, INI_WRITE_PRESERVE);
+ fclose(spec);
+ popd();
+ } else {
+ SYSERROR("Failed to enter directory: %s", ctx.storage.delivery_dir);
+ exit(1);
+ }
+
msg(OMC_MSG_L2, "Exporting %s\n", env_name_testing);
if (conda_env_export(env_name_testing, ctx.storage.delivery_dir, env_name_testing)) {
msg(OMC_MSG_ERROR | OMC_MSG_L2, "failed %s\n", env_name_testing);