[tarantool-patches] [PATCH v2] gitlab-ci: clean up .gitlab-ci.yml

Alexander V. Tikhonov avtikhon at tarantool.org
Fri Aug 23 15:42:28 MSK 2019


Cleaned up the .gitlab-ci.yml file from duplicating
code - added templates that storres the needed
configuration values for different jobs.
Also moved the static_build from 'deploy' tag to
'deploy_test' tag to be sure that tests will not
be run under high load.
---

Github: https://github.com/tarantool/tarantool/tree/avtikhon/check-full-ci

 .gitlab-ci.yml | 255 ++++++++++++++-----------------------------------
 1 file changed, 70 insertions(+), 185 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index f160c276b..431730b67 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -2,33 +2,65 @@ stages:
   - test
 
 variables:
-  IMAGE_TEST: "${CI_REGISTRY}/${CI_PROJECT_PATH}/testing/debian-stretch:latest"
-  IMAGE_TEST_LTO: "${CI_REGISTRY}/${CI_PROJECT_PATH}/testing/debian-buster:latest"
   GITLAB_MAKE: "make -f .gitlab.mk"
 
-# Tests
+# Jobs templates
 
-release:
-  image: ${IMAGE_TEST}
+.release_only_template: &release_only_definition
+  only:
+    refs:
+      - master
+      - /^.*-full-ci$/
+
+.docker_test_template: &docker_test_definition
+  image: "${CI_REGISTRY}/${CI_PROJECT_PATH}/testing/debian-stretch:latest"
   stage: test
   tags:
     - docker_test
-  script:
-    - ${GITLAB_MAKE} test_debian_no_deps
 
-debug:
-  image: ${IMAGE_TEST}
+.docker_test_clang8_template: &docker_test_clang8_definition
+  image: "${CI_REGISTRY}/${CI_PROJECT_PATH}/testing/debian-buster:latest"
   stage: test
   tags:
     - docker_test
+
+.deploy_template: &deploy_definition
+  <<: *release_only_definition
+  stage: test
+  tags:
+    - deploy
   script:
-    - ${GITLAB_MAKE} test_coverage_debian_no_deps
+    - ${GITLAB_MAKE} package
 
-release_clang:
-  image: ${IMAGE_TEST}
+.deploy_test_template: &deploy_test_definition
+  <<: *release_only_definition
   stage: test
   tags:
-    - docker_test
+    - deploy_test
+  script:
+    - ${GITLAB_MAKE} package
+
+.vbox_template: &vbox_definition
+  stage: test
+  before_script:
+    - ${GITLAB_MAKE} vms_start
+  after_script:
+    - ${GITLAB_MAKE} vms_shutdown
+
+# Tests
+
+release:
+  <<: *docker_test_definition
+  script:
+    - ${GITLAB_MAKE} test_debian_no_deps
+
+debug:
+  <<: *docker_test_definition
+  script:
+    - ${GITLAB_MAKE} test_coverage_debian_no_deps
+
+release_clang:
+  <<: *docker_test_definition
   variables:
     CC: clang
     CXX: clang++
@@ -36,28 +68,16 @@ release_clang:
     - ${GITLAB_MAKE} test_debian_no_deps
 
 release_lto:
-  only:
-    refs:
-      - master
-      - /^.*-full-ci$/
-  image: ${IMAGE_TEST_LTO}
-  stage: test
-  tags:
-    - docker_test
+  <<: *release_only_definition
+  <<: *docker_test_clang8_definition
   variables:
     CMAKE_EXTRA_PARAMS: -DENABLE_LTO=ON
   script:
     - ${GITLAB_MAKE} test_debian_no_deps
 
 release_lto_clang8:
-  only:
-    refs:
-      - master
-      - /^.*-full-ci$/
-  image: ${IMAGE_TEST_LTO}
-  stage: test
-  tags:
-    - docker_test
+  <<: *release_only_definition
+  <<: *docker_test_clang8_definition
   variables:
     CC: clang-8
     CXX: clang++-8
@@ -66,53 +86,36 @@ release_lto_clang8:
     - ${GITLAB_MAKE} test_debian_no_deps
 
 release_asan_clang8:
-  image: ${IMAGE_TEST_LTO}
-  stage: test
-  tags:
-    - docker_test
+  <<: *docker_test_clang8_definition
   script:
     - ${GITLAB_MAKE} test_asan_debian_no_deps
 
 osx_13_release:
-  only:
-    refs:
-      - master
-      - /^.*-full-ci$/
-  stage: test
+  <<: *release_only_definition
+  <<: *vbox_definition
   tags:
     - vms_osx_13
   variables:
     VMS_NAME: 'osx_13'
     VMS_USER: 'tarantool'
     VMS_PORT: '2212'
-  before_script:
-    - ${GITLAB_MAKE} vms_start
   script:
     - ${GITLAB_MAKE} vms_test_osx
-  after_script:
-    - ${GITLAB_MAKE} vms_shutdown
 
 osx_14_release:
-  stage: test
+  <<: *vbox_definition
   tags:
     - vms_osx_14
   variables:
     VMS_NAME: 'osx_14'
     VMS_USER: 'tarantool'
     VMS_PORT: '2222'
-  before_script:
-    - ${GITLAB_MAKE} vms_start
   script:
     - ${GITLAB_MAKE} vms_test_osx
-  after_script:
-    - ${GITLAB_MAKE} vms_shutdown
 
 osx_14_release_lto:
-  only:
-    refs:
-      - master
-      - /^.*-full-ci$/
-  stage: test
+  <<: *release_only_definition
+  <<: *vbox_definition
   tags:
     - vms_osx_14
   variables:
@@ -120,15 +123,11 @@ osx_14_release_lto:
     VMS_NAME: 'osx_14'
     VMS_USER: 'tarantool'
     VMS_PORT: '2222'
-  before_script:
-    - ${GITLAB_MAKE} vms_start
   script:
     - ${GITLAB_MAKE} vms_test_osx
-  after_script:
-    - ${GITLAB_MAKE} vms_shutdown
 
 freebsd_12_release:
-  stage: test
+  <<: *vbox_definition
   tags:
     - vms_freebsd_12
   variables:
@@ -136,205 +135,91 @@ freebsd_12_release:
     VMS_USER: 'vagrant'
     VMS_PORT: '2232'
     MAKE: 'gmake'
-  before_script:
-    - ${GITLAB_MAKE} vms_start
   script:
     - ${GITLAB_MAKE} vms_test_freebsd
-  after_script:
-    - ${GITLAB_MAKE} vms_shutdown
 
 # Packs
 
 centos_6:
-  only:
-    refs:
-      - master
-      - /^.*-full-ci$/
-  stage: test
-  tags:
-    - deploy
+  <<: *deploy_definition
   variables:
     OS: 'el'
     DIST: '6'
-  script:
-    - ${GITLAB_MAKE} package
 
 centos_7:
-  only:
-    refs:
-      - master
-      - /^.*-full-ci$/
-  stage: test
-  tags:
-    - deploy_test
+  <<: *deploy_test_definition
   variables:
     OS: 'el'
     DIST: '7'
-  script:
-    - ${GITLAB_MAKE} package
 
 fedora_28:
-  only:
-    refs:
-      - master
-      - /^.*-full-ci$/
-  stage: test
-  tags:
-    - deploy_test
+  <<: *deploy_test_definition
   variables:
     OS: 'fedora'
     DIST: '28'
-  script:
-    - ${GITLAB_MAKE} package
 
 fedora_29:
-  only:
-    refs:
-      - master
-      - /^.*-full-ci$/
-  stage: test
-  tags:
-    - deploy_test
+  <<: *deploy_test_definition
   variables:
     OS: 'fedora'
     DIST: '29'
-  script:
-    - ${GITLAB_MAKE} package
 
 fedora_30:
-  only:
-    refs:
-      - master
-      - /^.*-full-ci$/
-  stage: test
-  tags:
-    - deploy_test
+  <<: *deploy_test_definition
   variables:
     OS: 'fedora'
     DIST: '30'
-  script:
-    - ${GITLAB_MAKE} package
 
 ubuntu_14_04:
-  only:
-    refs:
-      - master
-      - /^.*-full-ci$/
-  stage: test
-  tags:
-    - deploy
+  <<: *deploy_definition
   variables:
     OS: 'ubuntu'
     DIST: 'trusty'
-  script:
-    - ${GITLAB_MAKE} package
 
 ubuntu_16_04:
-  only:
-    refs:
-      - master
-      - /^.*-full-ci$/
-  stage: test
-  tags:
-    - deploy
+  <<: *deploy_definition
   variables:
     OS: 'ubuntu'
     DIST: 'xenial'
-  script:
-    - ${GITLAB_MAKE} package
 
 ubuntu_18_04:
-  only:
-    refs:
-      - master
-      - /^.*-full-ci$/
-  stage: test
-  tags:
-    - deploy
+  <<: *deploy_definition
   variables:
     OS: 'ubuntu'
     DIST: 'bionic'
-  script:
-    - ${GITLAB_MAKE} package
 
 ubuntu_18_10:
-  only:
-    refs:
-      - master
-      - /^.*-full-ci$/
-  stage: test
-  tags:
-    - deploy
+  <<: *deploy_definition
   variables:
     OS: 'ubuntu'
     DIST: 'cosmic'
-  script:
-    - ${GITLAB_MAKE} package
 
 ubuntu_19_04:
-  only:
-    refs:
-      - master
-      - /^.*-full-ci$/
-  stage: test
-  tags:
-    - deploy
+  <<: *deploy_definition
   variables:
     OS: 'ubuntu'
     DIST: 'disco'
-  script:
-    - ${GITLAB_MAKE} package
 
 debian_8:
-  only:
-    refs:
-      - master
-      - /^.*-full-ci$/
-  stage: test
-  tags:
-    - deploy
+  <<: *deploy_definition
   variables:
     OS: 'debian'
     DIST: 'jessie'
-  script:
-    - ${GITLAB_MAKE} package
 
 debian_9:
-  only:
-    refs:
-      - master
-      - /^.*-full-ci$/
-  stage: test
-  tags:
-    - deploy
+  <<: *deploy_definition
   variables:
     OS: 'debian'
     DIST: 'stretch'
-  script:
-    - ${GITLAB_MAKE} package
 
 debian_10:
-  only:
-    refs:
-      - master
-      - /^.*-full-ci$/
-  stage: test
-  tags:
-    - deploy
+  <<: *deploy_definition
   variables:
     OS: 'debian'
     DIST: 'buster'
-  script:
-    - ${GITLAB_MAKE} package
 
 static_build:
-  only:
-    refs:
-      - master
-      - /^.*-full-ci$/
-  stage: test
-  tags:
-    - deploy
+  <<: *deploy_test_definition
   variables:
     RUN_TESTS: 'ON'
   script:
-- 
2.17.1





More information about the Tarantool-patches mailing list