diff options
author | Joseph Hunkeler <jhunkeler@gmail.com> | 2024-12-07 18:07:45 -0500 |
---|---|---|
committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2024-12-07 18:07:45 -0500 |
commit | 3ae9311dd7961756f6e22c2a77dd3f5690208148 (patch) | |
tree | 2b51e23c8dec3f169e68b314d291e83d1537be7f /src/cli/stasis_indexer/helpers.c | |
parent | 83bd300fcd006ee14314c26569c47716dfff2352 (diff) | |
download | stasis-3ae9311dd7961756f6e22c2a77dd3f5690208148.tar.gz |
Add get_docker_images() helper function
Diffstat (limited to 'src/cli/stasis_indexer/helpers.c')
-rw-r--r-- | src/cli/stasis_indexer/helpers.c | 17 |
1 files changed, 17 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}; |