-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
123 lines (110 loc) · 2.43 KB
/
Copy path.gitlab-ci.yml
File metadata and controls
123 lines (110 loc) · 2.43 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
workflow:
rules:
- if: $CI_DEPLOY_FREEZE
when: never
- if: $CI_PIPELINE_SOURCE == 'push'
- if: $CI_PIPELINE_SOURCE == 'web'
- if: $CI_PIPELINE_SOURCE == 'schedule'
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
- if: $CI_PIPELINE_SOURCE == 'pipeline'
- if: $CI_PIPELINE_SOURCE == 'api'
when: never
- if: $CI_PIPELINE_SOURCE == 'trigger'
when: never
include:
- local: go.yaml
.run-on-push-to-default-branch:
rules:
- if: '$CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH'
.run-on-push-and-in-mr:
rules:
- if: '$CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH'
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
default:
image: golang:1.26.1
lint:
extends:
- .run-on-push-and-in-mr
script:
- go fmt .
audit:
extends:
- .run-on-push-and-in-mr
script:
- go vet .
unit_tests:
extends:
- .run-on-push-and-in-mr
- .unit-tests-go
build:
needs:
- lint
- audit
- unit_tests
extends:
- .run-on-push-and-in-mr
- .build-go
variables:
version: $CI_COMMIT_REF_NAME
test:
needs:
- build
extends:
- .run-on-push-and-in-mr
- .test-go
deploy:
needs:
- build
- unit_tests
rules:
- if: '$CI_COMMIT_REF_NAME == "dev" || $CI_COMMIT_REF_NAME == "live"'
environment:
name: ${CI_COMMIT_REF_NAME}
image: curlimages/curl:8.21.0
script:
- |
curl https://seat${SEAT_INDEX}.${CI_COMMIT_REF_NAME}.webdav.inmylab.de/ \
--fail \
--verbose \
--upload-file hello-linux-amd64 \
--user seat${SEAT_INDEX}:${PASS}
pages:
needs:
- build
- unit_tests
extends:
- .run-on-push-to-default-branch
image: alpine
script:
- cp hello-linux-amd64 public/hello
artifacts:
paths:
- public
package:
needs:
- build
- unit_tests
image: docker:29.3.1
extends:
- .run-on-push-to-default-branch
services:
- name: docker:29.3.1-dind
variables:
DOCKER_TLS_CERTDIR: ""
before_script:
- |
while ! docker version; do
echo "Waiting for Docker..."
sleep 2
done
- docker login -u "${CI_REGISTRY_USER}" -p "${CI_REGISTRY_PASSWORD}" "${CI_REGISTRY}"
script:
- docker build --provenance=false --tag "${CI_REGISTRY_IMAGE}:${CI_COMMIT_REF_NAME}" .
- docker push "${CI_REGISTRY_IMAGE}:${CI_COMMIT_REF_NAME}"
after_script:
- docker logout "${CI_REGISTRY}"
trigger:
extends:
- .run-on-push-to-default-branch
trigger:
include: child.yaml