dev/provisioning/modules/elasticsearch/CONTRIBUTING.md
changeset 406 cf0f23803a53
parent 28 b0b56e0f8c7f
equal deleted inserted replaced
405:f239c8c5bb94 406:cf0f23803a53
     1 If you have a bugfix or new feature that you would like to contribute to this puppet module, 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.
     1 # Contributing
     2 
     2 
     3 We enjoy working with contributors to get their code accepted. There are many approaches to fixing a problem and it is important to find the best approach before writing too much code.
     3 If you have a bugfix or new feature that you would like to contribute to this puppet module, please find or open an issue about it first.
       
     4 Talk about what you would like to do.
       
     5 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.
       
     6 
       
     7 **Note**: If you have support-oriented questions that aren't a bugfix or feature request, please post your questions on the [discussion forums](https://discuss.elastic.co/c/elasticsearch).
       
     8 
       
     9 We enjoy working with contributors to get their code accepted.
       
    10 There are many approaches to fixing a problem and it is important to find the best approach before writing too much code.
     4 
    11 
     5 The process for contributing to any of the Elastic repositories is similar.
    12 The process for contributing to any of the Elastic repositories is similar.
     6 
    13 
     7 1. Sign the contributor license agreement
    14 ## The Contributor License Agreement
     8 Please make sure you have signed the [Contributor License Agreement](http://www.elastic.co/contributor-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.
       
     9 
    15 
    10 2. Run the rspec tests and ensure it completes without errors with your changes.
    16 Please make sure you have signed the [Contributor License Agreement](http://www.elastic.co/contributor-agreement/).
       
    17 We are not asking you to assign copyright to us, but to give us the right to distribute your code without restriction.
       
    18 We ask this of all contributors in order to assure our users of the origin and continuing existence of the code.
       
    19 You only need to sign the CLA once.
    11 
    20 
    12 3. Run the acceptance tests
    21 ## Development Setup
    13 
    22 
    14 These instructions are for Ubuntu 14.04
    23 There are a few testing prerequisites to meet:
    15 
    24 
    16 * install docker 0.11.1 
    25 * Ruby.
    17  * wget https://get.docker.io/ubuntu/pool/main/l/lxc-docker/lxc-docker_0.11.1_amd64.deb
    26   As long as you have a recent version with `bundler` available, `bundler` will install development dependencies.
    18  * wget https://get.docker.io/ubuntu/pool/main/l/lxc-docker-0.11.1/lxc-docker-0.11.1_0.11.1_amd64.deb
       
    19  * sudo dpkg -i lxc-docker_0.11.1_amd64.deb lxc-docker-0.11.1_0.11.1_amd64.deb
       
    20  * sudo usermod -a -G docker $USER
       
    21 * export RS_SET='ubuntu-server-1404-x64' # see spec/acceptance/nodesets for more
       
    22 * export VM_PUPPET_VERSION='3.7.0'
       
    23 * wget https://download.elastic.co/elasticsearch/elasticsearch/elasticsearch-1.1.0.deb
       
    24 * wget https://forgeapi.puppetlabs.com/v3/files/puppetlabs-stdlib-3.2.0.tar.gz
       
    25 * wget https://forgeapi.puppetlabs.com/v3/files/puppetlabs-apt-1.4.2.tar.gz
       
    26 * export files_dir=$(pwd)
       
    27 * bundle install
       
    28 * bundle exec rspec --require ci/reporter/rspec --format CI::Reporter::RSpecFormatter spec/acceptance/*_spec.rb
       
    29 
    27 
    30 ```
    28 You can then install the necessary gems with:
    31     Hypervisor for ubuntu-14-04 is docker
       
    32     Beaker::Hypervisor, found some docker boxes to create
       
    33     Provisioning docker
       
    34     provisioning ubuntu-14-04
       
    35     ...
       
    36     Finished in 18 minutes 6 seconds
       
    37     224 examples, 0 failures, 3 pending
       
    38 ```
       
    39 
    29 
    40 4. Rebase your changes
    30     make
    41 Update your local repository with the most recent code from the main this puppet module repository, and rebase your branch on top of the latest master branch. We prefer your changes to be squashed into a single commit.
       
    42 
    31 
    43 5. Submit a pull request
    32 This will install the requisite rubygems for testing into `.vendor`.
    44 Push your local changes to your forked copy of the repository and submit a pull request. In the pull request, describe what your changes do and mention the number of the issue where discussion has taken place, eg “Closes #123″.
    33 Note that you can purge all testing fixtures/artifacts/gems with `make clean`.
    45 
    34 
    46 Then sit back and wait. There will probably be discussion about the pull request and, if any changes are needed, we would love to work with you to get your pull request merged into this puppet module.
    35 * Docker.
       
    36   Note that Docker is used to run tests that require a Linux container/VM - if you only need to run simple rspec/doc tests, this shouldn't be necessary.
       
    37   If you are developing on a Linux machine with a working Docker instance, this should be sufficient.
       
    38   On OS X, just use the official [Docker installation method](https://docs.docker.com/engine/installation/mac/) to get a working `docker` setup.
       
    39   Confirm that you can communicate with the Docker hypervisor with `docker version`.
       
    40 
       
    41 ## Testing
       
    42 
       
    43 Running through the tests on your own machine can get ahead of any problems others (or Jenkins) may run into.
       
    44 
       
    45 First, run the rspec tests and ensure it completes without errors with your changes. These are lightweight tests.
       
    46 
       
    47     make test-rspec
       
    48 
       
    49 Next, run the more thorough acceptance tests.
       
    50 By default, the test will run against a Debian 8 Docker image - other available hosts can be found in `spec/acceptance/nodesets`.
       
    51 For example, to run the acceptance tests against CentOS 6, run the following:
       
    52 
       
    53     DISTRO=centos-6-x64 make test-acceptance
       
    54 
       
    55 The final output line will tell you which, if any, tests failed.
       
    56 
       
    57 ## Opening Pull Requests
       
    58 
       
    59 In summary, to open a new PR:
       
    60 
       
    61 * Sign the Contributor License Agreement
       
    62 * Run the tests to confirm everything works as expected
       
    63 * Rebase your changes.
       
    64   Update your local repository with the most recent code from this puppet module repository, and rebase your branch on top of the latest master branch.
       
    65 * Submit a pull request
       
    66   Push your local changes to your forked copy of the repository and submit a pull request.
       
    67   In the pull request, describe what your changes do and mention the number of the issue where discussion has taken place, eg "Closes #123".
       
    68 
       
    69 Then sit back and wait!
       
    70 There will probably be discussion about the pull request and, if any changes are needed, we would love to work with you to get your pull request merged into this puppet module.