-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.gitlab-ci.yml
148 lines (129 loc) · 4.72 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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
# 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.
# We store the harbor.skao.int/ska-k8s-tools/docker-builder:x.x.x as a group level variable for convenience
image: $SKA_K8S_TOOLS_BUILD_DEPLOY
# cache is used to specify a list of files and directories which should be cached between jobs. You can only use paths that are within the project workspace.
# If cache is defined outside the scope of jobs, it means it is set globally and all jobs will use that definition
# cache:
# paths:
# - build
# The YAML file defines a set of jobs with constraints stating when they should be run.
# You can specify an unlimited number of jobs which are defined as top-level elements with an arbitrary name and always have to contain at least the script clause.
# In this case we have only the test job which produce an artifacts (it must be placed into a directory called "public")
# It is also specified that only the master branch will be subject of this job.
stages:
- lint
- build
- scan
- test
- deploy
- integration
- staging
- join-reports
- pages
- publish
#Join linting reports (This stage is temporary! <- LOL)
join_linting_reports:
stage: join-reports
tags:
- ${SKA_K8S_RUNNER}
script:
- echo "This step is needed as the artifacts can't be passed in the same stage"
- make join-lint-reports
artifacts:
paths:
- build/
when: always
# Standardised included jobs
variables:
GIT_SUBMODULE_STRATEGY: recursive
MINIKUBE: "false"
CI_POETRY_VERSION: 1.8.2
# Include CI templates
include:
# OCI Images
# do a custom set of build and publish stages
- project: 'ska-telescope/templates-repository'
file: 'gitlab-ci/includes/oci-image.gitlab-ci.yml'
# Python packages build,lint, test and publish
- project: 'ska-telescope/templates-repository'
file: 'gitlab-ci/includes/python.gitlab-ci.yml'
# Jupyter notebook linting and testing
- project: 'ska-telescope/templates-repository'
file: 'gitlab-ci/includes/notebook.gitlab-ci.yml'
# Helm Charts
- project: 'ska-telescope/templates-repository'
file: 'gitlab-ci/includes/helm-chart.gitlab-ci.yml'
# Docs pages
- project: 'ska-telescope/templates-repository'
file: 'gitlab-ci/includes/docs.gitlab-ci.yml'
# .post step finalisers eg: badges
- project: 'ska-telescope/templates-repository'
file: 'gitlab-ci/includes/finaliser.gitlab-ci.yml'
# k8s steps
- project: 'ska-telescope/templates-repository'
file: 'gitlab-ci/includes/k8s.gitlab-ci.yml'
# changelog release page
- project: 'ska-telescope/templates-repository'
file: 'gitlab-ci/includes/release.gitlab-ci.yml'
# deploy steps
- project: 'ska-telescope/templates-repository'
file: 'gitlab-ci/includes/deploy.gitlab-ci.yml'
python-test:
before_script:
- poetry self update -n 1.8.2
- '[ -f .make/python.mk ] || (echo "File python.mk not included in Makefile; exit 1")'
- 'make help | grep python-test'
- poetry config virtualenvs.in-project true
- echo "python-build Setting.. poetry config virtualenvs.create $POETRY_CONFIG_VIRTUALENVS_CREATE"
- poetry config virtualenvs.create $POETRY_CONFIG_VIRTUALENVS_CREATE
- |
if [[ ! -z "$PYTANGO_VERSION" ]]; then \
echo "Received pytango version: $PYTANGO_VERSION" ; \
poetry add pytango==$PYTANGO_VERSION
fi
if [[ -f pyproject.toml ]]; then
echo "python-test: Installing with poetry";
time poetry install;
else
if [[ -f requirements.txt ]]; then
echo "python-test: Installing with pip";
time pip3 install -r requirements.txt;
fi;
fi;
# if the pipeline is called from an upstream project (ska-tango-images)
# we don't lint, there's no need
python-lint:
rules:
- if: '$PYTANGO_VERSION == ""'
- if: '$PYTANGO_VERSION == null'
k8s-test-no-operator:
extends: k8s-test
variables:
KUBE_NAMESPACE: 'ci-$CI_PROJECT_NAME-$CI_COMMIT_SHORT_SHA-no-op'
SKA_TANGO_OPERATOR: 'false'
artifacts:
name: "$CI_PROJECT_NAME-$CI_JOB_ID"
paths:
- "build/"
reports:
junit: build/report.xml
when: always
environment:
name: test/$CI_COMMIT_REF_SLUG-no-op
on_stop: stop-k8s-test-no-operator
auto_stop_in: 1 minute
rules:
- exists:
- tests/**/*
stop-k8s-test-no-operator:
extends: stop-k8s-test
when: manual
variables:
KUBE_NAMESPACE: 'ci-$CI_PROJECT_NAME-$CI_COMMIT_SHORT_SHA-no-op'
environment:
name: test/$CI_COMMIT_REF_SLUG-no-op
action: stop
notebook-test:
when: manual