Skip to content

Commit 11ed487

Browse files
author
Massimo Vailati
committed
Added option to hide log output after git clone in rundeck output tab
1 parent 5c76a8d commit 11ed487

2 files changed

Lines changed: 12 additions & 5 deletions

File tree

src/main/groovy/com/rundeck/plugin/GitCloneWorkflowStep.groovy

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import com.dtolabs.rundeck.core.plugins.Plugin
66
import com.dtolabs.rundeck.core.plugins.configuration.Describable
77
import com.dtolabs.rundeck.core.plugins.configuration.Description
88
import com.dtolabs.rundeck.core.plugins.configuration.PropertyUtil
9-
import com.dtolabs.rundeck.plugins.PluginLogger
109
import com.dtolabs.rundeck.plugins.ServiceNameConstants
1110
import com.dtolabs.rundeck.core.plugins.configuration.PropertyScope
1211
import com.dtolabs.rundeck.plugins.descriptions.PluginDescription
@@ -29,6 +28,7 @@ class GitCloneWorkflowStep implements StepPlugin, Describable{
2928

3029
public final static String GIT_URL="gitUrl"
3130
public final static String GIT_BASE_DIRECTORY="gitBaseDirectory"
31+
public final static String GIT_LOG_DISABLE ="gitLogDisable"
3232
public final static String GIT_BRANCH="gitBranch"
3333
public final static String GIT_HOSTKEY_CHECKING="strictHostKeyChecking"
3434
public final static String GIT_KEY_STORAGE="gitKeyPath"
@@ -63,6 +63,8 @@ class GitCloneWorkflowStep implements StepPlugin, Describable{
6363
null,null,null, renderingOptionsConfig))
6464
.property(PropertyUtil.string(GIT_BRANCH, "Branch", "Checkout branch.", true,
6565
"master",null,null, renderingOptionsConfig))
66+
.property(PropertyUtil.bool(GIT_LOG_DISABLE, "Disable log output", "Enabling this flag, the plugin will not show the output log", true,
67+
"false",null, renderingOptionsConfig))
6668
.property(PropertyUtil.string(GIT_PASSWORD_STORAGE, "Git Password", 'Password to authenticate remotely', false,
6769
null,null,null, renderingOptionsAuthenticationPassword))
6870
.property(PropertyUtil.select(GIT_HOSTKEY_CHECKING, "SSH: Strict Host Key Checking", '''Use strict host key checking.
@@ -127,11 +129,13 @@ If `yes`, require remote host SSH key is defined in the `~/.ssh/known_hosts` fil
127129
try{
128130
gitManager.cloneOrCreate(base)
129131

130-
def jsonMap = base.listFiles().collect {file ->
131-
return [name: file.name, directory: file.directory, file: file.file, path: file.absolutePath]
132+
if (!Boolean.parseBoolean((String) configuration.get(GIT_LOG_DISABLE))) {
133+
def jsonMap = base.listFiles().collect { file ->
134+
return [name: file.name, directory: file.directory, file: file.file, path: file.absolutePath]
135+
}
136+
def json = JsonOutput.toJson(jsonMap)
137+
logger.log(2, json, meta)
132138
}
133-
def json = JsonOutput.toJson(jsonMap)
134-
logger.log(2, json, meta)
135139

136140
}catch(Exception e){
137141
logger.log(0, e.getMessage())

src/main/groovy/com/rundeck/plugin/GitResourceModelFactory.groovy

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ class GitResourceModelFactory implements ResourceModelSourceFactory,Describable
3131

3232
public final static String GIT_URL="gitUrl"
3333
public final static String GIT_BASE_DIRECTORY="gitBaseDirectory"
34+
public final static String GIT_LOG_DISABLE ="gitLogDisable"
3435
public final static String GIT_FILE="gitFile"
3536
public final static String GIT_FORMAT_FILE="gitFormatFile"
3637
public final static String GIT_BRANCH="gitBranch"
@@ -66,6 +67,8 @@ Some examples:
6667
null,null,null, renderingOptionsConfig))
6768
.property(PropertyUtil.string(GIT_BRANCH, "Branch", "Checkout branch.", true,
6869
"master",null,null, renderingOptionsConfig))
70+
.property(PropertyUtil.bool(GIT_LOG_DISABLE, "Disable log output", "Enabling this flag, the plugin will not show the output log", true,
71+
"false",null, renderingOptionsConfig))
6972
.property(PropertyUtil.string(GIT_FILE, "Resource model File", "Resource model file inside the github repo.", true,
7073
null,null,null, renderingOptionsConfig))
7174
.property(PropertyUtil.select(GIT_FORMAT_FILE, "File Format", 'File Format', true,

0 commit comments

Comments
 (0)