From 2dc75e511bd86f77d3893f5ac56fd57e9272a762 Mon Sep 17 00:00:00 2001 From: hyokeun Date: Thu, 25 May 2017 13:30:05 +0900 Subject: [PATCH] Execute groovy init script one time Change-Id: I70c20d39ff99b3db78544d559ec44894bff6ae79 --- groovy_init_scripts/init.groovy | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/groovy_init_scripts/init.groovy b/groovy_init_scripts/init.groovy index 72e7c25..8379af3 100755 --- a/groovy_init_scripts/init.groovy +++ b/groovy_init_scripts/init.groovy @@ -21,14 +21,18 @@ def mx = { filepath -> Properties properties = new Properties() try { - File propertiesFile = new File(scripts_dir + 'setup.properties') - propertiesFile.withInputStream { - properties.load(it) - } + properties.load(new FileInputStream(env['JENKINS_HOME'] + '/.groovy_init_required')) + properties.load(new FileInputStream(scripts_dir + 'setup.properties')) } catch (Exception err) { - println ' Sorry no such file...' - return -1 + logger.info(' Check property files...') + return 0 +} + +if (properties.CONTAINER_INIT_REQUIRED == null || properties.CONTAINER_INIT_REQUIRED != '1') { + logger.info(' Groovy init not required...' + properties.CONTAINER_INIT_REQUIRED) + return 0 } +new File(env['JENKINS_HOME'] + '/.groovy_init_required').delete() /////////////////////////////////////////////////////////////////// /////////////////// E-mail Notification ///////////////////////// -- 2.7.4