You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by ra...@apache.org on 2020/05/14 16:58:02 UTC

[openwhisk-runtime-nodejs] 02/05: Fix gradle property error.

This is an automated email from the ASF dual-hosted git repository.

rabbah pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/openwhisk-runtime-nodejs.git

commit 0a33cce09d8c2f5482f8681f8f42cef658e9211b
Author: Rodric Rabbah <ro...@gmail.com>
AuthorDate: Wed May 13 11:22:00 2020 -0400

    Fix gradle property error.
---
 gradle/docker.gradle | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/gradle/docker.gradle b/gradle/docker.gradle
index 6ad6850..23b3ae2 100644
--- a/gradle/docker.gradle
+++ b/gradle/docker.gradle
@@ -30,10 +30,11 @@ import groovy.time.*
  * - dockerImageTag (optional, default 'latest'): The tag for the image
  * - dockerImagePrefix (optional, default 'whisk'): The prefix for the image,
  *       'controller' becomes 'whisk/controller' per default
+ * - dockerImageSuffix (optional, default ''): a suffix appended to the image name
  * - dockerTimeout (optional, default 840): Timeout for docker operations in seconds
  * - dockerRetries (optional, default 3): How many times to retry docker operations
  * - dockerBinary (optional, default 'docker'): The binary to execute docker commands
- * - dockerBuildArgs (options, default ''): Project specific custom docker build arguments
+ * - dockerBuildArgs (options, default ''): Project specific custom docker build arguments (use comma to separate multiple args)
  * - dockerHost (optional): The docker host to run commands on, default behaviour is
  *       docker's own DOCKER_HOST environment variable
  */
@@ -42,19 +43,20 @@ ext {
     dockerRegistry = project.hasProperty('dockerRegistry') ? dockerRegistry + '/' : ''
     dockerImageTag = project.hasProperty('dockerImageTag') ? dockerImageTag : 'latest'
     dockerImagePrefix = project.hasProperty('dockerImagePrefix') ? dockerImagePrefix : 'whisk'
+    dockerImageSuffix = project.hasProperty('dockerImageSuffix') ? dockerImageSuffix : ''
     dockerTimeout = project.hasProperty('dockerTimeout') ? dockerTimeout.toInteger() : 840
     dockerRetries = project.hasProperty('dockerRetries') ? dockerRetries.toInteger() : 3
     dockerBinary = project.hasProperty('dockerBinary') ? [dockerBinary] : ['docker']
     dockerBuildArg = ['build']
 }
-ext.dockerTaggedImageName = dockerRegistry + dockerImagePrefix + '/' + dockerImageName + ':' + dockerImageTag
+ext.dockerTaggedImageName = dockerRegistry + dockerImagePrefix + '/' + dockerImageName + dockerImageSuffix + ':' + dockerImageTag
 
 if(project.hasProperty('dockerHost')) {
     dockerBinary += ['--host', project.dockerHost]
 }
 
 if(project.hasProperty('dockerBuildArgs')) {
-    dockerBuildArgs.each { arg  ->
+    dockerBuildArgs.split(',').each { arg ->
         dockerBuildArg += ['--build-arg', arg]
     }
 }
@@ -62,9 +64,9 @@ if(project.hasProperty('dockerBuildArgs')) {
 task distDocker {
     doLast {
         def start = new Date()
-        def cmd = dockerBinary + dockerBuildArg + ['-t', dockerImageName, project.buildscript.sourceFile.getParentFile().getAbsolutePath()]
+        def cmd = dockerBinary + dockerBuildArg + ['-t', dockerImageName + dockerImageSuffix, project.buildscript.sourceFile.getParentFile().getAbsolutePath()]
         retry(cmd, dockerRetries, dockerTimeout)
-        println("Building '${dockerImageName}' took ${TimeCategory.minus(new Date(), start)}")
+        println("Building '${dockerImageName + dockerImageSuffix}' took ${TimeCategory.minus(new Date(), start)}")
     }
 }
 task tagImage {
@@ -79,7 +81,7 @@ task tagImage {
         if(major == 1 && minor < 12) {
             dockerCmd += ['-f']
         }
-        retry(dockerBinary + dockerCmd + [dockerImageName, dockerTaggedImageName], dockerRetries, dockerTimeout)
+        retry(dockerBinary + dockerCmd + [dockerImageName + dockerImageSuffix, dockerTaggedImageName], dockerRetries, dockerTimeout)
     }
 }