Commit Graph

33 Commits

Author SHA1 Message Date
Tonis Tiigi
e05a89e0b8 improve stacks of cancels from defers
In this case the current stack trace points to the line
where the context was created. Instead the stack should be
captured when the defer is running so the return path to
the defer call is also part of the stack.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2024-11-19 18:40:00 -08:00
Tonis Tiigi
d7b3e02a55 lint: finish up testifylint
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2024-07-12 16:03:18 -07:00
Tonis Tiigi
c241bcaad0 remove deprecated seed calls
Not needed since go1.20

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2024-06-12 15:21:42 -07:00
Erik Sipsma
ffdbd863b3 solver: recursively add merge source jobs to target and ancestors
Signed-off-by: Erik Sipsma <erik@sipsma.dev>
2024-04-26 18:55:25 -07:00
Erik Sipsma
1b3daaa396 solver: prevent edge merge to inactive states
Before this, it was possible for an edge merge to happen to a target
edge/state that is no longer in the actives map, e.g.
1. Job A solves some edges
2. Job B solves some edges that get merged with job A's edges
3. Job A is discarded
4. Job C solves some edges that get merged with job B's edges, which
   recursively end up merging to job A's, which no longer exist in the
   actives map.

While this doesn't always result in an error, given the right state and
order of operations this can result in `getState` or `getEdge` being
called on the "stale" edges that are inactive and an error. E.g. if a
stale dep transitions from desired state `cache-fast` to `cache-slow`,
the slow cache logic will call `getState` on it and return a `compute
cache` error.

I also *suspect* this is the same root cause behind `inconsistent graph
state` errors still seen occasionally, but have not repro'd that error
locally so can't be 100% sure yet.

The fix here updates `state.setEdge` to register all the jobs in the
source edge's state with the target edge's state. This works out
because:
1. edges that are the target of a merge will not have their state
   removed from the actives map if only the original job creating them
   is discarded
1. those edges are still removed eventually, but only when all jobs
   referencing them (now including jobs referencing them via edge
   merges) are discarded

Signed-off-by: Erik Sipsma <erik@sipsma.dev>
2024-04-26 12:07:49 -07:00
racequite
f24c5756d6 chore: fix function names in comment
Signed-off-by: racequite <quiterace@gmail.com>
2024-04-19 12:23:28 +08:00
Justin Chadwell
b7a0282bae test: add a test for cyclic merges
Signed-off-by: Justin Chadwell <me@jedevc.com>
2024-01-17 15:15:12 +00:00
Justin Chadwell
0740994604 chore: fix minor typos in scheduler_test.go
Signed-off-by: Justin Chadwell <me@jedevc.com>
2024-01-17 14:12:50 +00:00
Tonis Tiigi
8a2a3e83ec replace context.WithCancel with WithCancelCause
Keep stack traces for cancellation errors where possible.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2023-12-06 22:15:06 -08:00
CrazyMax
262d58aba8 solver: wrap gRPC codes.NotFound on unknown build ID
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2023-08-17 11:39:25 +02:00
CrazyMax
086f43da9b lint: fix issues with go 1.20
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2023-02-21 12:09:54 +01:00
Tonis Tiigi
9acc6d30eb refactor buildinfo into provenance capture
Change how provenance information is captured from builds.

While previously frontend passed the buildinfo
sources with metadata, now all information is captured
through buildkit. A frontend does not need to implement
buildinfo and can't set incorrect/incomplete buildinfo
for a build result.

All LLB operations can now collect as much provenance
info as they like that will be used when making the
attestation. Previously this was limited to a single Pin
value. For example now we also detect secrets and SSH IDs
that the build uses, or if it accesses network, if local
sources are used etc.. The new design makes sure this
can be easily extended in the future.

Provenance capture can now detect builds that do
multiple separate subsolves in sequence. For example,
first subsolve gathers the sources for the build and
second one builds from immutable sources without a
network connection. If first solve does not participate
in final build result it does not end up in provenance.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2022-11-15 19:37:03 -08:00
Tonis Tiigi
a20e48f36d provenance: add layers support
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2022-11-15 19:37:03 -08:00
Justin Chadwell
3f706e5adc lint: add nolint:gosec comments where required
Signed-off-by: Justin Chadwell <me@jedevc.com>
2022-10-26 12:46:40 +01:00
Tonis Tiigi
dc21885891 hack: enable more linters
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2022-01-19 12:20:30 -08:00
Kohei Tokunaga
f9e0346b34 Propagate compression options to the inline cache export
Co-authored-by: Tonis Tiigi <tonistiigi@gmail.com>
Signed-off-by: Kohei Tokunaga <ktokunaga.mail@gmail.com>
2021-10-22 15:43:32 +09:00
CrazyMax
5fcc94454f Generate and embed build sources
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2021-09-18 01:39:35 +02:00
Koichi Shiraishi
671ae38fb7 all: unify the specs-go package import alias to ocispecs
ocispecs means "O"pen "C"ontainer "I"nitiative image-spec/"specs"-go/v1
                      opencontainers          /image-spec/specs-go/v1

Signed-off-by: Koichi Shiraishi <zchee.io@gmail.com>
2021-08-11 08:29:09 +09:00
Vlad A. Ionescu
b3cf7c43cf Switch to Acquire API.
Signed-off-by: Vlad A. Ionescu <vladaionescu@users.noreply.github.com>
2021-05-12 13:41:33 +03:00
Vlad A. Ionescu
489e17aea9 Add a configuration item to limit parallelism.
Signed-off-by: Vlad A. Ionescu <vladaionescu@users.noreply.github.com>
2021-05-10 15:47:59 +03:00
Tonis Tiigi
b4b0ece384 make sure result refs returned in errors are clone
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2021-02-03 10:49:38 -08:00
Tonis Tiigi
e86356ddf8 solver: add input preprocess capability
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2020-11-03 14:49:44 -08:00
Tonis Tiigi
e3b05289d8 add session injection to remote loading
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2020-11-02 22:20:44 -08:00
Tonis Tiigi
57a88b0afb lint: add misspell and unused
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2020-07-18 08:13:57 -07:00
Tonis Tiigi
2e9987ad16 session: track sessions with a group construct
Avoid hidden session passing and allow one session to drop when
multiple builds share a vertex.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2020-07-05 00:15:25 -07:00
Tonis Tiigi
dd765674fb solver: gracefully handle cache loading errors
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2020-05-18 18:21:34 -07:00
Tonis Tiigi
37b8832d00 upgrade errors checks to Is()
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2020-04-18 22:53:38 -07:00
Tonis Tiigi
3a1f59f85f solver: add TestSlowCacheAvoidLoadOnCache test
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2018-09-27 15:03:56 -07:00
Tonis Tiigi
23904e6ffa solver: add test for input request deadlock
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2018-08-27 16:12:50 -07:00
Akihiro Suda
89eee2126e Merge pull request #535 from tonistiigi/merge-fix
solver: fix edge merge skipping issue
2018-07-24 11:25:09 +09:00
Tonis Tiigi
97ea41ee6a solver: improve multi-key root caching
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2018-07-23 14:27:35 -07:00
Tonis Tiigi
c575077cd6 solver: fix edge merge skipping issue
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2018-07-23 10:52:31 -07:00
Tonis Tiigi
71f5e6dd21 solver: rename solver-next to solver
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2018-05-14 09:53:34 -07:00