Repository navigation
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
146 lines (130 loc) · 3.95 KB
/
Copy path.gitlab-ci.yml
File metadata and controls
146 lines (130 loc) · 3.95 KB
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
variables:
CI_IMAGE: docker.io/aistorage/gitlab-ci:latest
RUNNER_TAG: ais-k8s-ci
image: $CI_IMAGE
default:
tags:
- $RUNNER_TAG
stages:
- operator:build
- operator:test
.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_test_kind_template: &operator_test_kind_def
<<: *operator_rules_def
timeout: 20m
variables:
TEST_EPHEMERAL_CLUSTER: "true"
before_script:
# TODO: Revisit (issue w/ `kind export logs` in `after_script`)
- mkdir -p /ci-kind-logs/{control-plane,worker1,worker2,worker3}
- chmod -R 755 /ci-kind-logs
- make -C operator kind-setup test-e2e-bootstrap
script:
- make -C operator test-e2e-in-cluster
after_script:
- cp -r /ci-kind-logs $CI_PROJECT_DIR/logs/
artifacts:
when: on_failure
paths: [ logs/ ]
expire_in: 1 day
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 check-gen
operator:build:
stage: operator:build
timeout: 10m
<<: *operator_rules_def
script:
- make -C operator build
operator:build:sonarqube:
stage: operator:build
<<: *operator_rules_def
image:
name: sonarsource/sonar-scanner-cli:latest
entrypoint: [""]
variables:
SONAR_USER_HOME: "${CI_PROJECT_DIR}/.sonar"
GIT_DEPTH: "0"
cache:
key: "${CI_JOB_NAME}"
paths:
- .sonar/cache
allow_failure: true
script:
- sonar-scanner -Dsonar.qualitygate.wait=true
operator:test:operator-changelog-check:
stage: operator:test
rules:
- if: '$CI_PIPELINE_SOURCE != "merge_request_event"'
when: never
- if: '$CI_MERGE_REQUEST_LABELS =~ /.*skip-operator-changelog-check.*/'
when: never
- !reference [.operator_rules_template, rules]
script:
- git fetch origin "$CI_MERGE_REQUEST_TARGET_BRANCH_NAME"
- CHANGED_FILES=$(git diff --name-only "origin/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME"...HEAD)
- echo "Changed files are:"
- echo "$CHANGED_FILES"
- echo "$CHANGED_FILES" | grep -qx 'operator/CHANGELOG.md' || exit 1
operator:test:unit:
stage: operator:test
timeout: 10m
<<: *operator_rules_def
script:
- make -C operator test
operator:test:kind:
stage: operator:test
extends: .operator_test_kind_template
operator:test:kind:compat:
stage: operator:test
extends: .operator_test_kind_template
parallel:
matrix:
- KUBERNETES_VERSION:
- v1.31.0 # oldest supported
- v1.30.0 # current production
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" || $CI_COMMIT_BRANCH == "main"
when: manual
allow_failure: true
operator:test:kind:latest:
stage: operator:test
extends: .operator_test_kind_template
variables:
AIS_TEST_NODE_IMAGE: "docker.io/aistorage/aisnode:dev"
AIS_TEST_INIT_IMAGE: "docker.io/aistorage/ais-init:dev"
AUTHN_TEST_IMAGE: "docker.io/aistorage/authn:dev"
rules:
- if: $CI_COMMIT_BRANCH == "main"
- if: $CI_PIPELINE_SOURCE == "schedule"
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
when: manual
allow_failure: true