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...")
 
 
Line 1: Line 1:
 +
== Want to run the CI directly in Gitlab? ==
 +
The shared runner in Gitlab needs to be allowed by a Forge Admin. Contact '''cti_support''' at '''etsi''' dot '''org''' for more information.
 +
 
== Build scripts ==
 
== Build scripts ==
  

Latest revision as of 10:08, 2 July 2020

Want to run the CI directly in Gitlab?

The shared runner in Gitlab needs to be allowed by a Forge Admin. Contact cti_support at etsi dot org for more information.

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