Skip to content

Latest commit

 

History

History
162 lines (109 loc) · 5.93 KB

CONTRIBUTING.md

File metadata and controls

162 lines (109 loc) · 5.93 KB

Contributing to the Synthetics Agent

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.

Code contributions

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.

Submitting your changes

Generally, we require that you test any code you are adding or modifying. Once your changes are ready to submit for review:

  1. 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.

  2. 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.

  3. 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.

  4. 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".

  5. 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!

Workflow

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

  1. Fork the repo and create your branch from main.

  2. We use npm for running development scripts.

  3. Install the project dependencies

npm install
  1. We use TypeScript, run the build step to transpile the code to JavaScript and also to do type checking
npm run build
  1. You can also run in watch mode to continuously transform changed files to speed up the feedback loop.
npm run watch
  1. Make sure to update documentation or add test suites wherever appropriate. Ensure test passes via
npm run test

pre-commit

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.

Testing

This project currently has both unit and integration tests.

Unit tests

We use Jest for running tests. Unit tests are located under the __tests__ directory and can be run as

npm run test
Integration tests

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

  1. cd /examples/docker
  2. ./pull-latest.sh - Pulls the latest heartbeat image
  3. ./run.sh $HEARTBEAT_ARGS - Run the heartbeat image with the synthetic tests configured in heartbeat.docker.yml file.
End to End tests

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.

Releasing

CI based

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:

  1. Go to https://github.com/elastic/synthetics/actions/workflows/release.yml
  2. Click the Run workflow dropdown button.
  3. Use the main branch option which is selected by default.
  4. Choose whether a stack_release dist-tag should be created or not.
  5. Click the green Run workflow button to trigger the release workflow.
  6. Then you can go to the https://www.npmjs.com/package/@elastic/synthetics to validate that the bundles have been published.

Versioning

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.

CI

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.