-
Notifications
You must be signed in to change notification settings - Fork 25
/
.gitlab-ci.yml
137 lines (126 loc) · 3.09 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
---
image: registry.ddbuild.io/images/mirror/golang:1.22
variables:
PROJECTNAME: "watermarkpodautoscaler"
TARGET_TAG: v$CI_PIPELINE_ID-$CI_COMMIT_SHORT_SHA
BUILD_DOCKER_REGISTRY: "registry.ddbuild.io/ci"
JOB_DOCKER_IMAGE: "registry.ddbuild.io/ci-containers-project:v46367840-16ecadd-v3.0.0"
DOCKER_REGISTRY_LOGIN_SSM_KEY: docker_hub_login
DOCKER_REGISTRY_PWD_SSM_KEY: docker_hub_pwd
DOCKER_REGISTRY_URL: docker.io
cache: &global_cache
key: ${CI_COMMIT_REF_SLUG}
paths:
- /go/pkg/mod
stages:
- build
- test
- image
- release
before_script:
- make install-tools
build:
stage: build
tags: ["arch:amd64"]
variables:
KUBERNETES_MEMORY_REQUEST: 16Gi
KUBERNETES_MEMORY_LIMIT: 16Gi
KUBERNETES_CPU_REQUEST: 4
KUBERNETES_CPU_LIMIT: 4
GOMEMLIMIT: 15GiB
GOMAXPROCS: 4
script:
- make build
tests:
stage: test
tags: ["arch:amd64"]
variables:
KUBERNETES_MEMORY_REQUEST: 16Gi
KUBERNETES_MEMORY_LIMIT: 16Gi
KUBERNETES_CPU_REQUEST: 4
KUBERNETES_CPU_LIMIT: 4
GOMEMLIMIT: 15GiB
GOMAXPROCS: 4
script:
- make test
generate_code:
stage: test
tags: ["arch:amd64"]
script:
- make generate
- git diff --exit-code
check-golang-version:
stage: test
tags: ["arch:amd64"]
script:
- make update-golang
- git diff --exit-code
build_image:
stage: image
tags:
- "arch:amd64"
image: $JOB_DOCKER_IMAGE
variables:
TARGET_IMAGE: $BUILD_DOCKER_REGISTRY/$PROJECTNAME:v${CI_PIPELINE_ID}-${CI_COMMIT_SHORT_SHA}
RELEASE_IMAGE: $BUILD_DOCKER_REGISTRY/$PROJECTNAME:$CI_COMMIT_TAG-amd64
script:
- IMG=$TARGET_IMAGE make docker-buildx-ci
publish_public_main:
stage: release
rules:
- if: '$CI_COMMIT_BRANCH == "main"'
when: on_success
- when: never
trigger:
project: DataDog/public-images
branch: main
strategy: depend
variables:
IMG_SOURCES: $BUILD_DOCKER_REGISTRY/$PROJECTNAME:v${CI_PIPELINE_ID}-${CI_COMMIT_SHORT_SHA}
IMG_DESTINATIONS: $PROJECTNAME:main
IMG_SIGNING: "false"
publish_public_tag:
stage: release
rules:
- if: $CI_COMMIT_TAG
when: manual
- when: never
trigger:
project: DataDog/public-images
branch: main
strategy: depend
variables:
IMG_SOURCES: $BUILD_DOCKER_REGISTRY/$PROJECTNAME:$CI_COMMIT_TAG
IMG_DESTINATIONS: $PROJECTNAME:$CI_COMMIT_TAG
IMG_SIGNING: "false"
publish_public_latest:
stage: release
rules:
- if: $CI_COMMIT_TAG
when: manual
- when: never
trigger:
project: DataDog/public-images
branch: main
strategy: depend
variables:
IMG_SOURCES: $BUILD_DOCKER_REGISTRY/$PROJECTNAME:$CI_COMMIT_TAG
IMG_DESTINATIONS: $PROJECTNAME:latest
IMG_SIGNING: "false"
trigger_internal_image:
stage: release
rules:
- if: $CI_COMMIT_TAG
- when: never
trigger:
project: DataDog/images
branch: master
strategy: depend
variables:
IMAGE_VERSION: tmpl-v2
IMAGE_NAME: $PROJECTNAME
RELEASE_TAG: ${CI_COMMIT_REF_SLUG}
BUILD_TAG: ${CI_COMMIT_REF_SLUG}
TMPL_SRC_IMAGE: v${CI_PIPELINE_ID}-${CI_COMMIT_SHORT_SHA}
RELEASE_STAGING: "true"
RELEASE_PROD: "true"