Skip to content

Commit b6d746e

Browse files
authored
Merge pull request #4073 from DataDog/tonycthsu/circleci-streamline
Streamline CircleCI config
2 parents dedb0bb + e7b129a commit b6d746e

File tree

1 file changed

+79
-124
lines changed

1 file changed

+79
-124
lines changed

.circleci/config.yml

Lines changed: 79 additions & 124 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,31 @@
11
version: 2.1
22

3-
# Common variables, containers, jobs and steps.
4-
job_defaults: &job_defaults
5-
# TODO: We should move away from using a directory
6-
# TODO: that requires root permission to be created.
7-
# TODO: Changing this requires rebuilding all docker images.
8-
working_directory: /app
9-
shell: /bin/bash --login
10-
113
test_containers:
12-
- &job_parameters
4+
- &container_base
5+
image: <<parameters.image>>
6+
environment:
7+
BUNDLE_GEMFILE: /app/Gemfile
8+
JRUBY_OPTS: --dev # Faster JVM startup: https://github.com/jruby/jruby/wiki/Improving-startup-time#use-the---dev-flag
9+
# Override number of concurrent compiles in grpc gem, see https://github.com/grpc/grpc/pull/28250 and https://github.com/DataDog/dd-trace-rb/issues/1791
10+
# If you see gem installation failing with "Killed" on CircleCI and `gem install --platform ruby grpc` reproduces the
11+
# issue when you connect to the testing container via ssh, then try lowering this file a notch.
12+
GRPC_RUBY_BUILD_PROCS: 6
13+
DD_INSTRUMENTATION_TELEMETRY_ENABLED: false
14+
DD_REMOTE_CONFIGURATION_ENABLED: false
15+
TEST_OPENSEARCH_HOST: opensearch
16+
TEST_OPENSEARCH_PORT: 9200
17+
DD_AGENT_HOST: testagent
18+
DD_TRACE_AGENT_PORT: 9126
19+
DATADOG_GEM_CI: true
20+
TEST_DATADOG_INTEGRATION: 1
21+
COVERAGE_BASE_DIR: coverage
22+
- &test_job_default
23+
# TODO: We should move away from using a directory
24+
# TODO: that requires root permission to be created.
25+
# TODO: Changing this requires rebuilding all docker images.
26+
working_directory: /app
27+
shell: /bin/bash --login
28+
resource_class: <<parameters.resource_class_to_use>>
1329
parameters:
1430
ruby_version:
1531
description: Ruby version
@@ -25,98 +41,8 @@ test_containers:
2541
description: Use latest version of dependencies during testing
2642
type: boolean
2743
default: false
28-
resource_class: <<parameters.resource_class_to_use>>
29-
- &container_base_environment
30-
BUNDLE_GEMFILE: /app/Gemfile
31-
JRUBY_OPTS: --dev # Faster JVM startup: https://github.com/jruby/jruby/wiki/Improving-startup-time#use-the---dev-flag
32-
# Override number of concurrent compiles in grpc gem, see https://github.com/grpc/grpc/pull/28250 and https://github.com/DataDog/dd-trace-rb/issues/1791
33-
# If you see gem installation failing with "Killed" on CircleCI and `gem install --platform ruby grpc` reproduces the
34-
# issue when you connect to the testing container via ssh, then try lowering this file a notch.
35-
GRPC_RUBY_BUILD_PROCS: 6
36-
DD_INSTRUMENTATION_TELEMETRY_ENABLED: false
37-
DD_REMOTE_CONFIGURATION_ENABLED: false
38-
TEST_OPENSEARCH_HOST: opensearch
39-
TEST_OPENSEARCH_PORT: 9200
40-
DD_AGENT_HOST: testagent
41-
DD_TRACE_AGENT_PORT: 9126
42-
DATADOG_GEM_CI: true
43-
- &container_parameters_environment
44-
- *container_base_environment
45-
- TEST_DATADOG_INTEGRATION: 1
46-
- COVERAGE_BASE_DIR: coverage
47-
- &container_base
48-
image: <<parameters.image>>
49-
environment:
50-
*container_parameters_environment
51-
- &test_job_default
52-
<<: *job_defaults
53-
<<: *job_parameters
5444
docker:
5545
- *container_base
56-
- &container_postgres
57-
image: postgres:9.6
58-
environment:
59-
- POSTGRES_PASSWORD=postgres
60-
- POSTGRES_USER=postgres
61-
- POSTGRES_DB=postgres
62-
- &postgres_port 5432
63-
- &container_presto
64-
# Move to trinodb/trino after https://github.com/treasure-data/presto-client-ruby/issues/64 is resolved.
65-
image: starburstdata/presto:332-e.9
66-
- &presto_port 8080
67-
- &container_mysql
68-
image: mysql:8.0
69-
# As of MySQL 8.0, caching_sha2_password is now the default authentication plugin
70-
# rather than mysql_native_password which was the default in previous versions.
71-
command: --default-authentication-plugin=mysql_native_password
72-
environment:
73-
- MYSQL_ROOT_PASSWORD=root
74-
- MYSQL_PASSWORD=mysql
75-
- MYSQL_USER=mysql
76-
- &mysql_port 3306
77-
- &opensearch_host opensearch
78-
- &container_opensearch
79-
image: opensearchproject/opensearch:2.8.0
80-
name: *opensearch_host
81-
environment:
82-
- discovery.type=single-node
83-
- DISABLE_SECURITY_PLUGIN=true
84-
- DISABLE_PERFORMANCE_ANALYZER_AGENT_CLI=true
85-
# Make sure it works on nearly full disk.
86-
- cluster.routing.allocation.disk.threshold_enabled=true
87-
- cluster.routing.allocation.disk.watermark.low=3gb
88-
- cluster.routing.allocation.disk.watermark.high=2gb
89-
- cluster.routing.allocation.disk.watermark.flood_stage=1gb
90-
- cluster.routing.allocation.disk.threshold_enabled=false
91-
- &opensearch_port 9200
92-
- &container_elasticsearch
93-
image: elasticsearch:8.1.3
94-
environment:
95-
# Ensure production cluster requirements are not enforced
96-
- discovery.type=single-node
97-
- xpack.security.enabled=false
98-
- ES_JAVA_OPTS=-Xms750m -Xmx750m
99-
- &elasticsearch_port 9200
100-
- &container_redis
101-
image: redis:6.2
102-
- &redis_port 6379
103-
- &container_mongo
104-
image: mongo:3.5
105-
- &mongo_port 27017
106-
- &container_memcached
107-
image: memcached:1.5-alpine
108-
- &memcached_port 11211
109-
- &container_testagent
110-
image: ghcr.io/datadog/dd-apm-test-agent/ddapm-test-agent:v1.12.0
111-
name: testagent
112-
environment:
113-
- LOG_LEVEL=DEBUG
114-
- TRACE_LANGUAGE=ruby
115-
- PORT=9126
116-
- DD_POOL_TRACE_CHECK_FAILURES=true
117-
- DD_DISABLE_ERROR_RESPONSES=true
118-
- ENABLED_CHECKS=trace_content_length,trace_stall,meta_tracer_version_header,trace_count_header,trace_peer_service,trace_dd_service
119-
- &testagent_port 9126
12046

12147
check_exact_bundle_cache_hit: &check_exact_bundle_cache_hit
12248
run:
@@ -228,12 +154,6 @@ filters_all_branches_and_tags: &filters_all_branches_and_tags
228154
filters:
229155
tags:
230156
only: /.*/
231-
filters_only_release_tags: &filters_only_release_tags
232-
filters:
233-
branches:
234-
ignore: /.*/
235-
tags:
236-
only: /^v\d+(\.\d+){0,3}(\.(alpha|beta|rc)\d+)?$/
237157

238158
orbs:
239159
orb:
@@ -308,15 +228,50 @@ orbs:
308228
<<: *test_job_default
309229
docker:
310230
- <<: *container_base
311-
- *container_postgres
312-
- *container_presto
313-
- *container_mysql
314-
- *container_opensearch
315-
- *container_elasticsearch
316-
- *container_redis
317-
- *container_mongo
318-
- *container_memcached
319-
- *container_testagent
231+
- image: postgres:9.6
232+
environment:
233+
- POSTGRES_PASSWORD=postgres
234+
- POSTGRES_USER=postgres
235+
- POSTGRES_DB=postgres
236+
- image: starburstdata/presto:332-e.9 # Move to trinodb/trino after https://github.com/treasure-data/presto-client-ruby/issues/64 is resolved.
237+
- image: mysql:8.0
238+
# As of MySQL 8.0, caching_sha2_password is now the default authentication plugin
239+
# rather than mysql_native_password which was the default in previous versions.
240+
command: --default-authentication-plugin=mysql_native_password
241+
environment:
242+
- MYSQL_ROOT_PASSWORD=root
243+
- MYSQL_PASSWORD=mysql
244+
- MYSQL_USER=mysql
245+
- image: opensearchproject/opensearch:2.8.0
246+
name: opensearch
247+
environment:
248+
- discovery.type=single-node
249+
- DISABLE_SECURITY_PLUGIN=true
250+
- DISABLE_PERFORMANCE_ANALYZER_AGENT_CLI=true
251+
# Make sure it works on nearly full disk.
252+
- cluster.routing.allocation.disk.threshold_enabled=true
253+
- cluster.routing.allocation.disk.watermark.low=3gb
254+
- cluster.routing.allocation.disk.watermark.high=2gb
255+
- cluster.routing.allocation.disk.watermark.flood_stage=1gb
256+
- cluster.routing.allocation.disk.threshold_enabled=false
257+
- image: elasticsearch:8.1.3
258+
environment:
259+
# Ensure production cluster requirements are not enforced
260+
- discovery.type=single-node
261+
- xpack.security.enabled=false
262+
- ES_JAVA_OPTS=-Xms750m -Xmx750m
263+
- image: redis:6.2
264+
- image: mongo:3.5
265+
- image: memcached:1.5-alpine
266+
- image: ghcr.io/datadog/dd-apm-test-agent/ddapm-test-agent:v1.18.0
267+
name: testagent
268+
environment:
269+
- LOG_LEVEL=DEBUG
270+
- TRACE_LANGUAGE=ruby
271+
- PORT=9126
272+
- DD_POOL_TRACE_CHECK_FAILURES=true
273+
- DD_DISABLE_ERROR_RESPONSES=true
274+
- ENABLED_CHECKS=trace_content_length,trace_stall,meta_tracer_version_header,trace_count_header,trace_peer_service,trace_dd_service
320275
parallelism: 22
321276
steps:
322277
- restore_cache:
@@ -332,25 +287,25 @@ orbs:
332287
echo 'export COVERAGE_DIR="$COVERAGE_BASE_DIR/versions/$CIRCLE_JOB/$CIRCLE_NODE_INDEX"' >> $BASH_ENV
333288
# Wait for containers to start
334289
- docker-wait:
335-
port: *postgres_port
290+
port: 5432
336291
- docker-wait:
337-
port: *presto_port
292+
port: 8080
338293
- docker-wait:
339-
port: *mysql_port
294+
port: 3306
340295
- docker-wait:
341-
host: *opensearch_host
342-
port: *opensearch_port
296+
host: opensearch
297+
port: 9200
343298
- docker-wait:
344-
port: *elasticsearch_port
299+
port: 9200
345300
- docker-wait:
346-
port: *redis_port
301+
port: 6379
347302
- docker-wait:
348-
port: *mongo_port
303+
port: 27017
349304
- docker-wait:
350-
port: *memcached_port
305+
port: 11211
351306
- docker-wait:
352307
host: "testagent"
353-
port: *testagent_port
308+
port: 9126
354309
- *step_run_all_tests
355310
- *step_get_test_agent_trace_check_results
356311
- store_test_results:

0 commit comments

Comments
 (0)