-
Notifications
You must be signed in to change notification settings - Fork 155
/
.gitlab-ci.yml
128 lines (116 loc) · 4.85 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
stages:
- build
- shared-pipeline # OCI packaging
- deploy
- benchmarks
- ci-build
variables:
LATEST_LIBRARY_x86_64_LINUX_GNU:
value: ""
description: "Location where to download latest dd-library-php-*-x86_64-linux-gnu.tar.gz archive. Leave empty to take it from the latest released github tag."
DOWNSTREAM_REL_BRANCH:
value: "master"
description: "Run a specific datadog-reliability-env branch downstream"
SYSTEM_TESTS_LIBRARY: php
include:
- remote: https://gitlab-templates.ddbuild.io/libdatadog/include/ci_authenticated_job.yml
- remote: https://gitlab-templates.ddbuild.io/libdatadog/include/one-pipeline.yml
- local: .gitlab/benchmarks.yml
- local: .gitlab/ci-images.yml
build:
extends: .ci_authenticated_job
stage: build
image: registry.ddbuild.io/images/ci_docker_base
tags: [ "runner:main", "size:large" ]
script:
- |
if [ -z "$LATEST_LIBRARY_x86_64_LINUX_GNU" ]; then
source /download-binary-tracer.sh
get_circleci_artifact "gh/DataDog/dd-trace-php" "build_packages" "package extension" "dd-library-php-.*-x86_64-linux-gnu.tar.gz" "dd-library-php-x86_64-linux-gnu.tar.gz"
get_circleci_artifact "gh/DataDog/dd-trace-php" "build_packages" "package extension" "datadog-setup.php" "datadog-setup.php"
echo "UPSTREAM_TRACER_VERSION=dev-master" >> upstream.env
else
UPSTREAM_TRACER_VERSION=$(echo "$LATEST_LIBRARY_x86_64_LINUX_GNU" | grep -Po '(?<=dd-library-php-).+(?=-x86_64-linux-gnu.tar.gz)')
echo "UPSTREAM_TRACER_VERSION=${UPSTREAM_TRACER_VERSION}" >> upstream.env
curl --fail --location --output 'dd-library-php-x86_64-linux-gnu.tar.gz' "$LATEST_LIBRARY_x86_64_LINUX_GNU"
curl --fail --location -O "$(dirname $LATEST_LIBRARY_x86_64_LINUX_GNU)/datadog-setup.php"
fi
- tar -cf 'datadog-setup-x86_64-linux-gnu.tar' 'datadog-setup.php' 'dd-library-php-x86_64-linux-gnu.tar.gz'
artifacts:
paths:
- 'upstream.env'
- 'datadog-setup-x86_64-linux-gnu.tar'
download_artifacts:
extends: .ci_authenticated_job
stage: build
image: registry.ddbuild.io/images/ci_docker_base
tags: [ "runner:main", "size:large" ]
script:
- |
sleep 2m # Let time for the CircleCI pipeline to start
source .gitlab/download-circleci_artifact.sh
download_circleci_artifact "gh/DataDog/dd-trace-php" "build_packages" "package extension" "dd-library-php-ssi-.*-x86_64-linux.tar.gz" "dd-library-php-ssi-x86_64-linux.tar.gz"
download_circleci_artifact "gh/DataDog/dd-trace-php" "build_packages" "package extension" "dd-library-php-ssi-.*-aarch64-linux.tar.gz" "dd-library-php-ssi-aarch64-linux.tar.gz"
artifacts:
paths:
- 'dd-library-php-ssi-x86_64-linux.tar.gz'
- 'dd-library-php-ssi-aarch64-linux.tar.gz'
deploy_to_reliability_env:
stage: deploy
needs: [ build ]
rules:
- if: $CI_PIPELINE_SOURCE == "schedule" && $NIGHTLY
when: always
- if: $CI_COMMIT_REF_NAME =~ /^ddtrace-/
when: always
- when: manual
allow_failure: true
trigger:
project: DataDog/apm-reliability/datadog-reliability-env
branch: $DOWNSTREAM_REL_BRANCH
variables:
UPSTREAM_PACKAGE_JOB: build
UPSTREAM_PROJECT_ID: $CI_PROJECT_ID
UPSTREAM_PROJECT_NAME: $CI_PROJECT_NAME
UPSTREAM_PIPELINE_ID: $CI_PIPELINE_ID
UPSTREAM_BRANCH: $CI_COMMIT_REF_NAME
# COMMIT_SHA would be wrong because the artifact is not built here
# UPSTREAM_COMMIT_SHA: $CI_COMMIT_SHA
tracer-base-image:
extends: .ci_authenticated_job
rules:
- if: '$CI_PIPELINE_SOURCE == "schedule"'
when: always
stage: deploy
needs: [ build ]
script:
- echo $GH_TOKEN|docker login ghcr.io/datadog -u uploader --password-stdin
#Dev X86
- rm -rf ./tooling/ci/binaries
- ./tooling/ci/download-binary-php.sh dev
- docker buildx build --load --progress=plain --platform linux/amd64 -f ./tooling/ci/Dockerfile -t ghcr.io/datadog/dd-trace-php/dd-library-php:latest_snapshot .
- docker push ghcr.io/datadog/dd-trace-php/dd-library-php:latest_snapshot
#Prod X86
- rm -rf ./tooling/ci/binaries
- ./tooling/ci/download-binary-php.sh prod
- docker buildx build --load --progress=plain --platform linux/amd64 -f ./tooling/ci/Dockerfile -t ghcr.io/datadog/dd-trace-php/dd-library-php:latest .
- docker push ghcr.io/datadog/dd-trace-php/dd-library-php:latest
onboarding_tests_installer:
parallel:
matrix:
- ONBOARDING_FILTER_WEBLOG: [test-app-php,test-app-php-container-83]
SCENARIO: SIMPLE_INSTALLER_AUTO_INJECTION
onboarding_tests_k8s_injection:
rules:
- when: never
parallel:
matrix:
- WEBLOG_VARIANT:
- dd-lib-php-init-test-83
- dd-lib-php-init-test-alpine
requirements_json_test:
rules:
- when: on_success
variables:
REQUIREMENTS_BLOCK_JSON_PATH: "loader/packaging/block_tests.json"
REQUIREMENTS_ALLOW_JSON_PATH: "loader/packaging/allow_tests.json"