Skip to content

Commit 4634b1b

Browse files
committed
WIP: Move ci.yml to app directory
1 parent dd6c1b2 commit 4634b1b

File tree

7 files changed

+72
-29
lines changed

7 files changed

+72
-29
lines changed

.circleci/config.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,9 +197,11 @@ orbs:
197197
- setup_remote_docker:
198198
docker_layer_caching: true
199199
- run:
200-
command: ./integration/bin/build-images -a
200+
command: ./integration/bin/build-images
201201
- run:
202-
command: ./integration/bin/ci
202+
command: ./integration/apps/rack/bin/build-images
203+
- run:
204+
command: ./integration/apps/rack/bin/ci -v 2.7
203205
test:
204206
<<: *test_job_default
205207
docker:

integration/apps/rack/bin/ci

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#!/bin/bash
2+
set -euo pipefail
3+
4+
APP_BIN_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
5+
APP_DIR=${APP_BIN_DIR%/bin}
6+
cd $APP_DIR
7+
8+
# Parse options
9+
while getopts "v:" opt; do
10+
case $opt in
11+
v)
12+
APP_RUBY_VERSION=$OPTARG
13+
;;
14+
\?)
15+
echo "Invalid option: -$OPTARG" >&2
16+
exit 1
17+
;;
18+
:)
19+
echo "Option -$OPTARG requires an argument." >&2
20+
exit 1
21+
;;
22+
esac
23+
done
24+
25+
# Validate options
26+
if [ -z ${APP_RUBY_VERSION+x} ]; then
27+
echo "You must specify a Ruby version with -v. (e.g. 2.7)" >&2
28+
exit 1
29+
fi
30+
31+
# Set configuration
32+
APP_BASE_IMAGE=${APP_BASE_IMAGE:-datadog/dd-apm-demo:rb-$APP_RUBY_VERSION}
33+
APP_IMAGE=${APP_IMAGE:-$APP_BASE_IMAGE-rack}
34+
APP_COMPOSE_FILES="-f docker-compose.yml -f docker-compose.ci.yml"
35+
36+
echo "== Running integration tests... =="
37+
echo " - App: rack"
38+
echo " - Ruby version: $APP_RUBY_VERSION"
39+
echo " - Base image: $APP_BASE_IMAGE"
40+
echo " - App image: $APP_IMAGE"
41+
echo ""
42+
43+
# Pull/build any missing images
44+
APP_IMAGE=$APP_IMAGE docker-compose $APP_COMPOSE_FILES build
45+
46+
# Run the test suite
47+
APP_IMAGE=$APP_IMAGE docker-compose $APP_COMPOSE_FILES run tester
48+
49+
# Cleanup
50+
APP_IMAGE=$APP_IMAGE docker-compose $APP_COMPOSE_FILES down -t 0 --remove-orphans
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
version: '3.2'
2+
services:
3+
app:
4+
image: ${APP_IMAGE}
5+
tester:
6+
image: ${APP_IMAGE}
7+
ddagent:
8+
environment:
9+
- DD_API_KEY=invalid_api_key

integration/apps/rack/docker-compose.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,10 @@ services:
4747
- "8125/udp"
4848
- "8126"
4949
volumes:
50-
- type: bind
51-
source: ../../config/agent.yaml
52-
target: /etc/datadog-agent/datadog.yaml
50+
- ../../config/agent.yaml:/etc/datadog-agent/datadog.yaml
51+
# - type: bind
52+
# source: ../../config/agent.yaml
53+
# target: /etc/datadog-agent/datadog.yaml
5354
# For monitoring performance of containers (e.g. CPU, Memory, etc...)
5455
# - type: bind
5556
# source: /var/run/docker.sock
@@ -65,7 +66,7 @@ services:
6566
context: .
6667
args:
6768
BASE_IMAGE: datadog/dd-apm-demo:rb-2.7
68-
command: ./bin/rspec
69+
command: bin/rspec
6970
depends_on:
7071
- app
7172
environment:

integration/bin/ci

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ cd $INTEGRATION_DIR
77

88
# Set base image version
99
INTEGRATION_VERSIONS=( "2.2" "2.5" "2.7" )
10-
INTEGRATION_APPS=( "rack")
10+
INTEGRATION_APPS=( "rack" )
1111

1212
echo "== Starting CI test suite... =="
1313
echo " - Apps: $INTEGRATION_APPS"
@@ -19,7 +19,8 @@ do
1919
for version in "${INTEGRATION_VERSIONS[@]}"
2020
do
2121
:
22-
./bin/test -a $app -v $version
22+
# ./bin/test -a $app -v $version
23+
bash $INTEGRATION_DIR/apps/$app/bin/ci -v $version
2324
done
2425
done
2526

integration/bin/test

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ fi
3838

3939
# Set configuration
4040
INTEGRATION_BASE_IMAGE=${INTEGRATION_BASE_IMAGE:-datadog/dd-apm-demo:rb-$INTEGRATION_RUBY_VERSION}
41-
INTEGRATION_APP_IMAGE=${INTEGRATION_APP_IMAGE:-datadog/dd-apm-demo:rb-$INTEGRATION_RUBY_VERSION-$INTEGRATION_APP}
41+
INTEGRATION_APP_IMAGE=${INTEGRATION_APP_IMAGE:-$INTEGRATION_BASE_IMAGE-$INTEGRATION_APP}
4242
INTEGRATION_COMPOSE_FILES="-f $INTEGRATION_DIR/apps/$INTEGRATION_APP/docker-compose.yml -f docker-compose.ci.yml"
4343

4444
echo "== Running integration tests... =="
@@ -49,13 +49,10 @@ echo " - App image: $INTEGRATION_APP_IMAGE"
4949
echo ""
5050

5151
# Pull/build any missing images
52-
# BASE_IMAGE=$INTEGRATION_BASE_IMAGE docker-compose $INTEGRATION_COMPOSE_FILES build
5352
APP_IMAGE=$INTEGRATION_APP_IMAGE docker-compose $INTEGRATION_COMPOSE_FILES build
5453

5554
# Run the test suite
56-
# BASE_IMAGE=$INTEGRATION_BASE_IMAGE docker-compose $INTEGRATION_COMPOSE_FILES run tester /bin/bash
5755
APP_IMAGE=$INTEGRATION_APP_IMAGE docker-compose $INTEGRATION_COMPOSE_FILES run tester
5856

5957
# Cleanup
60-
# BASE_IMAGE=$INTEGRATION_BASE_IMAGE docker-compose $INTEGRATION_COMPOSE_FILES down -t 0 --remove-orphans
6158
APP_IMAGE=$INTEGRATION_APP_IMAGE docker-compose $INTEGRATION_COMPOSE_FILES down -t 0 --remove-orphans

integration/docker-compose.ci.yml

Lines changed: 0 additions & 17 deletions
This file was deleted.

0 commit comments

Comments
 (0)