-
Notifications
You must be signed in to change notification settings - Fork 4
/
.gitlab-ci.yml
70 lines (62 loc) · 1.97 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
# GitLab CI in conjunction with GitLab Runner can use Docker Engine to test and build any application.
# Docker, when used with GitLab CI, runs each job in a separate and isolated container using the predefined image that is set up in .gitlab-ci.yml.
# In this case we use the latest python docker image to build and test this project.
image: $SKA_K8S_TOOLS_DOCKER_BUILDER_IMAGE
variables:
GIT_SUBMODULE_STRATEGY: recursive
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache"
stages:
- lint
- build
- test
- scan
- publish
- pages
- deploy
# before_script is used to define the command that should be run before all jobs, including deploy jobs, but after the restoration of artifacts.
# This can be an array or a multi-line string.
cache:
paths:
- .cache/pip
- .venv
deploy_staging:
stage: deploy
script:
- echo "Deploy to staging server"
environment:
name: staging
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
deploy_review:
stage: deploy
script:
- echo "Deploy a review app"
environment:
name: review/$CI_COMMIT_REF_SLUG
url: https://ska-telescope.gitlab.io/developer.skatelescope.org/$CI_COMMIT_REF_SLUG/
rules:
- if: $CI_MERGE_REQUEST_ID
stop_review:
stage: deploy
script:
- echo "Stopping review/$CI_COMMIT_REF_SLUG environment"
environment:
name: review/$CI_COMMIT_REF_SLUG
action: stop
rules:
- if: $CI_MERGE_REQUEST_ID
when: manual
allow_failure: true # needed to not block pipeline
# Create Gitlab CI badges from CI metrics
# https://developer.skao.int/en/latest/tools/continuousintegration.html#automated-collection-of-ci-health-metrics-as-part-of-the-ci-pipeline
include:
- project: 'ska-telescope/templates-repository'
file: 'gitlab-ci/includes/finaliser.gitlab-ci.yml'
- project: 'ska-telescope/templates-repository'
file: 'gitlab-ci/includes/docs.gitlab-ci.yml'
pages:
artifacts:
name: $CI_COMMIT_REF_SLUG
paths:
- public
expire_in: "2 weeks"