The Elastic Synthetics Agent is open source and we love to receive contributions from our community — you!
There are many ways to contribute, from writing tutorials or blog posts, improving the documentation, submitting bug reports and feature requests or writing code.
You can get in touch with us through Discuss— feedback and ideas are always welcome.
If you have a bugfix or new feature that you would like to contribute, please find or open an issue about it first. Talk about what you would like to do. It may be that somebody is already working on it, or that there are particular issues that you should know about before implementing the change.
Generally, we require that you test any code you are adding or modifying. Once your changes are ready to submit for review:
-
Sign the Contributor License Agreement
Please make sure you have signed our Contributor License Agreement. We are not asking you to assign copyright to us, but to give us the right to distribute your code without restriction. We ask this of all contributors in order to assure our users of the origin and continuing existence of the code. You only need to sign the CLA once.
-
Test your changes
Run the test suite to make sure that nothing is broken. If you're adding new code or changing existing code, write some automated tests that exercise this code. See testing for details.
-
Rebase your changes
Update your local repository with the most recent code from the main repo, and rebase your branch on top of the latest main branch. We prefer your initial changes to be squashed into a single commit. Later, if we ask you to make changes, add them as separate commits. This makes it easier to review. As a final step before merging, we will either ask you to squash all commits yourself or we'll do it for you.
-
Submit a pull request
Push your local changes to your forked copy of the repository and submit a pull request. In the pull request, choose a title that sums up the changes that you have made, and in the body provide more details about what your changes do. Also mention the number of the issue where the discussion has taken place, eg "Fixes #123".
-
Be patient
We might not be able to review your code as fast as we would like to, but we'll do our best to dedicate it the attention it deserves. Your effort is much appreciated!
All feature development and most bug fixes hit the main branch first. Pull requests should be reviewed by someone with commit access. Once approved, the author of the pull request, or reviewer if the author does not have commit access, should "Squash and merge".
Before submitting a pull request, please make sure to follow the below steps
-
Fork the repo and create your branch from
main
. -
We use
npm
for running development scripts. -
Install the project dependencies
npm install
- We use TypeScript, run the build step to transpile the code to JavaScript and also to do type checking
npm run build
- You can also run in watch mode to continuously transform changed files to speed up the feedback loop.
npm run watch
- Make sure to update documentation or add test suites wherever appropriate. Ensure test passes via
npm run test
This project uses pre-commit so, after installing it, please install the already configured pre-commit hooks we support, to enable pre-commit in your local git repository:
$ pre-commit install
pre-commit installed at .git/hooks/pre-commit
To understand more about the hooks we use, please take a look at pre-commit's configuration file.
This project currently has both unit and integration tests.
We use Jest for running tests. Unit tests
are located under the __tests__
directory and can be run as
npm run test
We build the heartbeat image with the latest agent to look for any failures in integration. Follow the below steps to invoke the synthetics agent using heartbeat locally
cd /examples/docker
./pull-latest.sh
- Pulls the latest heartbeat image./run.sh $HEARTBEAT_ARGS
- Run the heartbeat image with the synthetic tests configured inheartbeat.docker.yml
file.
We run end to end tests for the Synthetics agent itself, as well as the Elastic Synthetics integration. For more information, view the README in the end to end tests repo.
The release process is also automated in the way any specific commit from the main branch can be potentially released, for such it's required the below steps:
- Go to https://github.com/elastic/synthetics/actions/workflows/release.yml
- Click the
Run workflow
dropdown button. - Use the
main
branch option which is selected by default. - Choose whether a
stack_release
dist-tag should be created or not. - Click the green
Run workflow
button to trigger the release workflow. - Then you can go to the
https://www.npmjs.com/package/@elastic/synthetics
to validate that the bundles have been published.
The version is computed automatically with semantic-release.
You must not modify the 0.0.0-development
version in the package.json file. It will be overwritten by the release process.
The CI will not run builds for collaborators PRs that are not approval by a members of Elastic org,
Elastic Users can launch the CI on PRs by putting a comment like /test
or manually on the CI.