Fixed `Jenkinsfile.rb` to correctly propagate --project and --arch to `rake`
authorJan Vrany <jan.vrany@fit.cvut.cz>
Fri, 27 May 2016 23:09:29 +0100
changeset 20 0b7a237a445b
parent 18 647bee28090f
child 21 b7d408d81118
Fixed `Jenkinsfile.rb` to correctly propagate --project and --arch to `rake` Since `Jenkinsfile.rb` does not spawn a subprocess but rather executes rake within the same process, PROJECT and ARCH must be defined as Ruby constants rather than as plain environment variables.
Jenkinsfile.rb
--- a/Jenkinsfile.rb	Fri May 27 21:38:36 2016 +0100
+++ b/Jenkinsfile.rb	Fri May 27 23:09:29 2016 +0100
@@ -11,10 +11,12 @@
     opts.banner = "Usage: #{$0} [TASK1 [TASK2 [...]]\n"
     opts.on('-p', '--project PROJECT', "PROJECT to build. Overrides project specified by the environment variable.") do | value |
       ENV['PROJECT'] = value
+      self.class.const_set('PROJECT', value)  
     end
 
     opts.on('-a', '--arch ARCH', "Arcitecture to build for. Overrides project specified by the environment variable.") do | value |
       ENV['ARCH'] = value
+      self.class.const_set('ARCH', value)  
     end
 
     opts.on(nil, '--help', "Prints this message") do