Skip to content

Commit

Permalink
adding contributing doc (#603)
Browse files Browse the repository at this point in the history
  • Loading branch information
Abhishekism9450 authored May 26, 2023
1 parent 7a781b6 commit e5771f2
Show file tree
Hide file tree
Showing 3 changed files with 276 additions and 162 deletions.
76 changes: 76 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Contributor Covenant Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, sex characteristics, gender identity and expression,
level of experience, education, socio-economic status, nationality, personal
appearance, race, religion, or sexual identity and orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment
include:

- Using welcoming and inclusive language
- Being respectful of differing viewpoints and experiences
- Gracefully accepting constructive criticism
- Focusing on what is best for the community
- Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

- The use of sexualized language or imagery and unwelcome sexual attention or
advances
- Trolling, insulting/derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or electronic
address, without explicit permission
- Other conduct which could reasonably be considered inappropriate in a
professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.

## Scope

This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html

[homepage]: https://www.contributor-covenant.org

For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq
197 changes: 196 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,198 @@
## Contributing to the provider

Thank you for your interest in contributing to the Nutanix provider. We welcome your contributions. Here you'll find information to help you get started with provider development.


## Cloning the Project

First, you will want to clone the repository into your working directory:

```shell
git clone [email protected]:nutanix/terraform-provider-nutanix.git
```

## Running the Build

After the clone has been completed, you can enter the provider directory and build the provider.

```shell
cd terraform-provider-nutanix
make build
```

## Developing the Provider

**NOTE:** Before you start work on a feature, please make sure to check the [issue tracker](https://github.com/nutanix/terraform-provider-nutanix/issues) and existing [pull requests](https://github.com/nutanix/terraform-provider-nutanix/pulls) to ensure that work is not being duplicated. For further clarification, you can also ask in a new issue.


If you wish to work on the provider, you'll first need [Go][go-website] installed on your machine.

[go-website]: https://golang.org/
[gopath]: http://golang.org/doc/code.html#GOPATH


## Building Provider

### Installing the Local Plugin

*Note:* manual provider installation is needed only for manual testing of custom
built Nutanix provider plugin.

Manual installation process differs depending on Terraform version.
Run `terraform version` command to determine version of your Terraform installation.

1. Create `/registry.terraform.io/nutanixtemp/nutanix/1.99.99/darwin_amd64/` directories
under:

* `~/.terraform.d/plugins` (Mac and Linux)

```sh
mkdir -p ~/.terraform.d/plugins/registry.terraform.io/nutanixtemp/nutanix/1.99.99/darwin_amd64/
```

2. Build the **binary file**.
```sh
go build -o bin/terraform-provider-nutanix_macosx-v1.99.99
```

3. Copy Equinix provider **binary file** there.

```sh
cp bin/terraform-provider-nutanix_macosx-v1.99.99 ~/.terraform.d/plugins/registry.terraform.io/nutanixtemp/nutanix/1.99.99/darwin_amd64/terraform-provider-nutanix_v1.99.99
cp bin/terraform-provider-nutanix_macosx-v1.99.99 ~/.terraform.d/plugins/terraform-provider-nutanix_v1.99.99
```

4. In every Terraform template directory that uses Equinix provider, ship below
`terraform.tf` file *(in addition to other Terraform files)*

```hcl
terraform {
required_providers {
nutanix = {
source = "nutanixtemp/nutanix"
version = "1.99.99"
}
}
}
```

5. **Done!**

Local Nutanix provider plugin will be used after `terraform init`
command execution in Terraform template directory


### Running tests of provider

For running unit tests:
```sh
make test
```

For running integration tests:

1. Add environment variables for setup related details:
```ssh
export NUTANIX_USERNAME="<username>"
export NUTANIX_PASSWORD="<password>"
export NUTANIX_INSECURE=true
export NUTANIX_PORT=9440
export NUTANIX_ENDPOINT="<pc-ip>"
export NUTANIX_STORAGE_CONTAINER="<storage-container-uuid-for-vm-tests>"
export FOUNDATION_ENDPOINT="<foundation-vm-ip-for-foundation-related-tests>"
export FOUNDATION_PORT=8000
export NOS_IMAGE_TEST_URL="<test-image-url>"
export NDB_ENDPOINT="<ndb-ip>"
export NDB_USERNAME="<username>"
export NDB_PASSWORD="<password>"
```

2. Some tests need setup related constants for resource creation. So add/replace details in test_config.json (for pc tests) and test_foundation_config.json (for foundation and foundation central tests and NDB)

3. To run all tests:
```ssh
make testacc
```

4. To run specific tests:
```ssh
export TESTARGS='-run=TestAccNutanixPbr_WithSourceExternalDestinationNetwork'
make testacc
```

5. To run collection of tests:
``` ssh
export TESTARGS='-run=TestAccNutanixPbr*'
make testacc
```

### Common Issues using the development binary.

Terraform download the released binary instead developent one.

Just follow this steps to get the development binary:

1. Copy the development terraform binary in the root folder of the project (i.e. where your main.tf is), this should be named `terraform-provider-nutanix`
2. Remove the entire “.terraform” directory.
```sh
rm -rf .terraform/
```

3. Run the following command in the same folder where you have copied the development terraform binary.
```sh
terraform init -upgrade
terraform providers -version
```

4. You should see version as “nutanix (unversioned)”
5. Then run your main.tf


## Step to raise a Pull Request

1. Create a github issue with following details.
* **Title** should contain one of the following
- [Feat] Develop terraform resource for \<api_name>
- [Imprv] Modify terraform resource to support \<new_functionality>
- [Bug] Fix \<summary of issue> bug in \<terraform_resource_name>

* **Labels** should contain one of the following
- **feature**
- **enhancement**
- **bug**
- **test**

* **Project** should be selected
* **Assignees** - assign yourself

2. Create one of the following git branch from `master` branch. Use `issue#<id>`.
* `feat/<resource_name>_issue#<id>`
* `imprv/issue#<id>`
* `bug/issue#<id>`

3. Please use code comments on the Pull Request.

4. If a reviewer commented on your PR or asked for changes, please mark the discussion as resolved after you make suggested changes in it. PRs with unresolved issues should not be merged.
4. Tests are mandatory for each PRs except documentation changes.
5. Ensure 85% code coverage on the pull request. Pull request with less than 85% coverage will be rejected.
6. Link the pull requested with the associated issue.
6. Once PR is merged, close the issue.

## Additional Resources

We've got a handful of resources outside of this repository that will help users understand the interactions between terraform and Nutanix
* YouTube
_ Overview Video: [](https://www.youtube.com/watch?v=V8_Lu1mxV6g)
_ Working with images: [](https://www.youtube.com/watch?v=IW0eQevZ73I)
* Nutanix GitHub
_ [](https://github.com/nutanix/terraform-provider-nutanix)
_ Private repo until code goes upstream
* Jon’s GitHub
_ [](https://github.com/JonKohler/ThisOldCloud/tree/master/Terraform-Nutanix)
_ Contains sample TF’s and PDFs from the youtube videos
* Slack channel \* User community slack channel is available on nutanix.slack.com. Email [email protected] to gain entry.
# Nutanix Contributor License Agreement
By submitting a pull request or otherwise contributing to the project, you agree to the following terms and conditions. You reserve all right and title in your contributions.
Expand All @@ -9,4 +204,4 @@ You hereby grant Nutanix and to recipients of software distributed by Nutanix, a
You represent that your contributions are your original creation, and that you are legally entitled to grant the above license. If your contributions include other third party code, you will include complete details on any third party licenses or restrictions associated with your contributions.
## Notifications
You will notify Nutanix if you become aware that the above representations are inaccurate.
You will notify Nutanix if you become aware that the above representations are inaccurate.
Loading

0 comments on commit e5771f2

Please sign in to comment.