Skip to content

Commit a45297b

Browse files
authored
Merge pull request moby#3951 from jedevc/update-contributing
2 parents 6d325e5 + 9887fa7 commit a45297b

File tree

1 file changed

+99
-32
lines changed

1 file changed

+99
-32
lines changed

.github/CONTRIBUTING.md

Lines changed: 99 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ We also like to send gifts—if you're into schwag, make sure to let
1818
us know. We currently do not offer a paid security bounty program, but are not
1919
ruling it out in the future.
2020

21-
2221
## Reporting other issues
2322

2423
A great way to contribute to the project is to send a detailed report when you
@@ -52,7 +51,6 @@ Dependencies:
5251
- [runc](https://github.com/opencontainers/runc)
5352
- [containerd](https://github.com/containerd/containerd) (if you want to use containerd worker)
5453

55-
5654
The following command installs `buildkitd` and `buildctl` to `/usr/local/bin`:
5755

5856
```bash
@@ -64,6 +62,72 @@ To build containerized `moby/buildkit:local` and `moby/buildkit:local-rootless`
6462
make images
6563
```
6664

65+
### Run BuildKit
66+
67+
You can launch the backend BuildKit daemon either in a container, or directly:
68+
69+
```bash
70+
# run the daemon in a container
71+
$ docker run --rm -d --name buildkitd --privileged moby/buildkit:local
72+
$ export BUILDKIT_HOST=docker-container://buildkitd
73+
$ buildctl debug info
74+
BuildKit: github.com/moby/buildkit v0.11.0-rc3-623-g2ff0d2a2f.m 2ff0d2a2f53663aae917980fa27eada7950ff69c.m
75+
```
76+
77+
```bash
78+
# run the daemon directly (only on linux)
79+
$ sudo buildkitd
80+
$ export BUILDKIT_HOST=unix:///run/buildkit/buildkitd.sock
81+
$ sudo buildctl debug info
82+
BuildKit: github.com/moby/buildkit v0.11.0-rc3-506-g539bab193.m 539bab193c28d3ce731e6013f471ba24848f5c41.m
83+
```
84+
85+
You can also connect buildx to the BuildKit daemon using the [`remote` driver](https://docs.docker.com/build/drivers/remote/):
86+
87+
```bash
88+
$ docker buildx create --driver=remote --name=dev $BUILDKIT_HOST
89+
$ docker buildx --builder=dev inspect
90+
Name: dev
91+
Driver: remote
92+
Last Activity: 2023-06-06 14:15:52 +0000 UTC
93+
94+
Nodes:
95+
Name: dev0
96+
Endpoint: tcp://localhost:1234
97+
Status: running
98+
Buildkit: v0.11.0-rc3-506-g539bab193.m
99+
Platforms: linux/amd64, linux/amd64/v2, linux/amd64/v3, linux/386
100+
```
101+
102+
### Run BuildKit using Buildx
103+
104+
You can also have buildx run and manage the custom BuildKit daemon itself using
105+
the [`docker-container` driver](https://docs.docker.com/build/drivers/remote/).
106+
107+
This is usually the easiest way to get started with a custom BuildKit daemon
108+
for development or debugging.
109+
110+
```bash
111+
$ docker buildx rm dev || true # remove previous dev builder if exists
112+
$ docker buildx create --driver=docker-container --name=dev --driver-opt image=moby/buildkit:local --bootstrap
113+
[+] Building 0.3s (1/1) FINISHED
114+
=> [internal] booting buildkit
115+
=> => starting container buildx_buildkit_dev0
116+
dev
117+
$ docker buildx --builder=dev inspect
118+
Name: dev
119+
Driver: docker-container
120+
Last Activity: 2023-06-06 14:15:52 +0000 UTC
121+
122+
Nodes:
123+
Name: dev0
124+
Endpoint: desktop-linux
125+
Driver Options: image="moby/buildkit:local"
126+
Status: running
127+
Buildkit: v0.11.0-rc3-623-g2ff0d2a2f.m
128+
Platforms: linux/amd64, linux/amd64/v2, linux/amd64/v3, linux/arm64, linux/riscv64, linux/ppc64le, linux/s390x, linux/386, linux/mips64le, linux/mips64, linux/arm/v7, linux/arm/v6
129+
```
130+
67131
### Run the unit- and integration-tests
68132

69133
Running tests:
@@ -101,20 +165,25 @@ If you are working behind a proxy, you can set some of or all
101165
`HTTP_PROXY=http://ip:port`, `HTTPS_PROXY=http://ip:port`, `NO_PROXY=http://ip:port` for the test framework
102166
to specify the proxy build args.
103167

104-
Updating vendored dependencies:
168+
### Run the helper commands
169+
170+
To validate PRs before submitting them you should run:
105171

106172
```bash
107-
# update vendor.conf
108-
make vendor
173+
$ make validate-all
109174
```
110175

111-
Validating your updates before submission:
176+
To generate new vendored files with go modules run:
112177

113178
```bash
114-
make validate-all
179+
$ make vendor
115180
```
116181

182+
To generate new versions of automatically generated files run:
117183

184+
```bash
185+
$ make generated-files
186+
```
118187

119188
### Pull requests are always welcome
120189

@@ -330,13 +399,11 @@ down to one.
330399
from the Git history.
331400
- See the [Coding Style](#coding-style) for further guidelines.
332401

333-
334402
### Merge approval
335403

336404
Project maintainers use LGTM (Looks Good To Me) in comments on the code review to
337405
indicate acceptance, or use the Github review approval feature.
338406

339-
340407
## Coding Style
341408

342409
Unless explicitly stated, we follow all coding guidelines from the Go
@@ -353,29 +420,29 @@ mind when nudging others to comply.
353420

354421
The rules:
355422

356-
1. All code should be formatted with `gofmt -s`.
357-
2. All code should pass the default levels of
358-
[`golint`](https://github.com/golang/lint).
359-
3. All code should follow the guidelines covered in [Effective
360-
Go](http://golang.org/doc/effective_go.html) and [Go Code Review
361-
Comments](https://github.com/golang/go/wiki/CodeReviewComments).
362-
4. Comment the code. Tell us the why, the history and the context.
363-
5. Document _all_ declarations and methods, even private ones. Declare
364-
expectations, caveats and anything else that may be important. If a type
365-
gets exported, having the comments already there will ensure it's ready.
366-
6. Variable name length should be proportional to its context and no longer.
367-
`noCommaALongVariableNameLikeThisIsNotMoreClearWhenASimpleCommentWouldDo`.
368-
In practice, short methods will have short variable names and globals will
369-
have longer names.
370-
7. No underscores in package names. If you need a compound name, step back,
371-
and re-examine why you need a compound name. If you still think you need a
372-
compound name, lose the underscore.
373-
8. No utils or helpers packages. If a function is not general enough to
374-
warrant its own package, it has not been written generally enough to be a
375-
part of a util package. Just leave it unexported and well-documented.
376-
9. All tests should run with `go test` and outside tooling should not be
377-
required. No, we don't need another unit testing framework. Assertion
378-
packages are acceptable if they provide _real_ incremental value.
423+
1. All code should be formatted with `gofmt -s`.
424+
2. All code should pass the default levels of
425+
[`golint`](https://github.com/golang/lint).
426+
3. All code should follow the guidelines covered in [Effective
427+
Go](http://golang.org/doc/effective_go.html) and [Go Code Review
428+
Comments](https://github.com/golang/go/wiki/CodeReviewComments).
429+
4. Comment the code. Tell us the why, the history and the context.
430+
5. Document _all_ declarations and methods, even private ones. Declare
431+
expectations, caveats and anything else that may be important. If a type
432+
gets exported, having the comments already there will ensure it's ready.
433+
6. Variable name length should be proportional to its context and no longer.
434+
`noCommaALongVariableNameLikeThisIsNotMoreClearWhenASimpleCommentWouldDo`.
435+
In practice, short methods will have short variable names and globals will
436+
have longer names.
437+
7. No underscores in package names. If you need a compound name, step back,
438+
and re-examine why you need a compound name. If you still think you need a
439+
compound name, lose the underscore.
440+
8. No utils or helpers packages. If a function is not general enough to
441+
warrant its own package, it has not been written generally enough to be a
442+
part of a util package. Just leave it unexported and well-documented.
443+
9. All tests should run with `go test` and outside tooling should not be
444+
required. No, we don't need another unit testing framework. Assertion
445+
packages are acceptable if they provide _real_ incremental value.
379446
10. Even though we call these "rules" above, they are actually just
380447
guidelines. Since you've read all the rules, you now know that.
381448

0 commit comments

Comments
 (0)