aboutsummaryrefslogtreecommitdiff
path: root/src/delivery.c
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2024-06-28 10:10:29 -0400
committerJoseph Hunkeler <jhunkeler@gmail.com>2024-06-28 10:10:29 -0400
commited1d3a099549ec4e82e506a172ee7e49977ac070 (patch)
tree1a9cdadc7ad33282f179a16cc6437f0759af43bf /src/delivery.c
parent12fded0aa09d094799a901b72dd8adccac890696 (diff)
downloadstasis-ed1d3a099549ec4e82e506a172ee7e49977ac070.tar.gz
Disable overwriting releases by default
Diffstat (limited to 'src/delivery.c')
-rw-r--r--src/delivery.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/delivery.c b/src/delivery.c
index 8828266..7bedef3 100644
--- a/src/delivery.c
+++ b/src/delivery.c
@@ -2163,4 +2163,21 @@ int delivery_fixup_test_results(struct Delivery *ctx) {
closedir(dp);
return 0;
+}
+
+int delivery_exists(struct Delivery *ctx) {
+ // TODO: scan artifactory repo for the same information
+ char release_pattern[PATH_MAX] = {0};
+ sprintf(release_pattern, "*%s*", ctx->info.release_name);
+ struct StrList *files = listdir(ctx->storage.delivery_dir);
+ for (size_t i = 0; i < strlist_count(files); i++) {
+ char *filename = strlist_item(files, i);
+ int release_exists = fnmatch(release_pattern, filename, FNM_PATHNAME);
+ if (!globals.enable_overwrite && !release_exists) {
+ guard_strlist_free(&files);
+ return 1;
+ }
+ }
+ guard_strlist_free(&files);
+ return 0;
} \ No newline at end of file