diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/deliverable.c | 8 | ||||
-rw-r--r-- | src/docker.c | 12 |
2 files changed, 17 insertions, 3 deletions
diff --git a/src/deliverable.c b/src/deliverable.c index 09b30f1..9b20a63 100644 --- a/src/deliverable.c +++ b/src/deliverable.c @@ -1758,7 +1758,9 @@ int delivery_docker(struct Delivery *ctx) { // Append image tags to command for (size_t i = 0; i < total_tags; i++) { - char *tag = strlist_item(ctx->deploy.docker.tags, i); + char *tag_orig = strlist_item(ctx->deploy.docker.tags, i); + strcpy(tag, tag_orig); + docker_sanitize_tag(tag); sprintf(args + strlen(args), " -t \"%s\" ", tag); } @@ -1795,8 +1797,8 @@ int delivery_docker(struct Delivery *ctx) { // Test the image // All tags point back to the same image so test the first one we see // regardless of how many are defined - char *tag = NULL; - tag = strlist_item(ctx->deploy.docker.tags, 0); + strcpy(tag, strlist_item(ctx->deploy.docker.tags, 0)); + docker_sanitize_tag(tag); msg(OMC_MSG_L2, "Executing image test script for %s\n", tag); if (ctx->deploy.docker.test_script) { diff --git a/src/docker.c b/src/docker.c index d5cffd9..e2a392b 100644 --- a/src/docker.c +++ b/src/docker.c @@ -168,3 +168,15 @@ int docker_capable(struct DockerCapabilities *result) { result->usable = true; return true; } + +void docker_sanitize_tag(char *str) { + char *pos = str; + while (*pos != 0) { + if (!isalnum(*pos)) { + if (*pos != '.' && *pos != ':' && *pos != '/') { + *pos = '-'; + } + } + pos++; + } +} |