File tree 6 files changed +41
-1
lines changed
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`
73
73
` workflow.manifest `
74
74
: Entries of the workflow manifest.
75
75
76
+ ` workflow.preview `
77
+ : :::{versionadded} 24.04.0
78
+ :::
79
+ : Returns ` true ` whenever the current instance is a preview execution.
80
+
76
81
` workflow.profile `
77
82
: Used configuration profile.
78
83
Original file line number Diff line number Diff line change @@ -153,6 +153,11 @@ class Session implements ISession {
153
153
*/
154
154
boolean stubRun
155
155
156
+ /**
157
+ * Enable preview mode
158
+ */
159
+ boolean preview
160
+
156
161
/**
157
162
* Folder(s) containing libs and classes to be added to the classpath
158
163
*/
@@ -345,6 +350,9 @@ class Session implements ISession {
345
350
// -- dry run
346
351
this . stubRun = config. stubRun
347
352
353
+ // -- preview
354
+ this . preview = config. preview
355
+
348
356
// -- normalize taskConfig object
349
357
if ( config. process == null ) config. process = [:]
350
358
if ( config. env == null ) config. env = [:]
Original file line number Diff line number Diff line change @@ -545,6 +545,9 @@ class ConfigBuilder {
545
545
if ( cmdRun. stubRun )
546
546
config. stubRun = cmdRun. stubRun
547
547
548
+ if ( cmdRun. preview )
549
+ config. preview = cmdRun. preview
550
+
548
551
// -- sets the working directory
549
552
if ( cmdRun. workDir )
550
553
config. workDir = cmdRun. workDir
Original file line number Diff line number Diff line change @@ -189,6 +189,11 @@ class WorkflowMetadata {
189
189
*/
190
190
boolean stubRun
191
191
192
+ /**
193
+ * Returns ``true`` whenever the current instance is in preview mode
194
+ */
195
+ boolean preview
196
+
192
197
/**
193
198
* Which container engine was used to execute the workflow
194
199
*/
@@ -253,6 +258,7 @@ class WorkflowMetadata {
253
258
this . sessionId = session. uniqueId
254
259
this . resume = session. resumeMode
255
260
this . stubRun = session. stubRun
261
+ this . preview = session. preview
256
262
this . runName = session. runName
257
263
this . containerEngine = containerEngine0(session)
258
264
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 {
1873
1873
then :
1874
1874
config. stubRun == true
1875
1875
}
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
+
1877
1892
def ' should merge profiles' () {
1878
1893
given :
1879
1894
def ENV = [:]
Original file line number Diff line number Diff line change @@ -96,6 +96,7 @@ class WorkflowMetadataTest extends Specification {
96
96
metadata. configFiles == [Paths . get(' foo' ). toAbsolutePath(), Paths . get(' bar' ). toAbsolutePath()]
97
97
metadata. resume == false
98
98
metadata. stubRun == false
99
+ metadata. preview == false
99
100
metadata. userName == System . getProperty(' user.name' )
100
101
metadata. homeDir == Paths . get(System . getProperty(' user.home' ))
101
102
metadata. manifest. version == ' 1.0.0'
@@ -114,11 +115,13 @@ class WorkflowMetadataTest extends Specification {
114
115
session. profile >> ' foo_profile'
115
116
session. resumeMode >> true
116
117
session. stubRun >> true
118
+ session. preview >> true
117
119
metadata = new WorkflowMetadata (session, script)
118
120
then :
119
121
metadata. profile == ' foo_profile'
120
122
metadata. resume
121
123
metadata. stubRun
124
+ metadata. preview
122
125
}
123
126
124
127
def foo_test_method () {
You can’t perform that action at this time.
0 commit comments