From fcd48d66efc980feac0b6390eada471518cb540e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Coutable?= Date: Fri, 17 Apr 2020 18:28:23 +0200 Subject: Set default, workflow, and use rules in CI config MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Rémy Coutable --- .gitlab-ci.yml | 59 +++++++++++++++++++++++++++++++++++----------------------- 1 file changed, 36 insertions(+), 23 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 638f916..e351fd1 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,4 +1,33 @@ -.test: &test_definition +variables: + DOCKER_VERSION: "19.03.0" + +workflow: + rules: + # For merge requests, create a pipeline. + - if: '$CI_MERGE_REQUEST_IID' + # For `master` branch, create a pipeline (this includes on schedules, pushes, merges, etc.). + - if: '$CI_COMMIT_BRANCH == "master"' + # For tags, create a pipeline. + - if: '$CI_COMMIT_TAG' + +default: + image: golang:1.12 + tags: + - gitlab-org + +.use-docker-in-docker: + image: docker:${DOCKER_VERSION} + services: + - docker:${DOCKER_VERSION}-dind + variables: + DOCKER_DRIVER: overlay2 + DOCKER_HOST: tcp://docker:2375 + DOCKER_TLS_CERTDIR: "" + tags: + # See https://gitlab.com/gitlab-com/www-gitlab-com/-/issues/7019 for tag descriptions + - gitlab-org-docker + +.test: before_script: # Set up the environment to run integration tests (still written in Ruby) - apt-get update -qq && apt-get install -y ruby ruby-dev @@ -15,25 +44,20 @@ - make verify test go:1.12: - <<: *test_definition + extends: .test image: golang:1.12 go:1.13: - <<: *test_definition + extends: .test image: golang:1.13 go:1.14: - <<: *test_definition + extends: .test image: golang:1.14 codequality: - image: docker:stable - variables: - DOCKER_DRIVER: overlay2 + extends: .use-docker-in-docker allow_failure: true - services: - - docker:stable-dind - before_script: [] script: - export SP_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/') - docker run @@ -45,13 +69,8 @@ codequality: paths: [codeclimate.json] sast: - image: docker:stable - variables: - DOCKER_DRIVER: overlay2 + extends: .use-docker-in-docker allow_failure: true - services: - - docker:stable-dind - before_script: [] script: - export SP_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/') - docker run @@ -63,13 +82,8 @@ sast: paths: [gl-sast-report.json] dependency_scanning: - image: docker:stable - variables: - DOCKER_DRIVER: overlay2 + extends: .use-docker-in-docker allow_failure: true - services: - - docker:stable-dind - before_script: [] script: - export SP_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/') - docker run @@ -93,4 +107,3 @@ code_navigation: artifacts: paths: - lsif/ - -- cgit v1.2.1