Skip to content

Commit fe62679

Browse files
authored
Merge pull request #14 from mad-mags/master
Added option to hide log output after git clone in rundeck output tab
2 parents ef1703b + 11ed487 commit fe62679

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

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

+9-4
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ class GitCloneWorkflowStep implements StepPlugin, Describable{
2828

2929
public final static String GIT_URL="gitUrl"
3030
public final static String GIT_BASE_DIRECTORY="gitBaseDirectory"
31+
public final static String GIT_LOG_DISABLE ="gitLogDisable"
3132
public final static String GIT_BRANCH="gitBranch"
3233
public final static String GIT_HOSTKEY_CHECKING="strictHostKeyChecking"
3334
public final static String GIT_KEY_STORAGE="gitKeyPath"
@@ -62,6 +63,8 @@ class GitCloneWorkflowStep implements StepPlugin, Describable{
6263
null,null,null, renderingOptionsConfig))
6364
.property(PropertyUtil.string(GIT_BRANCH, "Branch", "Checkout branch.", true,
6465
"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))
6568
.property(PropertyUtil.string(GIT_PASSWORD_STORAGE, "Git Password", 'Password to authenticate remotely', false,
6669
null,null,null, renderingOptionsAuthenticationPassword))
6770
.property(PropertyUtil.select(GIT_HOSTKEY_CHECKING, "SSH: Strict Host Key Checking", '''Use strict host key checking.
@@ -126,11 +129,13 @@ If `yes`, require remote host SSH key is defined in the `~/.ssh/known_hosts` fil
126129
try{
127130
gitManager.cloneOrCreate(base)
128131

129-
def jsonMap = base.listFiles().collect {file ->
130-
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)
131138
}
132-
def json = JsonOutput.toJson(jsonMap)
133-
logger.log(2, json, meta)
134139

135140
}catch(Exception e){
136141
logger.log(0, e.getMessage())

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

+3
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)