-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy path.gitlab-ci.yml
136 lines (124 loc) · 3.95 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
image: aistorage/ci:latest
stages:
- operator:build
- operator:test:short
- operator:test:long
.operator_rules_template: &operator_rules_def
rules:
# Run on schedules
- if: $CI_PIPELINE_SOURCE == "schedule"
when: on_success
# Skip if skip-ci label is present
- if: $CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_LABELS =~ /.*skip-ci.*/
when: never
# Run if there are changes in operator directory
- if: $CI_PIPELINE_SOURCE == "merge_request_event" || $CI_COMMIT_BRANCH == "main"
changes:
- operator/**/*
when: on_success
# Manual run if no operator changes (with allow_failure)
- if: $CI_PIPELINE_SOURCE == "merge_request_event" || $CI_COMMIT_BRANCH == "main"
when: manual
allow_failure: true
operator:lint:
stage: operator:build
timeout: 10m
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
- if: $CI_COMMIT_BRANCH == "main"
- if: $CI_PIPELINE_SOURCE == "schedule"
script:
- cd operator
- make lint
- make fmt-check
- make generate && [[ -z "$(git status -s)" ]] || { echo "You need to run 'make generate'"; exit 1; }
- make manifests && [[ -z "$(git status -s)" ]] || { echo "You need to run 'make manifests'"; exit 1; }
operator:build:
stage: operator:build
timeout: 10m
<<: *operator_rules_def
script:
- make -C operator build
operator:test:unit:
stage: operator:test:short
timeout: 10m
<<: *operator_rules_def
script:
- make -C operator test
operator:test:kind:unit:
stage: operator:test:short
<<: *operator_rules_def
services: ["docker:24.0.5-dind"]
tags: ["ais"]
allow_failure: true
variables:
RUNNER_SCRIPT_TIMEOUT: 10m
RUNNER_AFTER_SCRIPT_TIMEOUT: 2m
DOCKER_HOST: tcp://docker:2375
DOCKER_TLS_CERTDIR: ""
parallel:
matrix:
- KUBERNETES_VERSION:
- v1.28.9
- v1.29.4
- v1.30.2
before_script:
- make -C operator kind
- kind create cluster --name ais-operator-test --image "kindest/node:${KUBERNETES_VERSION}" --config operator/scripts/kind_cluster_gitlab.yaml --retain
- sed -i -E -e 's/localhost|0\.0\.0\.0/docker/g' "$HOME/.kube/config"
- kubectl cluster-info
script:
- export USE_EXISTING_CLUSTER=true
- make -C operator test
after_script:
- kind export logs logs --name ais-operator-test
- kind delete cluster --name ais-operator-test
artifacts:
when: on_failure
paths: ["logs/"]
expire_in: 1 day
operator:test:minikube:short:
stage: operator:test:short
tags: ["ais-k8s"]
timeout: 30m
<<: *operator_rules_def
before_script:
- kubectl apply -f https://raw.githubusercontent.com/rancher/local-path-provisioner/v0.0.30/deploy/local-path-storage.yaml
script:
- make -C operator test-e2e-short
operator:test:minikube:long:
stage: operator:test:long
needs: ["operator:test:minikube:short"]
tags: ["ais-k8s-multinode"]
timeout: 40m
<<: *operator_rules_def
before_script:
- kubectl apply -f https://raw.githubusercontent.com/rancher/local-path-provisioner/v0.0.30/deploy/local-path-storage.yaml
script:
- make -C operator test-e2e-long
operator:test:minikube:metallb:
stage: operator:test:long
needs: ["operator:test:minikube:short"]
tags: ["ais-k8s-multinode"]
timeout: 25m
rules:
- if: $CI_PIPELINE_SOURCE == "schedule"
- if: $CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_LABELS =~ /.*skip-ci.*/
when: never
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
changes:
- operator/**/*
when: manual
allow_failure: true
variables:
RUNNER_SCRIPT_TIMEOUT: 20m
RUNNER_AFTER_SCRIPT_TIMEOUT: 2m
# NOTE: No particular reason why these addresses would be unavailable.
EXTERNAL_ADDRESSES: 172.20.0.100–172.20.0.120
before_script:
- apt-get install gettext-base
- make -C operator deploy-metallb
script:
- make -C operator test-e2e
after_script:
- make -C operator undeploy-metallb