-
-
Save robsyme/6e5134ef3f5bd6d92fcbcfa088b4fbb6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'json' | |
require 'optparse' | |
options = {} | |
OptionParser.new do |opt| | |
opt.on('--report FILENAME') { |report| options[:report] = report } | |
end.parse! | |
inputs = JSON.parse(ARGF.read) | |
File.open(options[:report], 'w') do |report| | |
if inputs["fav_colour"] != "maroon" | |
report.puts "Reports do not pass" | |
exit 100 | |
else | |
report.puts "Everything looks good" | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'optparse' | |
require 'json' | |
options = {} | |
OptionParser.new do |opt| | |
opt.on('--iteration INT') { |it| | |
iteration = it.to_i | |
case iteration | |
when 0..2 | |
options["effort"] = "light" | |
when 3..5 | |
options["effort"] = "moderate" | |
else | |
options["effort"] = "extreme" | |
end | |
case iteration | |
when 0..1 | |
options["fav_colour"] = "green" | |
when 2..6 | |
options["fav_colour"] = "purple" | |
else | |
options["fav_colour"] = "maroon" | |
end | |
} | |
end.parse! | |
puts JSON.pretty_generate(options) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
process Foo { | |
output: | |
path("*") | |
"touch out.{1,2,3,4,5,6,7,8}.txt" | |
} | |
process Bar { | |
errorStrategy { task.exitStatus == 100 ? 'retry' : 'terminate' } | |
maxRetries 20 | |
input: | |
path(infiles) | |
output: | |
path("report.html") | |
""" | |
generate_params --iteration ${task.attempt} > params.txt | |
bar params.txt --report report.html | |
""" | |
} | |
workflow { | |
Foo() | Bar | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment