You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+11-8Lines changed: 11 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,8 +13,10 @@ Before submitting an issue or a pull request, please search the repository for e
13
13
1. Fork and clone the repository.
14
14
2. Create a new branch: `git switch -c my-branch-name`.
15
15
3. Make your change, add tests, and make sure the tests still pass.
16
-
4. Push to your fork and submit a pull request.
17
-
5. Pat yourself on the back and wait for your pull request to be reviewed and merged.
16
+
4. Update or add documentation to reflect your changes.
17
+
5. Ensure formatting and linting are passing.
18
+
6. Push to your fork and submit a pull request.
19
+
7. Pat yourself on the back and wait for your pull request to be reviewed and merged.
18
20
19
21
Here are a few things you can do that will increase the likelihood of your pull request being accepted:
20
22
@@ -47,21 +49,21 @@ Once you have the repository cloned, there's a couple of additional steps you'll
47
49
```
48
50
49
51
- Build the project with `make build`
50
-
- Try an example test run from the default (`main`) branch, like `TF_LOG=DEBUG TF_ACC=1 go test -v ./... -run ^TestAccGithubRepositories`. All those tests should pass.
52
+
- Try an example test run from the default (`main`) branch, like `TF_LOG=DEBUG make testacc T=TestAccGithubRepositories`. All those tests should pass.
51
53
52
54
### Local Development Iteration
53
55
54
56
1. Write a test describing what you will fix. See [`github_label`](./github/resource_github_issue_label_test.go) for an example format.
55
57
2. Run your test and observe it fail. Enabling debug output allows for observing the underlying requests and responses made as well as viewing state (search `STATE:`) generated during the acceptance test run.
56
58
57
59
```sh
58
-
TF_LOG=DEBUG TF_ACC=1 go test -v ./... -run ^TestAccGithubIssueLabel
60
+
TF_LOG=DEBUG make testacc T=TestAccGithubIssueLabel
59
61
```
60
62
61
63
1. Align the resource's implementation to your test case and observe it pass:
62
64
63
65
```sh
64
-
TF_ACC=1 go test -v ./... -run ^TestAccGithubIssueLabel
66
+
make testacc T=TestAccGithubIssueLabel
65
67
```
66
68
67
69
Note that some resources still use a previous format that is incompatible with automated test runs, which depend on using the `skipUnlessMode` helper. When encountering these resources, tests should be rewritten to the latest format.
@@ -70,7 +72,7 @@ Also note that there is no build / `terraform init` / `terraform plan` sequence
70
72
71
73
### Debugging the terraform provider
72
74
73
-
Println debugging can easily be used to obtain information about how code changes perform. If the `TF_LOG=DEBUG` level is set, calls to `log.Printf("[DEBUG] your message here")`will be printed in the program's output.
75
+
Println debugging can easily be used to obtain information about how code changes perform. If the `TF_LOG=DEBUG` level is set, debug messages will be printed. Use `tflog.Debug(ctx, "your message here", map[string]any{...})` for new code. Some existing code still uses `log.Printf("[DEBUG] ...")`— see [ARCHITECTURE.md](ARCHITECTURE.md#logging) for the migration pattern.
74
76
75
77
If a full debugger is desired, VSCode may be used. In order to do so,
76
78
@@ -88,7 +90,7 @@ If a full debugger is desired, VSCode may be used. In order to do so,
88
90
89
91
Setting a `processId` of 0 allows a dropdown to select the process of the provider.
90
92
91
-
1. Add a sleep call (e.g. `time.Sleep(10 * time.Second)`) in the [`func providerConfigure(p *schema.Provider) schema.ConfigureFunc`](https://github.com/integrations/terraform-provider-github/blob/cec7e175c50bb091feecdc96ba117067c35ee351/github/provider.go#L274C1-L274C64) before the immediate `return` call. This will allow time to connect the debugger while the provider is initializing, before any critical logic happens.
93
+
1. Add a sleep call (e.g. `time.Sleep(10 * time.Second)`) in `providerConfigure` (in `github/provider.go`) before the immediate `return` call. This will allow time to connect the debugger while the provider is initializing, before any critical logic happens.
92
94
93
95
2. Build the terraform provider with debug flags enabled and copy it to the appropriate bin folder with a command like `go build -gcflags="all=-N -l" -o ~/go/bin/`.
94
96
@@ -104,7 +106,7 @@ Manual testing should be performed on each PR opened in order to validate the pr
104
106
105
107
### Using a local version of the provider
106
108
107
-
Build the provider and specify the output directory:
109
+
Build the provider with debug flags for attaching a debugger:
0 commit comments