mirror of
https://github.com/kreuzwerker/terraform-provider-docker.git
synced 2025-12-18 14:56:17 -05:00
docs: adds coc and contributing
This commit is contained in:
parent
cf611b417f
commit
544fd2a685
2 changed files with 199 additions and 0 deletions
74
CODE_OF_CONDUCT.md
Normal file
74
CODE_OF_CONDUCT.md
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
# 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, gender identity and expression, level of experience,
|
||||
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 at root@carlosbecker.com. 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 [http://contributor-covenant.org/version/1/4][version]
|
||||
|
||||
[homepage]: http://contributor-covenant.org
|
||||
[version]: http://contributor-covenant.org/version/1/4/
|
||||
125
CONTRIBUTING.md
Normal file
125
CONTRIBUTING.md
Normal file
|
|
@ -0,0 +1,125 @@
|
|||
# Contributing
|
||||
|
||||
By participating to this project, you agree to abide our [code of
|
||||
conduct](/CODE_OF_CONDUCT.md).
|
||||
|
||||
## Setup your machine
|
||||
|
||||
`terraform-provider-docker` is written in [Go](https://golang.org/).
|
||||
|
||||
Prerequisites:
|
||||
|
||||
- `make`, `git`, `bash`
|
||||
- [Go 1.15+](https://golang.org/doc/install)
|
||||
- [Docker](https://www.docker.com/)
|
||||
- [Terraform 0.12+](https://terraform.io/)
|
||||
|
||||
Clone `terraform-provider-docker` anywhere:
|
||||
|
||||
```sh
|
||||
git clone git@github.com:kreuzwerker/terraform-provider-docker.git
|
||||
```
|
||||
|
||||
Install the build dependencies:
|
||||
|
||||
```sh
|
||||
make build
|
||||
```
|
||||
|
||||
## Test your change
|
||||
|
||||
You can create a branch for your changes and try to build from the source as you go:
|
||||
|
||||
```sh
|
||||
make build
|
||||
```
|
||||
|
||||
### Unit and acceptance tests
|
||||
When you are satisfied with the changes, **tests**, and **documentation** updates, we suggest you run:
|
||||
|
||||
```sh
|
||||
# unit tests
|
||||
make test
|
||||
|
||||
# acceptance test
|
||||
## setup the testing environment
|
||||
make testacc_setup
|
||||
|
||||
## run a single test
|
||||
TF_LOG=INFO TF_ACC=1 go test -v ./docker -run ^TestAccDockerImage_data_private_config_file$ -timeout 360s
|
||||
|
||||
## cleanup the local testing resources
|
||||
make testacc_cleanup
|
||||
```
|
||||
|
||||
### Test against current terraform IaC descriptions
|
||||
In order to extend the provider and test it with `terraform`, build the provider as mentioned above with:
|
||||
|
||||
```sh
|
||||
# Testing in a local mirror which needs to have the following convention.
|
||||
# See https://www.terraform.io/docs/commands/cli-config.html#provider-installation for details
|
||||
export TESTING_MIRROR=testing-mirror/registry.terraform.io/kreuzwerker/docker/9.9.9/$(go env GOHOSTOS)_$(go env GOHOSTARCH)
|
||||
mkdir -p ./$TESTING_MIRROR
|
||||
|
||||
# now we build into the provider into the local mirror
|
||||
go build -o ./$TESTING_MIRROR/terraform-provider-docker_v9.9.9
|
||||
```
|
||||
|
||||
Now we change into the `testing` directory (which is ignored as well) and set an explicit version of the provider we develop:
|
||||
```hcl
|
||||
terraform {
|
||||
required_providers {
|
||||
docker = {
|
||||
source = "kreuzwerker/docker"
|
||||
version = "9.9.9"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
provider "docker" {
|
||||
}
|
||||
|
||||
resource "docker_image" "foo" {
|
||||
name = "nginx:latest"
|
||||
keep_locally = true
|
||||
}
|
||||
|
||||
resource "docker_container" "foo" {
|
||||
name = "foo"
|
||||
image = docker_image.foo.latest
|
||||
}
|
||||
```
|
||||
|
||||
As the next step we can init terraform by provider a local plugin directory:
|
||||
```sh
|
||||
# Which reflects the convention mentioned before
|
||||
# See https://www.terraform.io/docs/commands/init.html#plugin-installation
|
||||
terraform init -plugin-dir=../testing-mirror
|
||||
terraform plan
|
||||
terraform apply -auto-approve
|
||||
```
|
||||
|
||||
### Developing on Windows
|
||||
|
||||
You can build and test on Windows without `make`. Run `go install` to
|
||||
build and `Scripts\runAccTests.bat` to run the test suite.
|
||||
|
||||
Continuous integration for Windows is not available at the moment due
|
||||
to lack of a CI provider that is free for open source projects *and*
|
||||
supports running Linux containers in Docker for Windows. For example,
|
||||
AppVeyor is free for open source projects and provides Docker on its
|
||||
Windows builds, but only offers Linux containers on Windows as a paid
|
||||
upgrade.
|
||||
|
||||
## Create a commit
|
||||
|
||||
Commit messages should be well formatted, and to make that "standardized", we
|
||||
are using Conventional Commits.
|
||||
|
||||
You can follow the documentation on
|
||||
[their website](https://www.conventionalcommits.org).
|
||||
|
||||
## Submit a pull request
|
||||
|
||||
Push your branch to your `terraform-provider-docker` fork and open a
|
||||
pull request against the master branch.
|
||||
Loading…
Reference in a new issue