1304 Commits

Author SHA1 Message Date
Justin Chadwell
0fad89c3b9
bake: avoid nesting error diagnostics
With changes to the lazy evaluation, the evaluation order is no longer
fixed - this means that we can follow long and confusing paths to get to
an error.

Because of the co-recursive nature of the lazy evaluation, we need to
take special care that the original HCL diagnostics are not discarded
and are preserved so that the original source of the error can be
detected. Preserving the full trace is not necessary, and probably not
useful to the user - all of the file that is not lazily loaded will be
eagerly loaded after all struct blocks are loaded - so the error would
be found regardless.

Signed-off-by: Justin Chadwell <me@jedevc.com>
(cherry picked from commit fbb4f4dec86541dd243e99816ef84b3a4d4741c2)
2023-02-09 22:23:02 +01:00
CrazyMax
661af29d46
build: check reachable git commits
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
(cherry picked from commit fd5884189cc0d24a92c98fd4747847361c49c9c0)
2023-02-08 14:34:23 +01:00
CrazyMax
02cf539a08
gitutil: override the locale to ensure consistent output
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
(cherry picked from commit a8eb2a7fbe3fe316ec428bf1c723815afac1b128)
2023-02-08 14:34:14 +01:00
Justin Chadwell
cc87bd104e
bake: avoid early-exit for resolution failures
With changes made to allow lazy evaluation, we were early exiting if an
undefined name was detected, either for a variable or a function.

This had two key implications:

1. The error messages changed, and became significantly less
   informative.

   For example, we went from:

   > Unknown variable; There is no variable named "FO". Did you mean "FOO"?, and 1 other diagnostic(s)

   To

   > Invalid expression; undefined variable "FO"

2. Any issues in our function detection from funcCalls which cause JSON
   functions to be erroneously detected cause invalid functions to be
   resolved, which causes new name resolution errors.

To avoid the above problems, we can defer the error from an undefined
name until HCL evaluation - which produces the more informative errors,
and does not suffer from incorrectly detecting JSON functions.

Signed-off-by: Justin Chadwell <me@jedevc.com>
(cherry picked from commit dc8a2b03987f1266ace9a7cdcba92f5e4ccdb8ed)
2023-02-08 14:33:53 +01:00
Justin Chadwell
582cc04be6
build: add docs for boolean attestation flags
Signed-off-by: Justin Chadwell <me@jedevc.com>
(cherry picked from commit 07548bc898d803272a8be4f1bd281b0415ee4c73)
2023-02-08 14:33:35 +01:00
CrazyMax
ae278ce450
builder: fix docker context not validated
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
(cherry picked from commit 0e544fe83509add4a992ee33079924301b8adfa8)
2023-02-08 14:31:43 +01:00
Justin Chadwell
b66988c824
bake: fix loop references
Signed-off-by: Justin Chadwell <me@jedevc.com>
(cherry picked from commit 48357ee0c6a2fb4e2e68e49ac06386f2fafa51c6)
2023-02-08 14:29:45 +01:00
Tõnis Tiigi
00ed17df6d
Merge pull request #1569 from tonistiigi/v0.10.2-picks
[v0.10] cherry-picks for v0.10.2
v0.10.2
2023-01-30 11:57:04 -08:00
CrazyMax
cfb71fab97
build: better message output for git provenance
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
(cherry picked from commit 6db696748b7141d44c6bbacb91e42b2cd6513431)
2023-01-30 11:46:51 -08:00
CrazyMax
f62342768b
build: silently fail if git remote not found
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
(cherry picked from commit 4789d2219c43f28f98f2ead0d44bb3be40d87e32)
2023-01-30 11:46:42 -08:00
Tonis Tiigi
7776652a4d
build: fix multi-node merge to read descriptor from result
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
(cherry picked from commit c33b310b48a6b0467f25f89aa941ec4e453460d4)
2023-01-30 11:46:12 -08:00
Akihiro Suda
5a4f80f3ce
bake: SOURCE_DATE_EPOCH: fix panic: assignment to entry in nil map
Fix issue 1562

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
(cherry picked from commit 1f56f5174027a91c7c58e1751870abd141b68908)
2023-01-30 11:45:50 -08:00
CrazyMax
b5ea79e277
build: fix preferred platform not taken account
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
(cherry picked from commit 49b3c0dba5143966f997f2ecd29bc7adc3d95d1a)
2023-01-30 11:45:15 -08:00
Tõnis Tiigi
481796f84f
Merge pull request #1556 from crazy-max/0.10.1_cherry_picks
[v0.10] cherry-picks for v0.10.1
v0.10.1
2023-01-26 11:02:55 -08:00
Tonis Tiigi
0090d49e57
vendor: update buildkit to v0.11.2
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
(cherry picked from commit f6da7ee135c3830a080b9c394cec5db22c0c61f2)
2023-01-26 10:34:57 -08:00
CrazyMax
389ac0c3d1
build: set remote origin url
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
(cherry picked from commit c1058c17aa5b7fa73031124f8278fde58a43c22f)
2023-01-26 13:36:58 +01:00
Justin Chadwell
2bb8ce2f57
build: create error group per opt
Using the syncronization primitive, we can avoid needing to create a
separate wait group.

This allows us to sidestep the issue where the wait group could be
completed, but the build invocation functions had not terminated - if
one of the functions was to terminate with an error, then it was
possible to encounter a race condition, where the result handling code
would begin executing, despite an error.

The refactor to use a separate error group which more elegantly handles
the concept of function returns and errors, ensures that we can't
encounter this issue.

Signed-off-by: Justin Chadwell <me@jedevc.com>
(cherry picked from commit 8b7aa1a168c303521cfb6613c52480cd71f1ef20)
2023-01-26 13:36:57 +01:00
Justin Chadwell
65cea456fd
build: reorder error group funcs
Signed-off-by: Justin Chadwell <me@jedevc.com>
(cherry picked from commit 1180d919f57a05fbeaac30790ffed9b620a8f8f3)
2023-01-26 13:36:57 +01:00
Justin Chadwell
f7bd5b99da
build: use copy for BuildWithResultHandler loop vars
Signed-off-by: Justin Chadwell <me@jedevc.com>
(cherry picked from commit 347417ee123fa9673faa11347d0f079c49810aa1)
2023-01-26 13:36:57 +01:00
Justin Chadwell
8c14407fa2
imagetools: silence intoto warnings
Signed-off-by: Justin Chadwell <me@jedevc.com>
(cherry picked from commit 7145e021f9d255a75c24d2561b813e387726dc04)
2023-01-26 13:36:57 +01:00
CrazyMax
5245a2b3ff
rm: do not check for context builders when removing inactive
This change has been introduced in e7b5ee7518703fb284fd9ece81abf71e4838f4d9
but we should not check context builders when removing inactive
ones.

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
(cherry picked from commit 6cd0c11ab11f016a8037e039a51eaf3a17207312)
2023-01-26 13:36:28 +01:00
Tonis Tiigi
44d99d4573
build: mark capabilities request as internal
So it doesn't show up in the History API.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
(cherry picked from commit be55b41427d5211cf12069714c95f5f2d8e184d9)
2023-01-26 13:35:46 +01:00
David Karlsson
14942a266e
docs: fix broken link in buildx_bake CLI reference
Signed-off-by: David Karlsson <david.karlsson@docker.com>
(cherry picked from commit ba8fa6c4036a477f28ebb0951812db41357a7dfd)
2023-01-26 13:33:13 +01:00
CrazyMax
123febf107
ci: fix typo in docs-release workflow
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
(cherry picked from commit 523a16aa351ac116f7d53b493e77351550c9827f)
2023-01-26 13:32:58 +01:00
Batuhan Apaydın
3f5f7c5228
fix the directory of the buildx binary
Signed-off-by: Batuhan Apaydın <batuhan.apaydin@trendyol.com>
(cherry picked from commit edb16f8aab37a968a576fe1b19669dfb9ac33d40)
2023-01-26 13:32:34 +01:00
Justin Chadwell
6d935625a6
Merge pull request #1546 from jedevc/v0.10-inspect-lazy-attestations
[v0.10] Lazily load attestation data in imagetools inspect
2023-01-24 12:41:13 +00:00
Justin Chadwell
e640dc6041
Merge pull request #1545 from jedevc/v0.10-error-on-attestations-docker
[v0.10] build: error when using docker exporter and attestations
2023-01-24 12:41:03 +00:00
Justin Chadwell
08244b12b5
Merge pull request #1544 from jedevc/v0.10-bump-ci
[v0.10] Bump Buildx and BuildKit versions in GitHub actions
2023-01-24 12:40:52 +00:00
Justin Chadwell
78d8b926db inspect: lazily load attestation data
Delay loading the attestation data immediately, and only compute it upon
request. We do this using a deferred function which allows to define the
computation in the same place as before, but perform the computation
later.

With this patch, we ensure that the attestation data is only pulled from
the remote if it is actually referenced in the format string -
otherwise, we can skip it, for improved performance.

Signed-off-by: Justin Chadwell <me@jedevc.com>
2023-01-24 12:10:57 +00:00
Justin Chadwell
19291d900e inspect: move attestation loading to struct methods
This refactor ensures that the attestations are not output in the JSON
output for "{{ json . }}", and additionally allows future refactors to
dynamically load the attestation contents, ensuring faster performance
when attestations are not used in the output.

Signed-off-by: Justin Chadwell <me@jedevc.com>
2023-01-24 12:10:57 +00:00
Justin Chadwell
ed9b4a7169 build: error when using docker exporter and attestations
Signed-off-by: Justin Chadwell <me@jedevc.com>
(cherry picked from commit 43a748fd15c71eb65423ec50a3e9d331803ed8a1)
Signed-off-by: Justin Chadwell <me@jedevc.com>
2023-01-24 12:07:43 +00:00
Justin Chadwell
033d5629c0 build: avoid compatability error when attestations disabled
We should avoid erroring with attestations support compatability errors
when a user has specified --provenance=false.

A user may wish to enable --provenance=false that works across buildkit
versions, but currently it will fail on old versions - this patch fixes
this, to silently ignore the provenance flag for this check if it's set
to disabled.

Signed-off-by: Justin Chadwell <me@jedevc.com>
(cherry picked from commit 15a80b56b5d015baf40ff2393f424ff0bcc51d2b)
Signed-off-by: Justin Chadwell <me@jedevc.com>
2023-01-24 12:07:34 +00:00
Justin Chadwell
7cd5add568 ci: update buildkit release version in build pipeline
Signed-off-by: Justin Chadwell <me@jedevc.com>
(cherry picked from commit c1ab55a3f2a971496b761f52f11f76d7f6a476a5)
Signed-off-by: Justin Chadwell <me@jedevc.com>
2023-01-24 11:50:58 +00:00
Justin Chadwell
2a000096fa ci: update buildx release version in build pipeline
Signed-off-by: Justin Chadwell <me@jedevc.com>
(cherry picked from commit bc1d590ca70b287433162ae65be790797b7b0e46)
Signed-off-by: Justin Chadwell <me@jedevc.com>
2023-01-24 11:50:53 +00:00
Tõnis Tiigi
b7781447d7
Merge pull request #1530 from thaJeztah/0.10_backport_update_buildkit
[0.10 backport] vendor: github.com/moby/buildkit v0.11.1
2023-01-24 00:50:03 -08:00
Sebastiaan van Stijn
f6ba0a23f8
vendor: github.com/moby/buildkit v0.11.1
full diff: https://github.com/moby/buildkit/compare/v0.11.0...v0.11.1

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 01e1c28dd9cec63c96139416e7a866cd659a90b5)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-01-18 20:58:27 +01:00
CrazyMax
bf4b95fc3a
Merge pull request #1524 from jedevc/v0.10-docs-reference-attest
[0.10] docs: add reference for new attest family of flags
2023-01-17 16:24:18 +01:00
Justin Chadwell
467586dc8d docs: add reference for new attest family of flags
Signed-off-by: Justin Chadwell <me@jedevc.com>
2023-01-17 13:48:19 +00:00
Tõnis Tiigi
8764628976
Merge pull request #1501 from tonistiigi/v0.10-picks
[v0.10] cherry-picks
v0.10.0
2023-01-09 16:10:12 -08:00
Justin Chadwell
583fe71740
docs: update with new inspect output
Signed-off-by: Justin Chadwell <me@jedevc.com>
(cherry picked from commit 9818055b0e190e5ff977afdd7dda2744018bf8fc)
2023-01-09 15:53:42 -08:00
Justin Chadwell
9fb3ff1a27
inspect: change additional spdxs to not have duplicates
Signed-off-by: Justin Chadwell <me@jedevc.com>
(cherry picked from commit 484823c97d8155f4ff7d454ff394dd9595c642a3)
2023-01-09 15:53:37 -08:00
Justin Chadwell
9d4f38c5fa
inspect: provide access to multiple spdx documents
Signed-off-by: Justin Chadwell <me@jedevc.com>
(cherry picked from commit 3ce17b01dc614f4224d7f13a993b6ba235dfdab9)
2023-01-09 15:53:34 -08:00
Justin Chadwell
793082f543
inspect: parse sbom and provenance into json structs
Signed-off-by: Justin Chadwell <me@jedevc.com>
(cherry picked from commit e68c566c1c37dfbe77cd479a8bf2743ff4dee969)
2023-01-09 15:53:29 -08:00
Justin Chadwell
fe6f697205
inspect: break after first matching attestation
Signed-off-by: Justin Chadwell <me@jedevc.com>
(cherry picked from commit 19d16aa941baa6b6bdd397029471edb7fea6e190)
2023-01-09 15:53:13 -08:00
Tonis Tiigi
fd3fb752d3
github: update CI to buildkit v0.11
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
(cherry picked from commit 571871b084d8c6ef1369cb740af01470e48b5dfd)
2023-01-09 15:52:51 -08:00
CrazyMax
7fcea64eb4
Merge pull request #1496 from thaJeztah/0.10_backport_docs_updates
[0.10 backport] update anchor-links and cli-docs-tool v0.5.1
2023-01-09 15:52:56 +01:00
Sebastiaan van Stijn
05e0ce4953
go.mod: update cli-docs-tool v0.5.1 and re-generate docs
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit c97500b11768a3ed8ff20388941b256be389dc84)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-01-09 13:05:27 +01:00
Sebastiaan van Stijn
f8d9d1e776
docs: update anchor links
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit b8285c17e606e10b77357cdb3e868f0798a834df)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-01-09 13:05:27 +01:00
CrazyMax
8a7a221a7f
imagetools inspect: handle provenance and sbom
use stub structs for SLSA/SBOM while waiting for
go-imageinspect library to be public.

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
v0.10.0-rc3
2023-01-06 16:33:47 -08:00
CrazyMax
e4db8d2a21
imagetools inspect: missing annotations key
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2023-01-06 16:33:47 -08:00