aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2024-12-07 18:07:45 -0500
committerJoseph Hunkeler <jhunkeler@gmail.com>2024-12-07 18:07:45 -0500
commit3ae9311dd7961756f6e22c2a77dd3f5690208148 (patch)
tree2b51e23c8dec3f169e68b314d291e83d1537be7f
parent83bd300fcd006ee14314c26569c47716dfff2352 (diff)
downloadstasis-3ae9311dd7961756f6e22c2a77dd3f5690208148.tar.gz
Add get_docker_images() helper function
-rw-r--r--src/cli/stasis_indexer/helpers.c17
-rw-r--r--src/cli/stasis_indexer/helpers.h1
2 files changed, 18 insertions, 0 deletions
diff --git a/src/cli/stasis_indexer/helpers.c b/src/cli/stasis_indexer/helpers.c
index f67292f..6d2fdd0 100644
--- a/src/cli/stasis_indexer/helpers.c
+++ b/src/cli/stasis_indexer/helpers.c
@@ -255,6 +255,23 @@ int get_files(struct StrList **out, const char *path, const char *pattern, ...)
return 0;
}
+struct StrList *get_docker_images(struct Delivery *ctx, char *pattern) {
+ char *tarball = NULL;
+ asprintf(&tarball, "%s*.tar*", pattern);
+ if (!tarball) {
+ SYSERROR("%s", "Unable to allocate bytes for docker image wildcard pattern");
+ return NULL;
+ }
+ tolower_s(tarball);
+ replace_text(tarball, "+", "-", 0);
+
+ struct StrList *files = NULL;
+ get_files(&files, ctx->storage.docker_artifact_dir, tarball);
+ guard_free(tarball);
+
+ return files;
+}
+
int load_metadata(struct Delivery *ctx, const char *filename) {
char line[STASIS_NAME_MAX] = {0};
diff --git a/src/cli/stasis_indexer/helpers.h b/src/cli/stasis_indexer/helpers.h
index 733691d..d493f75 100644
--- a/src/cli/stasis_indexer/helpers.h
+++ b/src/cli/stasis_indexer/helpers.h
@@ -20,6 +20,7 @@ int pandoc_exec(const char *in_file, const char *out_file, const char *css_file,
int get_latest_rc(struct Delivery ctx[], size_t nelem);
struct Delivery *get_latest_deliveries(struct Delivery ctx[], size_t nelem);
int get_files(struct StrList **out, const char *path, const char *pattern, ...);
+struct StrList *get_docker_images(struct Delivery *ctx, char *pattern);
int load_metadata(struct Delivery *ctx, const char *filename);
int micromamba_configure(const struct Delivery *ctx, struct MicromambaInfo *m);