forked from gitlabhq/omnibus-gitlab
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
133 lines (127 loc) · 4.06 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
stages:
- prepare-assets
- trigger-package
- trigger-docker
- trigger-ha-validate
- trigger-qa
- check
- prepare
- tests
- post-test
- gitlab_com:package
- gitlab_com:upload_deploy
- package-and-image
- scan-dependencies
- staging_upload
- package-and-image-release
- validate
- metrics
- slow_jobs
- raspbian-release
- aws-marketplace-release
- notification_fail
variables:
BUILDER_IMAGE_REGISTRY: "dev.gitlab.org:5005/cookbooks/gitlab-omnibus-builder"
PUBLIC_BUILDER_IMAGE_REGISTRY: "registry.gitlab.com/gitlab-org/gitlab-omnibus-builder"
BUILDER_IMAGE_REVISION: "0.0.37"
# 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"
RUBY_IMAGE: "ruby:2.5"
# 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'
MAX_PACKAGE_SIZE_MB: "720"
### For services that need a docker daemon
.docker_job: &docker_job
image: "${BUILDER_IMAGE_REGISTRY}/ruby_docker:${BUILDER_IMAGE_REVISION}"
variables:
DOCKER_DRIVER: overlay2
DOCKER_HOST: tcp://docker:2375
services:
- docker:dind
tags:
- docker
before_script:
- export CE_ONLY=(Raspberry)
- export EE_ONLY=(SLES HA-Validate)
- 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
- echo $NIGHTLY
- mkdir -p ~/.ssh
- mkdir -p ~/.aws
- mkdir -p cache
- bundle install -j $(nproc) --binstubs --path gems --without rubocop
# 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 "[email protected]"
&& git config --global user.name "GitLab Inc."
&& git add Gemfile.lock
&& git commit -m "Updating Gemfile.lock";
fi
- if [ -n "$NIGHTLY" ]; then export STAGING_REPO=nightly-builds; fi
fetch-assets:
extends: .docker_job
stage: prepare-assets
script:
- export VERSION=${GITLAB_REF_SLUG-$(bundle exec rake build:version)}
- support/fetch_assets "${VERSION}"
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"
# Format of the auto-deploy tag
- $CI_COMMIT_TAG =~ /^\d+\.\d+\.\d+\+[^ ]{7,}\.[^ ]{7,}$/
include:
- '/gitlab-ci-config/gitlab-com.yml'
- '/gitlab-ci-config/dev-gitlab-org.yml'
notify:slack-fail:
before_script:
- apk update && apk add git curl bash
image: "alpine"
stage: notification_fail
script:
- ./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">"
when: on_failure
only:
- master
- /.*-stable(-ee)?$/
- tags@gitlab/omnibus-gitlab
except:
- triggers@gitlab-org/omnibus-gitlab
tags:
- promotion
dependencies: []