.gitlab-ci.yml 4.06 KB
Newer Older
1
stages:
2
  - prepare-assets
3 4
  - trigger-package
  - trigger-docker
5
  - trigger-ha-validate
6
  - trigger-qa
Balasankar "Balu" C's avatar
Balasankar "Balu" C committed
7
  - check
8
  - prepare
9
  - tests
10
  - post-test
11 12
  - gitlab_com:package
  - gitlab_com:upload_deploy
13
  - package-and-image
14
  - scan-dependencies
15
  - staging_upload
16
  - package-and-image-release
Ian Baum's avatar
Ian Baum committed
17
  - validate
18
  - metrics
19
  - slow_jobs
20
  - raspbian-release
21
  - aws-marketplace-release
22
  - notification_fail
23

24
variables:
25
  BUILDER_IMAGE_REGISTRY: "dev.gitlab.org:5005/cookbooks/gitlab-omnibus-builder"
26
  PUBLIC_BUILDER_IMAGE_REGISTRY: "registry.gitlab.com/gitlab-org/gitlab-omnibus-builder"
27
  BUILDER_IMAGE_REVISION: "0.0.41"
28 29 30 31 32 33
  # The registry to pull the assets image from
  ASSET_REGISTRY: "${CI_REGISTRY}"
  ASSET_SYNC_EXISTING_REMOTE_FILES: "keep"
  ASSET_SYNC_GZIP_COMPRESSION: "true"
  ASSET_PATH: "assets-${CI_COMMIT_REF_SLUG}"
  COMPILE_ASSETS: "false"
Ian Baum's avatar
Ian Baum committed
34
  RUBY_IMAGE: "ruby:2.5"
35 36 37 38 39
  # Format of the auto-deploy tag for auto-deploy builds.
  # https://gitlab.com/gitlab-org/release/docs/blob/master/general/deploy/auto-deploy.md#auto-deploy-tagging
  AUTO_DEPLOY_TAG_REGEX: '^\d+\.\d+\.\d+\+[^ ]{7,}\.[^ ]{7,}$'
  # Default environment for auto-deploy
  AUTO_DEPLOY_ENVIRONMENT: 'pre'
40
  MAX_PACKAGE_SIZE_MB: "720"
41

42 43 44 45
### For services that need a docker daemon
.docker_job: &docker_job
  image: "${BUILDER_IMAGE_REGISTRY}/ruby_docker:${BUILDER_IMAGE_REVISION}"
  variables:
46
    DOCKER_DRIVER: overlay2
47 48 49 50 51 52
    DOCKER_HOST: tcp://docker:2375
  services:
    - docker:dind
  tags:
    - docker

53
before_script:
54
  - export CE_ONLY=(Raspberry)
55
  - export EE_ONLY=(SLES HA-Validate)
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
  - for job in "${CE_ONLY[@]}"; do
      if [[ "${CI_JOB_NAME}" =~ ${job} ]]; then
        if ./support/is_gitlab_ee.sh; then
          echo "EE build found. ${CI_JOB_NAME} is run only on CE builds";
          exit 0 ;
        fi;
      fi;
    done
  - for job in "${EE_ONLY[@]}"; do
      if [[ "${CI_JOB_NAME}" =~ ${job} ]]; then
        if ! ./support/is_gitlab_ee.sh; then
          echo "CE build found. ${CI_JOB_NAME} is run only on EE builds";
          exit 0 ;
        fi;
      fi;
    done
72 73 74 75
  - echo $NIGHTLY
  - mkdir -p ~/.ssh
  - mkdir -p ~/.aws
  - mkdir -p cache
76
  - bundle install -j $(nproc) --binstubs --path gems --without rubocop
77 78 79 80 81 82 83 84 85 86 87
  # If ALTERNATIVE_SOURCES are used, the public mirror for omnibus will be used.
  # This will alter Gemfile.lock file. As part of the build pipeline, we are
  # checking whether the state of the repository is unchanged during the build
  # process, by comparing it with the last commit (So that no unexpected monsters
  # show up). So, an altered Gemfile.lock file will fail on this
  # check. Hence we do a git commit as part of the pipeline if
  # ALTERNATIVE_SOURCES is used.
  - if [ -n "$ALTERNATIVE_SOURCES" ]; then
        git config --global user.email "packages@gitlab.com"
        && git config --global user.name "GitLab Inc."
        && git add Gemfile.lock
88
        && git commit -m "Updating Gemfile.lock";
89
    fi
90
  - if [ -n "$NIGHTLY" ]; then export STAGING_REPO=nightly-builds; fi
91

92
fetch-assets:
93
  extends: .docker_job
94 95
  stage: prepare-assets
  script:
96
    - export VERSION=${GITLAB_REF_SLUG-$(bundle exec rake build:version)}
97
    - support/fetch_assets "${VERSION}"
98 99 100 101 102 103 104 105 106 107 108 109
  artifacts:
    paths:
      - ${ASSET_PATH}
  only:
    refs:
      - schedules@gitlab-org/omnibus-gitlab
      - branches@gitlab/omnibus-gitlab
      - tags@gitlab/omnibus-gitlab
      - triggers
  except:
    variables:
      - $COMPILE_ASSETS == "true"
110 111
      # Format of the auto-deploy tag
      - $CI_COMMIT_TAG =~ /^\d+\.\d+\.\d+\+[^ ]{7,}\.[^ ]{7,}$/
112

113 114 115
include:
  - '/gitlab-ci-config/gitlab-com.yml'
  - '/gitlab-ci-config/dev-gitlab-org.yml'
116

117
notify:slack-fail:
118
  before_script:
119
    - apk update && apk add git curl bash
120
  image: "alpine"
121 122
  stage: notification_fail
  script:
123
    - ./support/notify_slack.sh "#g_distribution" "Build on \`$CI_COMMIT_REF_NAME\` failed! See <https://dev.gitlab.org/gitlab/omnibus-gitlab/pipelines/"$CI_PIPELINE_ID">"
124 125 126
  when: on_failure
  only:
    - master
127
    - /.*-stable(-ee)?$/
128
    - tags@gitlab/omnibus-gitlab
129
  except:
130
    - triggers@gitlab-org/omnibus-gitlab
131 132 133
  tags:
  - promotion
  dependencies: []