.gitlab-ci.yml 1.37 KB
Newer Older
Philippe Charrière's avatar
first  
Philippe Charrière committed
1
2
stages:
  - greetings
Philippe Charrière's avatar
second    
Philippe Charrière committed
3
  - christmas_songs
Philippe Charrière's avatar
calc 1    
Philippe Charrière committed
4
  - calculator
Philippe Charrière's avatar
Philippe Charrière committed
5
  - display_variables
Philippe Charrière's avatar
Philippe Charrière committed
6
  - polyglot
Philippe Charrière's avatar
second    
Philippe Charrière committed
7
8
9

variables:
  message: "Happy Christmas!"
Philippe Charrière's avatar
first  
Philippe Charrière committed
10

Philippe Charrière's avatar
calc 1    
Philippe Charrière committed
11
.before_script:
Philippe Charrière's avatar
Philippe Charrière committed
12
13
  - echo "Hello I'm the before script"

Philippe Charrière's avatar
calc 1    
Philippe Charrière committed
14
.after_script:
Philippe Charrière's avatar
Philippe Charrière committed
15
16
17
  - echo "Hello I'm the after script"


Philippe Charrière's avatar
calc 1    
Philippe Charrière committed
18
.hello:
Philippe Charrière's avatar
first  
Philippe Charrière committed
19
20
21
22
  stage: greetings
  script:
    - echo "hello world!"

Philippe Charrière's avatar
calc 1    
Philippe Charrière committed
23
.hey:
Philippe Charrière's avatar
first  
Philippe Charrière committed
24
  stage: greetings
Philippe Charrière's avatar
Philippe Charrière committed
25
26
27
28
  before_script:
    - echo "Before hey job"
  after_script:
    - echo "After hey job"  
Philippe Charrière's avatar
first  
Philippe Charrière committed
29
30
  script:
    - echo "hey what's up?"
Philippe Charrière's avatar
second    
Philippe Charrière committed
31

Philippe Charrière's avatar
calc 1    
Philippe Charrière committed
32
.first_song:
Philippe Charrière's avatar
second    
Philippe Charrière committed
33
34
35
36
37
38
  stage: christmas_songs
  variables:
    song: "Jingle Bells"
  script:
    - echo "${message}, ${song}"

Philippe Charrière's avatar
calc 1    
Philippe Charrière committed
39
.second_song:
Philippe Charrière's avatar
second    
Philippe Charrière committed
40
41
42
43
44
  stage: christmas_songs
  variables:
    song: "Let It Snow!"
  script:
    - echo "${message}, ${song}"
Philippe Charrière's avatar
calc 1    
Philippe Charrière committed
45

Philippe Charrière's avatar
Philippe Charrière committed
46
.tools: &tools |
Philippe Charrière's avatar
Philippe Charrière committed
47
48
  function add() {
    echo $(( $1 + $2 ))
Philippe Charrière's avatar
Philippe Charrière committed
49
50
  }

Philippe Charrière's avatar
Philippe Charrière committed
51
.addition:
Philippe Charrière's avatar
calc 1    
Philippe Charrière committed
52
  stage: calculator
Philippe Charrière's avatar
Philippe Charrière committed
53
54
55
  variables:
    x: 40
    y: 2
Philippe Charrière's avatar
Philippe Charrière committed
56
57
  before_script:
    - *tools
Philippe Charrière's avatar
calc 1    
Philippe Charrière committed
58
  script: |
Philippe Charrière's avatar
Philippe Charrière committed
59
    add $x $y
Philippe Charrière's avatar
Philippe Charrière committed
60

Philippe Charrière's avatar
Philippe Charrière committed
61
.ci_variables:
Philippe Charrière's avatar
Philippe Charrière committed
62
63
64
65
66
67
  stage: display_variables
  script: |
    echo $FIRST_NAME
    echo $LAST_NAME
    echo $MESSAGE

Philippe Charrière's avatar
Philippe Charrière committed
68
.predefined_variables:
Philippe Charrière's avatar
Philippe Charrière committed
69
70
  stage: display_variables
  script: |
Philippe Charrière's avatar
Philippe Charrière committed
71
72
    echo "Branch's name: $CI_COMMIT_REF_NAME"
    echo "Title of the commit: $CI_COMMIT_TITLE"
Philippe Charrière's avatar
Philippe Charrière committed
73

Philippe Charrière's avatar
Philippe Charrière committed
74
75
76
77
78
hello_python:
  image: python:slim
  stage: polyglot
  variables: 
    MESSAGE: "Hello from Python"
Philippe Charrière's avatar
update    
Philippe Charrière committed
79
80
81
82
    SOURCE_CODE: |
      import os
      message = os.environ.get('MESSAGE')
      print(message)
Philippe Charrière's avatar
Philippe Charrière committed
83

Philippe Charrière's avatar
update    
Philippe Charrière committed
84
85
  script: 
    - python -c "$SOURCE_CODE"