Difference between revisions of "Get started with Jenkins"

From ETSI Forge
Jump to: navigation, search
(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...")
(No difference)

Revision as of 17:26, 6 August 2018

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