forked from DataDog/datadog-process-agent
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.gitlab-ci-x64.yml
More file actions
168 lines (155 loc) · 4.25 KB
/
.gitlab-ci-x64.yml
File metadata and controls
168 lines (155 loc) · 4.25 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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
stages:
- prebuild
- build
- test
- publish
variables:
SRC_PATH: /src/github.com/StackVista/stackstate-process-agent
STS_AWS_BUCKET: stackstate-process-agent-2-test
STS_REPO_BRANCH_NAME: $CI_COMMIT_REF_NAME
PACKAGING_BRANCH: $CI_COMMIT_REF_NAME
STS_DOCKER_REPO: stackstate-k8s-process-agent
GO111MODULE: "on"
QUAY_REGISTRY: quay.io
DOCKER_REGISTRY: docker.io
VERSION_LOGIC: '(if [ "$${CI_COMMIT_TAG}" == "" ]; then echo "$${CI_COMMIT_SHORT_SHA}"; else echo "$${CI_COMMIT_TAG}"; fi);'
LINUX_BUILDER: ${REGISTRY_QUAY_URL}/stackstate/datadog_build_deb_x64:61b4ad67
GOPATH: "$CI_PROJECT_DIR/.go"
.go_process_agent_cache:
cache: &go_cache
key:
files:
- go.mod
- go.sum
prefix: process_agent_${SHORT_ARCH}
paths:
- .go/
.go_process_pull_agent_cache:
cache:
<<: *go_cache
# override the policy
policy: pull
.linux_builder:
image: ${LINUX_BUILDER}
before_script:
- eval "$(gimme)"
- source /root/.bashrc
- source /etc/profile
- conda activate ddpy3
- export PATH="${GOPATH}/bin:${PATH}"
dependencies:
extends: [ .linux_builder, .go_process_agent_cache ]
stage: prebuild
needs: []
tags:
- sts-k8s-xl-runner
script:
- mkdir -p .go
- go mod download
prebuild_agent:
cache:
- <<: *go_cache
# override the policy
policy: pull
- key:
files:
- go.mod
- go.sum
prefix: prebuild_datadog_agent_${SHORT_ARCH}
paths:
- prebuild_artifacts/artifacts/*
stage: prebuild
needs: [ dependencies ]
image: ${REGISTRY_QUAY_URL}/stackstate/datadog_build_system-probe_x64:61b4ad67
tags:
- sts-k8s-xl-runner
script:
- ./prebuild-datadog-agent.sh --generate-no-docker
artifacts:
paths:
- prebuild_artifacts/artifacts/*
test_protobuf_updated:
extends: [ .linux_builder, .go_process_pull_agent_cache ]
stage: test
needs: [ dependencies ]
tags:
- sts-k8s-m-runner
script:
- (cd $(go list -f '{{ .Dir }}' -m github.com/gogo/protobuf); make install)
- rake protobuf
- '[[ ! `git status --porcelain` ]] || (echo "ERROR: protobuf should be regenerated and committed" && git diff && false)'
build_linux:
extends: [ .linux_builder, .go_process_pull_agent_cache ]
stage: build
needs: [ dependencies, prebuild_agent ]
script:
- export PROCESS_AGENT_VERSION=$(eval $VERSION_LOGIC)
- printenv
- rake build
- ./prebuild-datadog-agent.sh --install-ebpf
artifacts:
paths:
- $CI_PROJECT_DIR/process-agent
- $CI_PROJECT_DIR/ebpf-object-files
expire_in: 2 week
tags:
- sts-k8s-xl-runner
retry:
max: 2
when:
- always
test:
extends: [ .linux_builder, .go_process_pull_agent_cache ]
stage: test
needs: [ dependencies, prebuild_agent ]
script:
- printenv
- rake ci
tags:
- sts-k8s-xl-runner
retry:
max: 2
when:
- always
publish_binaries:
stage: publish
tags:
- sts-k8s-m-runner
extends: [ .linux_builder, .go_process_pull_agent_cache ]
needs:
- build_linux
script:
- export PROCESS_AGENT_VERSION=$(eval $VERSION_LOGIC)
- ls -la $CI_PROJECT_DIR
- ls -la $CI_PROJECT_DIR/packaging
- cd $CI_PROJECT_DIR/packaging && ./publish_staging_package.sh
.docker_build:
image: ${REGISTRY_DOCKER_URL}/library/docker:20
services:
- name: ${REGISTRY_DOCKER_URL}/library/docker:20-dind
alias: docker
variables:
DOCKER_DRIVER: overlay
DOCKER_HOST: tcp://docker:2375
DOCKER_TLS_CERTDIR: ""
before_script:
- docker login -u "${docker_user}" -p "${docker_password}" "${DOCKER_REGISTRY}"
- docker login -u "${quay_user}" -p "${quay_password}" "${QUAY_REGISTRY}"
.publish_linux_docker:
extends: [ .docker_build ]
stage: publish
needs:
- build_linux
- prebuild_agent
script:
- export BUILD_TAG="${REPO}:${TAG}"
- docker build --build-arg EBPF_SUBFOLDER=$LLVM_ARCH --build-arg LONG_ARCH=$LONG_ARCH --build-arg SHORT_ARCH=$SHORT_ARCH -t "${BUILD_TAG}" -f BCI.dockerfile .
- ./packaging/publish_image.sh $BUILD_TAG $REPO $TAG $EXTRA_TAG
publish_k8s_docker:
extends: [ .publish_linux_docker ]
tags:
- sts-k8s-m-runner
variables:
REPO: $STS_DOCKER_REPO
TAG: "$CI_COMMIT_REF_NAME-$SHORT_ARCH"
EXTRA_TAG: $CI_COMMIT_SHORT_SHA-$SHORT_ARCH