From 48ae409f64f26f652318a73c37fcd0de7d6e74e7 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Fri, 16 Feb 2024 00:22:57 -0500 Subject: Fix garbage file creation * zero out proc structure * remove erroneous if statement that prevented OMC_JF_REPO from working correctly * fail if the artifactory repo is an empty string --- src/deliverable.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/deliverable.c b/src/deliverable.c index 3f0fd34..e2bbffb 100644 --- a/src/deliverable.c +++ b/src/deliverable.c @@ -1263,6 +1263,8 @@ int delivery_index_conda_artifacts(struct Delivery *ctx) { void delivery_tests_run(struct Delivery *ctx) { struct Process proc; + memset(&proc, 0, sizeof(proc)); + if (!ctx->tests[0].name) { msg(OMC_MSG_WARN | OMC_MSG_L2, "no tests are defined!\n"); } else { @@ -1433,9 +1435,7 @@ int delivery_artifact_upload(struct Delivery *ctx) { char *repo = getenv("OMC_JF_REPO"); if (repo) { - if (!ctx->deploy[i].repo) { - ctx->deploy[i].repo = strdup(repo); - } + ctx->deploy[i].repo = strdup(repo); } else if (globals.jfrog.repo) { ctx->deploy[i].repo = strdup(globals.jfrog.repo); } else { @@ -1446,6 +1446,13 @@ int delivery_artifact_upload(struct Delivery *ctx) { break; } + if (isempty(ctx->deploy[i].repo) || !strlen(ctx->deploy[i].repo)) { + // Unlikely to trigger if the config parser is working correctly + msg(OMC_MSG_ERROR, "Artifactory repository path is empty. Cannot continue.\n"); + status++; + break; + } + if (jfrt_auth_init(&ctx->deploy[i].auth_ctx)) { continue; } -- cgit