Skip to content

Promote Elasticsearch to a native GitHub Actions service#1008

Open
mattmenefee wants to merge 1 commit intotoptal:masterfrom
mattmenefee:ci-test-infrastructure-improvements
Open

Promote Elasticsearch to a native GitHub Actions service#1008
mattmenefee wants to merge 1 commit intotoptal:masterfrom
mattmenefee:ci-test-infrastructure-improvements

Conversation

@mattmenefee
Copy link
Contributor

@mattmenefee mattmenefee commented Mar 17, 2026

Summary

  • Promote Elasticsearch to a proper GH Actions services: block with a built-in health check (wait_for_status=yellow), replacing the fragile docker compose + sleep 15 approach
  • Switch Docker image from Docker Hub to docker.elastic.co registry and parameterize the version via ES_VERSION env var in docker-compose.yml
  • Rename test job from ruby-3 to test (Ruby 4.0 is now in the matrix)
  • Add timeout-minutes to both jobs (15 for tests, 10 for rubocop)
  • Add concurrency group to cancel in-progress CI runs on PR updates

Test plan

  • CI passes with Elasticsearch as a native GH Actions service
  • Docker image pulls successfully from docker.elastic.co

@mattmenefee mattmenefee requested a review from a team as a code owner March 17, 2026 16:39
@mattmenefee mattmenefee force-pushed the ci-test-infrastructure-improvements branch 3 times, most recently from dc8bcb5 to f4afb4c Compare March 17, 2026 17:30
@mattmenefee mattmenefee force-pushed the ci-test-infrastructure-improvements branch 2 times, most recently from 688fe0d to 48236a8 Compare March 17, 2026 20:29
Copy link
Member

@bbatsov bbatsov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This bundles a lot of unrelated changes into one PR, which makes it hard to review. I'd suggest trimming it to the core CI improvements (the services: block for ES, concurrency, timeouts) and the drop_indices fix, then sending the rest as separate PRs. One logical change per commit, please.

A few specific things:

  • The canary specs (elasticsearch_compatibility_spec.rb) test third-party library internals, not Chewy. If the ES gem breaks its own API, that's their problem. I'd drop these entirely.
  • The README Ruby version change is unrelated to CI work -- separate PR.
  • Changelog should use ## master (unreleased), not ## 8.0.2 (unreleased). Version numbers are decided at release time.

# Security disabled for local testing only; enable in production
- xpack.security.enabled=false
- action.destructive_requires_name=false
ports:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this actually needed? drop_indices passes an explicit list of index names, not a wildcard.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! You're right, drop_indices passes explicit names so this setting has no effect. I'll remove it.

discovery.type: single-node
xpack.security.enabled: 'false'
ES_JAVA_OPTS: '-Xms500m -Xmx500m'
# Set health checks to wait until Elasticsearch has started
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

green is stricter than needed for a single-node test cluster. yellow is more conventional for CI and avoids potential flakiness.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair point. I originally used green for consistency with the wait_for_status: 'green' setting in spec_helper.rb, but you're right that they serve different purposes. The CI health check just needs to know the cluster is ready to accept requests, so yellow is the better threshold here. I'll change it.

@mattmenefee mattmenefee force-pushed the ci-test-infrastructure-improvements branch from 24c5bf8 to 98bc129 Compare March 18, 2026 15:38
The previous CI setup launched ES via `docker compose up` with a
`sleep 15` wait, which was fragile and slow. Promote ES to a proper
GitHub Actions `services:` block with a built-in health check
(`wait_for_status=yellow`) for reliable startup detection.

- Add `concurrency` group to cancel in-progress runs on PR updates
- Add `timeout-minutes` to both jobs (15 test, 10 rubocop)
- Add `permissions: contents: read` for least-privilege
- Rename test job from `ruby-3` to `test` (Ruby 4.0 is in the matrix)
- Switch docker-compose image to `docker.elastic.co` registry and
  parameterize the version via `ES_VERSION` env var
@mattmenefee mattmenefee force-pushed the ci-test-infrastructure-improvements branch from 98bc129 to 4b0aa9e Compare March 18, 2026 16:14
@mattmenefee
Copy link
Contributor Author

mattmenefee commented Mar 18, 2026

@bbatsov Thanks for the review! I've addressed your feedback:

@mattmenefee mattmenefee changed the title Improve CI and test infrastructure robustness Promote Elasticsearch to a native GitHub Actions service Mar 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants