Skip to content

Commit f5337ae

Browse files
authored
ci: run E2E on push to main, fix compose include conflict (opensearch-project#98)
1 parent c1449e0 commit f5337ae

5 files changed

Lines changed: 19 additions & 19 deletions

File tree

.github/workflows/e2e.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
name: E2E Tests
22

33
on:
4+
push:
5+
branches: [main]
6+
paths-ignore:
7+
- 'docs/**'
8+
- '*.md'
49
pull_request:
510
branches: [main]
611
paths-ignore:

docker-compose.local-opensearch.yml

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,3 @@ services:
5959
timeout: 10s
6060
retries: 30
6161
logging: *logging
62-
63-
# Add depends_on opensearch to services that need it for local startup ordering
64-
otel-collector:
65-
depends_on:
66-
opensearch:
67-
condition: service_healthy
68-
69-
data-prepper:
70-
depends_on:
71-
opensearch:
72-
condition: service_healthy

docker-compose.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ services:
5454
- OPENSEARCH_HOST=${OPENSEARCH_HOST}
5555
- OPENSEARCH_PORT=${OPENSEARCH_PORT}
5656
- GOMEMLIMIT=160MiB
57+
depends_on:
58+
opensearch:
59+
condition: service_healthy
60+
required: false
5761
logging: *logging
5862

5963
# Data Prepper - Transforms and enriches logs/traces before OpenSearch ingestion
@@ -86,6 +90,10 @@ services:
8690
- OPENSEARCH_PORT=${OPENSEARCH_PORT}
8791
- OPENSEARCH_USER=${OPENSEARCH_USER}
8892
- OPENSEARCH_PASSWORD=${OPENSEARCH_PASSWORD}
93+
depends_on:
94+
opensearch:
95+
condition: service_healthy
96+
required: false
8997
networks:
9098
- observability-stack-network
9199
restart: unless-stopped

test/e2e-install.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,11 @@ trap cleanup EXIT
1818

1919
echo "==> Running install.sh..."
2020
# Patch install.sh to read from stdin instead of /dev/tty (no TTY in CI)
21+
# and replace git clone with a local copy so we test the PR's code
2122
PATCHED_SCRIPT=$(mktemp)
22-
sed 's|< /dev/tty||g' "$PROJECT_DIR/install.sh" > "$PATCHED_SCRIPT"
23+
sed -e 's|< /dev/tty||g' \
24+
-e 's|git clone --depth 1 "$REPO_URL" "$INSTALL_DIR" >/dev/null 2>\&1|cp -r "'"$PROJECT_DIR"'/." "$INSTALL_DIR"|' \
25+
"$PROJECT_DIR/install.sh" > "$PATCHED_SCRIPT"
2326
chmod +x "$PATCHED_SCRIPT"
2427

2528
# Feed answers: install dir, no examples, no otel demo, no custom creds

test/e2e.sh

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,16 @@ set -euo pipefail
33

44
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
55
PROJECT_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
6-
COMPOSE_FILE="$PROJECT_DIR/docker-compose.yml"
76
WAIT_TIMEOUT="${WAIT_TIMEOUT:-180}"
87

9-
# Override to only run core stack (no examples/demo)
10-
export INCLUDE_COMPOSE_EXAMPLES=docker-compose/util/docker-compose.empty.yml
11-
export INCLUDE_COMPOSE_OTEL_DEMO=docker-compose/util/docker-compose.empty.yml
12-
138
cleanup() {
149
echo "==> Tearing down..."
15-
docker compose -f "$COMPOSE_FILE" --project-directory "$PROJECT_DIR" down -v --remove-orphans 2>/dev/null || true
10+
docker compose --project-directory "$PROJECT_DIR" down -v --remove-orphans 2>/dev/null || true
1611
}
1712
trap cleanup EXIT
1813

1914
echo "==> Starting observability stack..."
20-
docker compose -f "$COMPOSE_FILE" --project-directory "$PROJECT_DIR" up -d --wait --wait-timeout "$WAIT_TIMEOUT"
15+
docker compose --project-directory "$PROJECT_DIR" up -d --wait --wait-timeout "$WAIT_TIMEOUT"
2116

2217
# Parse .env safely (don't source — some values aren't shell-safe)
2318
eval "$(grep -E '^(OPENSEARCH_USER|OPENSEARCH_PASSWORD|OPENSEARCH_PORT|OPENSEARCH_DASHBOARDS_PORT|OTEL_COLLECTOR_PORT_HTTP|PROMETHEUS_PORT)=' "$PROJECT_DIR/.env")"

0 commit comments

Comments
 (0)