Skip to content

Commit 3394c78

Browse files
docs: Improve local development build and test instructions (#6)
* Improve local build step by step instructions * Re-word platform code instructions
1 parent 30cca03 commit 3394c78

1 file changed

Lines changed: 27 additions & 9 deletions

File tree

README.md

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,31 +6,49 @@ Coming soon.
66

77
## Local Development
88

9+
### 1) Start a Local AWX instance in a kubernetes cluster
10+
A fresh AWX instance is required for automated tests, so they can ensure terraform provider is working by targetting a live AWX instance.
11+
12+
A new instance can be re-created by invoking the `reCreate` [mage](https://magefile.org/) target defined in `tools/magefile.go`.
13+
Once executed it will deploy an AWX instance to a Kubernetes cluster, using [kind](https://kind.sigs.k8s.io/).
14+
915
```sh
10-
# Start a Local AWX deployed to a Kind
1116
cd ./tools && go run mage.go -v reCreate && cd ..
1217
```
1318

19+
### 2) Build Provider
20+
1. Ensure [GoReleaser](https://goreleaser.com/install/) is installed
21+
2. Run build command:
1422
```sh
15-
# Build Provider
1623
goreleaser build --snapshot --rm-dist
24+
```
25+
26+
### 3) Copy Provider
27+
Copy the provider to user's `~/.terraform.d` folder.
28+
> Important: if building the provider in an operating system other than Linux x86_64, adjust the paths below replacing `linux_amd64` with the corresponding platform code. E.g.: `darwin_amd64` for macOS.
1729
18-
# Copy Provider
30+
```sh
1931
mkdir -p ~/.terraform.d/plugins/github.com/denouche/awx/0.1/linux_amd64/terraform-provider-awx
2032
find ./dist/terraform-provider-awx_linux_amd64/* -name 'terraform-provider-awx*' -print0 | xargs -0 -I {} mv {} ~/.terraform.d/plugins/github.com/denouche/awx/0.1/linux_amd64/terraform-provider-awx
33+
```
2134

22-
# start the Tests
35+
### 4) Run tests and ensure they're all passing
36+
```sh
2337
go test ./test -count=1
38+
```
2439

25-
# or as one command
40+
### Optional: All in one command
41+
For convenience, all the steps above can be achieved by a single command that combines all of them:
42+
```sh
2643
goreleaser build --snapshot --rm-dist \
2744
&& mkdir -p ~/.terraform.d/plugins/github.com/denouche/awx/0.1/linux_amd64/ \
2845
&& find ./dist/terraform-provider-awx_linux_amd64/* -name 'terraform-provider-awx*' -print0 | xargs -0 -I {} mv {} ~/.terraform.d/plugins/github.com/denouche/awx/0.1/linux_amd64/terraform-provider-awx \
2946
&& go test ./test -count=1
30-
31-
3247
```
3348

34-
## Documentation
49+
## Update documentation
3550

36-
The files from `./docs` are generated by `cd ./tools && go run mage.go -v genDocumentation && cd ..`
51+
The files in `./docs` folder are generated by executing the `genDocumentation` target defined in `tools/magefile.go` file:
52+
```sh
53+
cd ./tools && go run mage.go -v genDocumentation && cd ..
54+
```

0 commit comments

Comments
 (0)