Get started with Jenkins

From ETSI Forge
Revision as of 18:26, 6 August 2018 by Carignani (talk | contribs) (Created page with "== Build scripts == The default build command for Jenkins on Forge is as follows: #!/bin/bash bash .jenkins.sh This means that Jenkins will look for a file cal...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Build scripts

The default build command for Jenkins on Forge is as follows:

   #!/bin/bash
   
   bash .jenkins.sh

This means that Jenkins will look for a file called .jenkins.sh (note the dot at the beginning!) and will exectude the shell commands inside.

Guidelines for writing your build script

  • Jenkins uses the returned exit code of the script to determine the outcome of the build:
    • Exit status 0: successful build
    • Exit status 1: build failed

Basic build script example

A very basic example for a script, assuming you need to run the compile command on a text file and check that an HTML file has been created

   #!/bin/bash
   
   compile myfile.txt
   if [ -f myfile.html ] ; then
       exit 0
   else
       exit 1