Jenkinsfile.rb: added new target `jenkins:job`
authorJan Vrany <jan.vrany@fit.cvut.cz>
Mon, 30 May 2016 23:05:25 +0100
changeset 24 ae6fc15070e4
parent 23 7dad21b22558
child 25 7ef6e0216e9c
Jenkinsfile.rb: added new target `jenkins:job` ...run when no targets are given to `Jenkinsfile.rb` on command line. This job does everything - checks out & updates existing code, (re)compiles, run tests and static analysis and finally create build artifacts.
Jenkinsfile.rb
Rakefile
rakelib/dist-jv.rake
rakelib/install.rake
--- a/Jenkinsfile.rb	Sun May 29 07:14:09 2016 +0000
+++ b/Jenkinsfile.rb	Mon May 30 23:05:25 2016 +0100
@@ -1,6 +1,7 @@
 #!/usr/bin/ruby
 DOCUMENTATION = <<DOCEND
 A help script to build a Smalltalk/X jv-branch (mainly) on a Jenkins CI. 
+If no TARGET is given, invokes target `jenkins:job`.
 
 DOCEND
 
@@ -8,7 +9,7 @@
 
 def run()
   optparse = OptionParser.new do | opts |
-    opts.banner = "Usage: #{$0} [TASK1 [TASK2 [...]]\n"
+    opts.banner = "Usage: #{$0} [TARGET1 [TARGET1 [...]]\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)  
@@ -34,6 +35,11 @@
   ENV['WORKSPACE'] ||= '.'
   ENV['BUILD_NUMBER'] ||= Time.now.strftime("%Y%m%d")
   ENV['JOB_NAME'] ||= 'interactive'
+
+  # If no target is given, run target jenkins:job
+  if ARGV.size == 0 then
+    ARGV << 'jenkins:job'
+  end
   
   # When run under Jenkins, we do want to see full backtrace if something
   # fails. 
--- a/Rakefile	Sun May 29 07:14:09 2016 +0000
+++ b/Rakefile	Mon May 30 23:05:25 2016 +0100
@@ -17,3 +17,4 @@
 
 task :'post'                  
 
+task :'jenkins:job' => [ :'setup', :'checkout', :'update', :'compile', :'test', :'lint', :'artifacts' ]
--- a/rakelib/dist-jv.rake	Sun May 29 07:14:09 2016 +0000
+++ b/rakelib/dist-jv.rake	Mon May 30 23:05:25 2016 +0100
@@ -48,9 +48,6 @@
 
   end
 
-
-
-  desc "Installs Smalltalk/X jv-branch into #{ARTIFACTS_DIR}/${BUILD_NAME}"
   task :'all' => [:'pre', :'main',:'post']
 
   task :'pre'
--- a/rakelib/install.rake	Sun May 29 07:14:09 2016 +0000
+++ b/rakelib/install.rake	Mon May 30 23:05:25 2016 +0100
@@ -1,4 +1,5 @@
 
+desc "Install project into INSTALL_DIR"
 task :'install' => [ :'compile',
                      :'install:pre',
                      :'install:main',
@@ -10,6 +11,7 @@
   task :'main'  
 end
 
+desc "Create build artifacts, e.g., deployable archives & packages"
 task :'artifacts' => [ :'install',
                      :'artifacts:pre',
                      :'artifacts:main',