.gitlab-ci.yml 3.81 KB
Newer Older
1

2 3
image: ubuntu:16.04

Emeric Verschuur's avatar
Emeric Verschuur committed
4
variables:
5
  GLOBALJOBVAR: "global variable"
Emeric Verschuur's avatar
Emeric Verschuur committed
6 7 8 9

after_script:
  - echo "job ${CI_JOB_NAME} end"

10
job-minimal:
11
  stage: build
Emeric Verschuur's avatar
Emeric Verschuur committed
12 13
  tags:
    - docker
14
  script:
Emeric Verschuur's avatar
Emeric Verschuur committed
15
    - echo "Hello world"
16

Emeric Verschuur's avatar
Emeric Verschuur committed
17
job-with-before-after-script:
18
  stage: build
Emeric Verschuur's avatar
Emeric Verschuur committed
19 20
  tags:
    - docker
Emeric Verschuur's avatar
Emeric Verschuur committed
21 22
  before_script:
    - echo "executed before"
23
  script:
Emeric Verschuur's avatar
Emeric Verschuur committed
24 25 26 27 28 29
    - echo "script"
      "on several"
    - echo "lines"
    - cat <<< $(echo 'hi!')
  after_script:
    - echo "executed after"
30

Emeric Verschuur's avatar
Emeric Verschuur committed
31
job-advanced:
32
  image: ubuntu:16.04
33
  stage: build
Emeric Verschuur's avatar
Emeric Verschuur committed
34 35
  tags:
    - docker
Emeric Verschuur's avatar
Emeric Verschuur committed
36 37
  variables:
    JOBADVAR: "${CI_JOB_NAME} JOBADVAR value"
38
  script:
Emeric Verschuur's avatar
Emeric Verschuur committed
39 40
    - echo ${GLOBALJOBVAR}
    - echo ${JOBADVAR}
41
    - ci-scripts/run-job-script.sh
42

43
job-test-services-mysql:
44 45 46 47
  stage: build
  variables:
    MYSQL_DATABASE: test
    MYSQL_ROOT_PASSWORD: password
48
  image: mysql
49 50
  services:
    - mysql
51
  tags:
Emeric Verschuur's avatar
Emeric Verschuur committed
52
    - docker
53
  script:
54 55 56 57
    - printf "Waiting for mysql";
      while ! mysql -h mysql -u root -ppassword test -e '' > /dev/null 2>&1 ;
      do printf "."; sleep 1; done;
      printf " done!\n"
58 59 60 61 62 63
    - mysql -h mysql -u root -ppassword test -e 'SHOW VARIABLES LIKE "%version%";'

job-test-services-postgres:
  stage: build
  image: postgres:9.4
  services:
64 65 66 67 68
    - name: postgres:9.4
      alias: db-postgres
      entrypoint: ["docker-entrypoint.sh"]
      command: ["postgres"]
  tags:
Emeric Verschuur's avatar
Emeric Verschuur committed
69
    - docker
70
  script:
71 72 73 74
    - printf "Waiting for postgres";
      while ! psql -h db-postgres -U postgres -c '' > /dev/null 2>&1 ;
      do printf "."; sleep 1; done;
      printf " done!\n"
75
    - psql -h db-postgres -U postgres -c 'select version();'
76 77 78 79 80 81 82 83 84

##################################################
#             ### PACKAGE BUILD ###              #
##################################################

.build-package-template: &build-package-template
  image: registry.gitlab.com/ercom/docker-images/fpm:1.10.0-ubuntu-16.04
  stage: build
  variables:
85
    CITBX_JOB_FILE_NAME: build-package.sh
86 87 88 89 90 91 92 93 94
  tags:
    - docker
  script:
    - ci-scripts/run-job-script.sh

.package-channel-dev: &package-channel-dev
  except:
    - tags
    - master
95
    - experimental
96 97 98 99 100

.package-channel-rel: &package-channel-rel
  only:
    - tags
    - master
101
    - experimental
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121

.build-package-dev: &build-package-dev
  <<: *build-package-template
  <<: *package-channel-dev
  artifacts:
    paths:
    - artifacts/
    expire_in: 7d

.build-package-rel: &build-package-rel
  <<: *build-package-template
  <<: *package-channel-rel
  artifacts:
    paths:
    - artifacts/

build-package-dev-deb: *build-package-dev
build-package-dev-rpm: *build-package-dev
build-package-rel-deb: *build-package-rel
build-package-rel-rpm: *build-package-rel
122 123 124 125 126 127 128 129

##################################################
#          ### PACKAGE TESTSUITES ###            #
##################################################

.test-package-template: &test-package-template
  stage: test
  variables:
130
    CITBX_JOB_FILE_NAME: test-package.sh
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164
  tags: ["docker"]
  script: ["ci-scripts/run-job-script.sh"]

test-package-deb-dev-ubuntu-18.04:
  image: ubuntu:16.04
  dependencies: ["build-package-dev-deb"]
  <<: *test-package-template
  <<: *package-channel-dev
test-package-deb-dev-ubuntu-16.04:
  image: ubuntu:16.04
  dependencies: ["build-package-dev-deb"]
  <<: *test-package-template
  <<: *package-channel-dev
test-package-rpm-dev-fedora-27:
  image: fedora:27
  dependencies: ["build-package-dev-rpm"]
  <<: *test-package-template
  <<: *package-channel-dev

test-package-deb-rel-ubuntu-18.04:
  image: ubuntu:16.04
  dependencies: ["build-package-rel-deb"]
  <<: *test-package-template
  <<: *package-channel-rel
test-package-deb-rel-ubuntu-14.04:
  image: ubuntu:16.04
  dependencies: ["build-package-rel-deb"]
  <<: *test-package-template
  <<: *package-channel-rel
test-package-rpm-rel-fedora-27:
  image: fedora:27
  dependencies: ["build-package-rel-rpm"]
  <<: *test-package-template
  <<: *package-channel-rel