diff options
| author | Joseph Hunkeler <jhunkeler@gmail.com> | 2024-12-03 01:01:01 -0500 | 
|---|---|---|
| committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2024-12-03 19:07:23 -0500 | 
| commit | d18249abd2e45b345fc8c5dc61bab11530e9dccf (patch) | |
| tree | f9846431e9d26dc0542f54a1feb626dd82c33a1d /src | |
| parent | 38e4789530a38ac9e7dfddfc0afcff178bd1647f (diff) | |
| download | stasis-d18249abd2e45b345fc8c5dc61bab11530e9dccf.tar.gz | |
Use delivery_series_sync() function
Diffstat (limited to 'src')
| -rw-r--r-- | src/cli/stasis/stasis_main.c | 24 | 
1 files changed, 23 insertions, 1 deletions
| diff --git a/src/cli/stasis/stasis_main.c b/src/cli/stasis/stasis_main.c index 093e32e..adc3cd7 100644 --- a/src/cli/stasis/stasis_main.c +++ b/src/cli/stasis/stasis_main.c @@ -220,11 +220,33 @@ int main(int argc, char *argv[]) {      // Safety gate: Avoid clobbering a delivered release unless the user wants that behavior      msg(STASIS_MSG_L1, "Checking release history\n"); -    if (delivery_exists(&ctx)) { +    const int found_delivery = delivery_exists(&ctx); + +    if (!globals.enable_overwrite && found_delivery) {          msg(STASIS_MSG_ERROR | STASIS_MSG_L1, "Refusing to overwrite release: %s\nUse --overwrite to enable release clobbering.\n", ctx.info.release_name);          exit(1);      } +    if (globals.enable_artifactory) { +        // We need to download previous revisions to ensure processed packages are available at build-time +        // This is also a docker requirement. Python wheels must exist locally. +        if (ctx.meta.rc > 1) { +            msg(STASIS_MSG_L1, "Syncing delivery artifacts for %s\n", ctx.info.build_name); +            if (delivery_series_sync(&ctx) != 0) { +                msg(STASIS_MSG_ERROR | STASIS_MSG_L2, "Unable to sync artifacts for %s\n", ctx.info.build_name); +                msg(STASIS_MSG_L3, "Case #1:\n" +                                   "\tIf this is a new 'version', and 'rc' is greater " +                                   "than 1, then no previous deliveries exist remotely. " +                                   "Reset 'rc' to 1.\n"); +                msg(STASIS_MSG_L3, "Case #2:\n" +                                   "\tThe Artifactory server %s is unreachable, or the credentials used " +                                   "are invalid.\n", globals.jfrog.url); +                // No continue-on-error check. Without the previous delivery nothing can be done. +                exit(1); +            } +        } +    } +      // Unlikely to occur: this should help prevent rmtree() from destroying your entire filesystem      // if path is "/" then, die      // or if empty string, die | 
