-
Notifications
You must be signed in to change notification settings - Fork 2
Added optional elastic search #51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds optional Elasticsearch support to the Codeception test workflow by introducing a conditional flag. The service can now be enabled only when needed, avoiding unnecessary resource allocation in test environments that don't require Elasticsearch.
Key Changes:
- Added
ENABLE_ELASTICSEARCHboolean input (defaults to false) - Replaced commented-out Elasticsearch configuration with conditional service that uses a dummy bash container when disabled
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| ports: | ||
| - ${{ inputs.ENABLE_ELASTICSEARCH && inputs.PIMCORE_ELASTIC_SEARCH_HOST || '0' }}:9200 |
Copilot
AI
Oct 24, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Port mapping '0:9200' is invalid. When Elasticsearch is disabled, the service should not expose any ports. Consider using an empty array or omitting the ports configuration entirely when ENABLE_ELASTICSEARCH is false.
| ports: | |
| - ${{ inputs.ENABLE_ELASTICSEARCH && inputs.PIMCORE_ELASTIC_SEARCH_HOST || '0' }}:9200 | |
| ports: ${{ inputs.ENABLE_ELASTICSEARCH && format('[\"{0}:9200\"]', inputs.PIMCORE_ELASTIC_SEARCH_HOST) || '[]' }} |
| image: ${{ inputs.ENABLE_ELASTICSEARCH && format('elasticsearch:{0}', inputs.PIMCORE_ELASTIC_SEARCH_VERSION) || 'nginx:alpine' }} | ||
| ports: | ||
| - ${{ inputs.ENABLE_ELASTICSEARCH && inputs.PIMCORE_ELASTIC_SEARCH_HOST || '0' }}:9200 | ||
| env: ${{ inputs.ENABLE_ELASTICSEARCH && fromJSON('{"discovery.type":"single-node","ES_JAVA_OPTS":"-Xms512m -Xmx512m","xpack.security.enabled":"true","xpack.security.authc.anonymous.roles":"superuser"}') || fromJSON('{}') }} |
Copilot
AI
Oct 24, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The inline JSON for Elasticsearch environment variables reduces readability. Consider defining these as separate YAML key-value pairs or extracting to a reusable configuration block for better maintainability.
| env: ${{ inputs.ENABLE_ELASTICSEARCH && fromJSON('{"discovery.type":"single-node","ES_JAVA_OPTS":"-Xms512m -Xmx512m","xpack.security.enabled":"true","xpack.security.authc.anonymous.roles":"superuser"}') || fromJSON('{}') }} | |
| env: | |
| discovery.type: ${{ inputs.ENABLE_ELASTICSEARCH && 'single-node' || '' }} | |
| ES_JAVA_OPTS: ${{ inputs.ENABLE_ELASTICSEARCH && '-Xms512m -Xmx512m' || '' }} | |
| xpack.security.enabled: ${{ inputs.ENABLE_ELASTICSEARCH && 'true' || '' }} | |
| xpack.security.authc.anonymous.roles: ${{ inputs.ENABLE_ELASTICSEARCH && 'superuser' || '' }} |
This pull request updates the
.github/workflows/reusable-codeception-tests-centralized.yamlworkflow to add support for optionally enabling Elasticsearch as a service during tests. The main changes introduce a new input to control Elasticsearch activation and refactor the service configuration to conditionally start Elasticsearch based on this input.Elasticsearch service configuration:
ENABLE_ELASTICSEARCH(boolean, defaultfalse) to allow toggling Elasticsearch service in the workflow.elasticservice definition to conditionally start Elasticsearch only whenENABLE_ELASTICSEARCHis set totrue; otherwise, it uses a placeholder service (nginx:alpine). Environment variables and ports are also set conditionally.Workflow inputs and job configuration:
ENABLE_ELASTICSEARCHinput into the job environment, allowing downstream steps and services to react to its value.