diff options
| author | Joseph Hunkeler <jhunkeler@gmail.com> | 2024-12-03 00:57:34 -0500 | 
|---|---|---|
| committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2024-12-03 19:07:23 -0500 | 
| commit | 080866ee9400dbc1cf82a71621e55cb20861f6e8 (patch) | |
| tree | 1a3e6db6a25e471349969497f6f5314ef1f72711 | |
| parent | 506269820329f019d1ff26eb681fbaa70bcb9674 (diff) | |
| download | stasis-080866ee9400dbc1cf82a71621e55cb20861f6e8.tar.gz | |
Add DELIVERY_[NOT_]FOUND defines
* Add delivery_series_sync function to download previously delivered files from artifactory
| -rw-r--r-- | include/delivery.h | 12 | ||||
| -rw-r--r-- | src/lib/core/delivery_artifactory.c | 17 | 
2 files changed, 29 insertions, 0 deletions
| diff --git a/include/delivery.h b/include/delivery.h index 2ab25d1..40ca3e6 100644 --- a/include/delivery.h +++ b/include/delivery.h @@ -424,6 +424,9 @@ int populate_mission_ini(struct Delivery **ctx, int render_mode);  void validate_delivery_ini(struct INIFILE *ini);  int filter_repo_tags(char *repo, struct StrList *patterns); + +#define DELIVERY_NOT_FOUND 0 +#define DELIVERY_FOUND 1  /**   * Determine whether a release on-disk matches the release name in use   * @param ctx Delivery context @@ -433,4 +436,13 @@ int delivery_exists(struct Delivery *ctx);  int delivery_overlay_packages_from_env(struct Delivery *ctx, const char *env_name); +/** + * Retrieve remote deliveries associated with the current version series + * @param ctx Delivery context + * @return -1 on error + * @return 1 on failure + * @return 0 on success + */ +int delivery_series_sync(struct Delivery *ctx); +  #endif //STASIS_DELIVERY_H diff --git a/src/lib/core/delivery_artifactory.c b/src/lib/core/delivery_artifactory.c index b69615e..9ad5829 100644 --- a/src/lib/core/delivery_artifactory.c +++ b/src/lib/core/delivery_artifactory.c @@ -185,3 +185,20 @@ int delivery_mission_render_files(struct Delivery *ctx) {      return 0;  } +int delivery_series_sync(struct Delivery *ctx) { +    struct JFRT_Download dl = {0}; + +    char *remote_dir = NULL; +    if (asprintf(&remote_dir, "%s/%s/%s/(*)", globals.jfrog.repo, ctx->meta.mission, ctx->info.build_name) < 0) { +        SYSERROR("%s", "Unable to allocate bytes for remote directory path"); +        return -1; +    } + +    char *dest_dir = NULL; +    if (asprintf(&dest_dir, "%s/{1}", ctx->storage.output_dir) < 0) { +        SYSERROR("%s", "Unable to allocate bytes for destination directory path"); +        return -1; +    } + +    return jfrog_cli_rt_download(&ctx->deploy.jfrog_auth, &dl, remote_dir, dest_dir); +} | 
