Skip to content
This repository was archived by the owner on Jan 25, 2023. It is now read-only.

Commit f3638e8

Browse files
author
Lukas Holzer
authored
docs: update CONTRIBUTING.md with documentation about container structure tests (#809)
1 parent 5f4e2c7 commit f3638e8

File tree

1 file changed

+27
-2
lines changed

1 file changed

+27
-2
lines changed

CONTRIBUTING.md

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,31 @@ please read the [code of conduct](CODE_OF_CONDUCT.md).
1111

1212
### Tests
1313

14-
We have a set of automated tests in [./tests](./tests). These are [bats](https://github.com/bats-core/bats-core) tests that we use to make assertions not only on the correct functioning of our bash/shell scripts, but also of the software provided by our Docker image. Any fix or feature should be accompanied by a set of tests to validate that those changes work as expected. For an overview on how [bats works see here](https://bats-core.readthedocs.io/en/stable/).
14+
For testing the Docker Image we use Googles [Container Structure Tests](https://github.com/GoogleContainerTools/container-structure-test). Those tests are used to test the metadata, filesystem or installed binaries of the image.
15+
16+
#### Installing Container Structure Tests
17+
18+
To install the container tests we recommend doing so by using a package manger like brew:
19+
20+
```
21+
brew install container-structure-tests
22+
```
23+
24+
#### Running Container Structure Tests
25+
26+
To run the container structure tests you need to run the following command.
27+
28+
```bash
29+
container-structure-test test --image netlify/build:focal --config focal.yaml
30+
```
31+
32+
For further install instructions please visit the [official installation guide](https://github.com/GoogleContainerTools/container-structure-test#installation).
33+
34+
### Testing dynamic Versions
35+
36+
To test Golang or Node versions which are dynamically downloaded via a script on startup we have a set of automated tests in [./tests](./tests). These are [bats](https://github.com/bats-core/bats-core) tests that we use to make assertions not only on the correct functioning of our bash/shell scripts, but also of the software provided by our Docker image. For an overview on how [bats works see here](https://bats-core.readthedocs.io/en/stable/).
37+
38+
<mark>In General any fix or feature should be accompanied by a set of tests to validate that those changes work as expected.</mark>
1539

1640
### Developing
1741

@@ -33,11 +57,11 @@ For the CI validation to succeed, make sure that **your PRs and commits follow t
3357
The bulk of our CI work takes place in [Circle CI](https://app.circleci.com/pipelines/github/netlify/build-image).
3458

3559
If **you're part of the Netlify org** and have write access to the repo, our pipeline will take care of:
60+
3661
- Linting the Dockerfile
3762
- Build your Dockerfile, tag it, and push it to our [docker hub repo](https://hub.docker.com/r/netlify/build)
3863
- Run the automated [bats tests](#tests)
3964

40-
4165
If you **don't have write access to the repo** and are submitting a PR via a forked repo, the CI pipeline will still execute for you. The main difference is that it won't push your built image to our docker repo.
4266
If required, someone with write accesss to the repo can trigger the push for you. If you require it (mainly useful for testing purposes) reach out to someone on the team :+1:
4367

@@ -48,6 +72,7 @@ If required, someone with write accesss to the repo can trigger the push for you
4872
3. Commits which are prefaced withb `fix:` or `feat:` will trigger package release PRs created by [release-please](https://github.com/googleapis/release-please). Merge these PRs. If you need to manually trigger a release-please PR you can bump the version by creating an [empty PR](https://github.com/netlify/build-image/pull/728).
4973
4. Wait for the CI pipelines to finish. Renovate should automatically create a PR in `buildbot` with the latest `build-image` releases (this may not happen straight away, but you can speed it up by checking [the box in this PR](https://github.com/netlify/buildbot/issues/912) or manually create a PR to bump [the version](https://github.com/netlify/buildbot/blob/0ada244ab84a1759a70d6b2cfc27c9987b5c77ca/.circleci/config.yml#L141-L150)).
5074
5. Review, test and deploy the PR in `buildbot`.
75+
5176
### Running Test `buildbot` Releases
5277

5378
If you want to test a particular `build-image` change before going through the regular release process, you can do so by creating a PR following the process above :point-up: and pointing to any `build-image` you want. Any branch

0 commit comments

Comments
 (0)