File tree Expand file tree Collapse file tree 6 files changed +41
-1
lines changed Expand file tree Collapse file tree 6 files changed +41
-1
lines changed Original file line number Diff line number Diff line change @@ -73,6 +73,11 @@ The following table lists the properties that can be accessed on the `workflow`
7373` workflow.manifest `
7474: Entries of the workflow manifest.
7575
76+ ` workflow.preview `
77+ : :::{versionadded} 24.04.0
78+ :::
79+ : Returns ` true ` whenever the current instance is a preview execution.
80+
7681` workflow.profile `
7782: Used configuration profile.
7883
Original file line number Diff line number Diff line change @@ -153,6 +153,11 @@ class Session implements ISession {
153153 */
154154 boolean stubRun
155155
156+ /**
157+ * Enable preview mode
158+ */
159+ boolean preview
160+
156161 /**
157162 * Folder(s) containing libs and classes to be added to the classpath
158163 */
@@ -345,6 +350,9 @@ class Session implements ISession {
345350 // -- dry run
346351 this . stubRun = config. stubRun
347352
353+ // -- preview
354+ this . preview = config. preview
355+
348356 // -- normalize taskConfig object
349357 if ( config. process == null ) config. process = [:]
350358 if ( config. env == null ) config. env = [:]
Original file line number Diff line number Diff line change @@ -545,6 +545,9 @@ class ConfigBuilder {
545545 if ( cmdRun. stubRun )
546546 config. stubRun = cmdRun. stubRun
547547
548+ if ( cmdRun. preview )
549+ config. preview = cmdRun. preview
550+
548551 // -- sets the working directory
549552 if ( cmdRun. workDir )
550553 config. workDir = cmdRun. workDir
Original file line number Diff line number Diff line change @@ -189,6 +189,11 @@ class WorkflowMetadata {
189189 */
190190 boolean stubRun
191191
192+ /**
193+ * Returns ``true`` whenever the current instance is in preview mode
194+ */
195+ boolean preview
196+
192197 /**
193198 * Which container engine was used to execute the workflow
194199 */
@@ -253,6 +258,7 @@ class WorkflowMetadata {
253258 this . sessionId = session. uniqueId
254259 this . resume = session. resumeMode
255260 this . stubRun = session. stubRun
261+ this . preview = session. preview
256262 this . runName = session. runName
257263 this . containerEngine = containerEngine0(session)
258264 this . configFiles = session. configFiles?. collect { it. toAbsolutePath() }
Original file line number Diff line number Diff line change @@ -1873,7 +1873,22 @@ class ConfigBuilderTest extends Specification {
18731873 then :
18741874 config. stubRun == true
18751875 }
1876-
1876+
1877+ def ' should configure preview mode' () {
1878+ given :
1879+ Map config
1880+
1881+ when :
1882+ config = new ConfigBuilder (). setCmdRun(new CmdRun ()). build()
1883+ then :
1884+ ! config. preview
1885+
1886+ when :
1887+ config = new ConfigBuilder (). setCmdRun(new CmdRun (preview : true )). build()
1888+ then :
1889+ config. preview == true
1890+ }
1891+
18771892 def ' should merge profiles' () {
18781893 given :
18791894 def ENV = [:]
Original file line number Diff line number Diff line change @@ -96,6 +96,7 @@ class WorkflowMetadataTest extends Specification {
9696 metadata. configFiles == [Paths . get(' foo' ). toAbsolutePath(), Paths . get(' bar' ). toAbsolutePath()]
9797 metadata. resume == false
9898 metadata. stubRun == false
99+ metadata. preview == false
99100 metadata. userName == System . getProperty(' user.name' )
100101 metadata. homeDir == Paths . get(System . getProperty(' user.home' ))
101102 metadata. manifest. version == ' 1.0.0'
@@ -114,11 +115,13 @@ class WorkflowMetadataTest extends Specification {
114115 session. profile >> ' foo_profile'
115116 session. resumeMode >> true
116117 session. stubRun >> true
118+ session. preview >> true
117119 metadata = new WorkflowMetadata (session, script)
118120 then :
119121 metadata. profile == ' foo_profile'
120122 metadata. resume
121123 metadata. stubRun
124+ metadata. preview
122125 }
123126
124127 def foo_test_method () {
You can’t perform that action at this time.
0 commit comments