Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
29dcf38205 | ||
|
|
964d973e3c |
No files matched your search
@@ -144,10 +144,6 @@ alpine. We provide:
|
|||||||
|
|
||||||
`make hooks` installs the pre-commit hook that runs `script/precommit`.
|
`make hooks` installs the pre-commit hook that runs `script/precommit`.
|
||||||
|
|
||||||
The builds use Docker's normal cache: a step runs again only when its inputs
|
|
||||||
change. This repo's own `Dockerfile` installs git, make, node and yarn right
|
|
||||||
after `FROM` in every stage, so a change to `script/` keeps that layer.
|
|
||||||
|
|
||||||
## Rationale
|
## Rationale
|
||||||
|
|
||||||
LLM prompts, especially development policies, benefit from version control and a
|
LLM prompts, especially development policies, benefit from version control and a
|
||||||
|
|||||||
@@ -49,9 +49,6 @@ with your task.
|
|||||||
`--target` names it, so a lost `COPY --from=` edge leaves `docker build .`
|
`--target` names it, so a lost `COPY --from=` edge leaves `docker build .`
|
||||||
passing while the gate never runs. Confirm by planting a violation, not by
|
passing while the gate never runs. Confirm by planting a violation, not by
|
||||||
reading the file.
|
reading the file.
|
||||||
- [ ] Check builds use Docker's normal cache: no `docker build` in `script/`
|
|
||||||
passes a build argument whose only job is to make steps run again, and no
|
|
||||||
`Dockerfile` stage declares one.
|
|
||||||
- [ ] Go: each Go stage downloads the modules (`COPY go.mod go.sum ./`,
|
- [ ] Go: each Go stage downloads the modules (`COPY go.mod go.sum ./`,
|
||||||
`RUN go mod download`) before `COPY . .`; the steps that compile
|
`RUN go mod download`) before `COPY . .`; the steps that compile
|
||||||
(`golangci-lint run`, `go test`, `go build`) mount Go's build cache
|
(`golangci-lint run`, `go test`, `go build`) mount Go's build cache
|
||||||
|
|||||||
+12
-24
@@ -243,10 +243,9 @@ style conventions are in separate documents:
|
|||||||
|
|
||||||
The development environment stage installs development prerequisites by
|
The development environment stage installs development prerequisites by
|
||||||
running `script/bootstrap`. Only system packages may be installed inline
|
running `script/bootstrap`. Only system packages may be installed inline
|
||||||
above it, so that a change to `script/` does not install them again; the
|
above it, so that check builds keep them; the `prompts` repo's own
|
||||||
`prompts` repo's own `Dockerfile` does this. A stage that runs
|
`Dockerfile` does this. A stage that runs `script/bootstrap` COPYs `script/`
|
||||||
`script/bootstrap` COPYs `script/` and the dependency manifests it needs
|
and the dependency manifests it needs before running it. These are examples:
|
||||||
before running it. These are examples:
|
|
||||||
- `package.json`, `yarn.lock`, `.yarnrc.yml` and `.yarn/releases/`
|
- `package.json`, `yarn.lock`, `.yarnrc.yml` and `.yarn/releases/`
|
||||||
- `go.mod` and `go.sum`
|
- `go.mod` and `go.sum`
|
||||||
|
|
||||||
@@ -298,16 +297,6 @@ style conventions are in separate documents:
|
|||||||
- the settings
|
- the settings
|
||||||
- the golangci-lint version
|
- the golangci-lint version
|
||||||
|
|
||||||
- **Check builds use Docker's normal cache.** On an unchanged tree Docker reuses
|
|
||||||
each step's stored result, and it stores a result only for a step that
|
|
||||||
succeeded. A step runs again when one of these changes:
|
|
||||||
- the base image
|
|
||||||
- its own line or a line above it
|
|
||||||
- the files copied before it
|
|
||||||
|
|
||||||
Never prune the build cache (`docker builder prune` and the like): it is
|
|
||||||
shared with every other build on the host.
|
|
||||||
|
|
||||||
- **The gate phases are separate stages, and the build stage depends on both.**
|
- **The gate phases are separate stages, and the build stage depends on both.**
|
||||||
The lint phase is based on the `golangci/golangci-lint` image (pinned by
|
The lint phase is based on the `golangci/golangci-lint` image (pinned by
|
||||||
hash), so lint failures surface in seconds rather than after a full compile.
|
hash), so lint failures surface in seconds rather than after a full compile.
|
||||||
@@ -491,7 +480,7 @@ style conventions are in separate documents:
|
|||||||
already do.
|
already do.
|
||||||
|
|
||||||
- **A Python `test` phase that installs its packages from `Pipfile.lock` does it
|
- **A Python `test` phase that installs its packages from `Pipfile.lock` does it
|
||||||
before `COPY . .`, so a change to the code keeps them.** The steps are:
|
before `COPY . .`, so check builds keep them.** The steps are:
|
||||||
- `COPY script/ script/`
|
- `COPY script/ script/`
|
||||||
- `COPY Pipfile Pipfile.lock ./`
|
- `COPY Pipfile Pipfile.lock ./`
|
||||||
- `RUN script/bootstrap`
|
- `RUN script/bootstrap`
|
||||||
@@ -611,8 +600,7 @@ style conventions are in separate documents:
|
|||||||
A new push then cancels the older run on the same branch, queued or running,
|
A new push then cancels the older run on the same branch, queued or running,
|
||||||
and no other: runs for replaced commits do not hold up the shared runner.
|
and no other: runs for replaced commits do not hold up the shared runner.
|
||||||
`script/cibuild` bootstraps, runs the gate phases, and then builds the image,
|
`script/cibuild` bootstraps, runs the gate phases, and then builds the image,
|
||||||
so a successful run means every check passed. The image build reuses the gate
|
so a successful run means every check passed. The `check` job sets
|
||||||
phases that the check has just built. The `check` job sets
|
|
||||||
`timeout-minutes: 20`, so a hung build frees the shared runner after 20
|
`timeout-minutes: 20`, so a hung build frees the shared runner after 20
|
||||||
minutes. That allows for the three Docker builds described above, each held to
|
minutes. That allows for the three Docker builds described above, each held to
|
||||||
the 5-minute Docker build limit below, plus the bootstrap. Those builds are
|
the 5-minute Docker build limit below, plus the bootstrap. Those builds are
|
||||||
@@ -726,13 +714,13 @@ style conventions are in separate documents:
|
|||||||
tests. It leaves the build cache alone, so it costs the runtime of the suite
|
tests. It leaves the build cache alone, so it costs the runtime of the suite
|
||||||
and no recompilation.
|
and no recompilation.
|
||||||
|
|
||||||
That cache is Go's own, separate from Docker's layer cache. Go stores a
|
That cache is Go's own. Go stores a passing result in its cache directory
|
||||||
passing result in its cache directory (`GOCACHE`). When the same tests run
|
(`GOCACHE`). When the same tests run again on unchanged code, it prints that
|
||||||
again on unchanged code, it prints that result, marked `(cached)`, without
|
result, marked `(cached)`, without running them. The directory lasts from
|
||||||
running them. The directory lasts from one run to the next on a developer's
|
one run to the next on a developer's machine, where this target runs. The
|
||||||
machine, where this target runs. The directory also lasts in the `test`
|
directory also lasts in the `test` phase of the `Dockerfile`, which mounts
|
||||||
phase of the `Dockerfile`, which mounts it to keep compiled packages between
|
it to keep compiled packages between check builds, so the phase's `go test`
|
||||||
check builds, so the phase's `go test` runs carry `-count=1` too.
|
runs carry `-count=1` too.
|
||||||
|
|
||||||
Python example:
|
Python example:
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user