Skip to content

Commit 26281fd

Browse files
committed
Merge branch 'master' into feat/add-cpu-memory-limits
Signed-off-by: Jiří Moravčík <jiri.moravcik@gmail.com>
2 parents bd96f3b + 5e3efd4 commit 26281fd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+4262
-3539
lines changed

.github/workflows/.test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ jobs:
183183
-
184184
name: Generate annotations
185185
if: always()
186-
uses: crazy-max/.github/.github/actions/gotest-annotations@fa6141aedf23596fb8bdcceab9cce8dadaa31bd9
186+
uses: crazy-max/.github/.github/actions/gotest-annotations@71eec88cb5c2185e8209fab03eeb1f4c76129642
187187
with:
188188
directory: ./bin/testreports
189189
-

.github/workflows/buildkit.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ jobs:
318318
-
319319
name: Scout
320320
id: scout
321-
uses: crazy-max/.github/.github/actions/docker-scout@ccae1c98f1237b5c19e4ef77ace44fa68b3bc7e4
321+
uses: crazy-max/.github/.github/actions/docker-scout@71eec88cb5c2185e8209fab03eeb1f4c76129642
322322
with:
323323
version: ${{ env.SCOUT_VERSION }}
324324
format: sarif

.github/workflows/frontend.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ jobs:
216216
-
217217
name: Scout
218218
id: scout
219-
uses: crazy-max/.github/.github/actions/docker-scout@ccae1c98f1237b5c19e4ef77ace44fa68b3bc7e4
219+
uses: crazy-max/.github/.github/actions/docker-scout@71eec88cb5c2185e8209fab03eeb1f4c76129642
220220
with:
221221
version: ${{ env.SCOUT_VERSION }}
222222
format: sarif

.github/workflows/pr-assign-author.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ on:
1111

1212
jobs:
1313
run:
14-
uses: crazy-max/.github/.github/workflows/pr-assign-author.yml@1b673f36fad86812f538c1df9794904038a23cbf
14+
uses: crazy-max/.github/.github/workflows/pr-assign-author.yml@71eec88cb5c2185e8209fab03eeb1f4c76129642
1515
permissions:
1616
contents: read
1717
pull-requests: write

.github/workflows/test-os.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ jobs:
181181
-
182182
name: Generate annotations
183183
if: always()
184-
uses: crazy-max/.github/.github/actions/gotest-annotations@fa6141aedf23596fb8bdcceab9cce8dadaa31bd9
184+
uses: crazy-max/.github/.github/actions/gotest-annotations@71eec88cb5c2185e8209fab03eeb1f4c76129642
185185
with:
186186
directory: ./bin/testreports
187187
-

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,8 @@ FROM scratch AS cni-plugins-export-squashed
181181
COPY --from=cni-plugins-export / /
182182

183183
FROM --platform=$BUILDPLATFORM alpine:${ALPINE_VERSION} AS binfmt-filter
184-
# built from https://github.com/tonistiigi/binfmt/releases/tag/buildkit%2Fv10.1.3-61
185-
COPY --link --from=tonistiigi/binfmt:buildkit-v10.1.3-61@sha256:56fdcdd479f1aa32667b84d248579c7e1d4c28c45a10ed89ad31103bf5635bc7 / /out/
184+
# built from https://github.com/tonistiigi/binfmt/releases/tag/buildkit%2Fv10.2.1-64
185+
COPY --link --from=tonistiigi/binfmt:buildkit-v10.2.1-64@sha256:4cf4c0ad4919b18996362536883de02420c1010654d3c2a2b63e9b72600fa3a9 / /out/
186186
WORKDIR /out/
187187
RUN rm -f buildkit-qemu-loongarch64 buildkit-qemu-mips64 buildkit-qemu-mips64el
188188

cache/contenthash/checksum.go

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import (
1919
"github.com/moby/buildkit/session"
2020
"github.com/moby/buildkit/snapshot"
2121
"github.com/moby/buildkit/util/cachedigest"
22+
"github.com/moby/buildkit/util/pools"
2223
"github.com/moby/locker"
2324
"github.com/moby/patternmatcher"
2425
digest "github.com/opencontainers/go-digest"
@@ -1261,15 +1262,13 @@ func ensureOriginMetadata(md cache.RefMetadata) cache.RefMetadata {
12611262
return em
12621263
}
12631264

1264-
var pool32K = sync.Pool{
1265-
New: func() any {
1266-
buf := make([]byte, 32*1024) // 32K
1267-
return &buf
1268-
},
1269-
}
1265+
var pool32K = pools.New(func() *[]byte {
1266+
buf := make([]byte, 32*1024) // 32K
1267+
return &buf
1268+
})
12701269

12711270
func poolsCopy(dst io.Writer, src io.Reader) (written int64, err error) {
1272-
buf := pool32K.Get().(*[]byte)
1271+
buf := pool32K.Get()
12731272
written, err = io.CopyBuffer(dst, src, *buf)
12741273
pool32K.Put(buf)
12751274
return

cache/manager_test.go

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2660,14 +2660,6 @@ func (b *buf) close() {
26602660
<-b.closed
26612661
}
26622662

2663-
type bufferCloser struct {
2664-
*bytes.Buffer
2665-
}
2666-
2667-
func (b bufferCloser) Close() error {
2668-
return nil
2669-
}
2670-
26712663
func mapToBlob(m map[string]string, compress bool) ([]byte, ocispecs.Descriptor, error) {
26722664
if !compress {
26732665
return mapToBlobWithCompression(m, nil)
@@ -2681,7 +2673,7 @@ func mapToBlobWithCompression(m map[string]string, compress func(io.Writer) (io.
26812673
buf := bytes.NewBuffer(nil)
26822674
sha := digest.SHA256.Digester()
26832675

2684-
var dest io.WriteCloser = bufferCloser{buf}
2676+
var dest io.WriteCloser = &iohelper.NopWriteCloser{Writer: buf}
26852677
mediaType := ocispecs.MediaTypeImageLayer
26862678
if compress != nil {
26872679
var err error
@@ -2724,7 +2716,7 @@ func fileToBlob(file *os.File, compress bool) ([]byte, ocispecs.Descriptor, erro
27242716
buf := bytes.NewBuffer(nil)
27252717
sha := digest.SHA256.Digester()
27262718

2727-
var dest io.WriteCloser = bufferCloser{buf}
2719+
var dest io.WriteCloser = &iohelper.NopWriteCloser{Writer: buf}
27282720
if compress {
27292721
dest = gzip.NewWriter(buf)
27302722
}

client/build_test.go

Lines changed: 23 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import (
2424
"github.com/moby/buildkit/solver/pb"
2525
"github.com/moby/buildkit/util/entitlements"
2626
"github.com/moby/buildkit/util/grpcerrors"
27+
"github.com/moby/buildkit/util/iohelper"
2728
utilsystem "github.com/moby/buildkit/util/system"
2829
"github.com/moby/buildkit/util/testutil/echoserver"
2930
"github.com/moby/buildkit/util/testutil/integration"
@@ -488,7 +489,7 @@ func testClientGatewayContainerExecPipe(t *testing.T, sb integration.Sandbox) {
488489

489490
pid4, err := ctr.Start(ctx, client.StartRequest{
490491
Args: []string{"cat", "/tmp/test"},
491-
Stdout: &nopCloser{output},
492+
Stdout: &iohelper.NopWriteCloser{Writer: output},
492493
})
493494
if err != nil {
494495
return nil, err
@@ -836,7 +837,7 @@ func testClientGatewayContainerMounts(t *testing.T, sb integration.Sandbox) {
836837
secretOutput := bytes.NewBuffer(nil)
837838
pid, err = ctr.Start(ctx, client.StartRequest{
838839
Args: []string{"cat", "/run/secrets/mysecret"},
839-
Stdout: &nopCloser{secretOutput},
840+
Stdout: &iohelper.NopWriteCloser{Writer: secretOutput},
840841
})
841842
require.NoError(t, err)
842843
err = pid.Wait()
@@ -987,8 +988,8 @@ func testClientGatewayContainerPID1Tty(t *testing.T, sb integration.Sandbox) {
987988
Args: []string{"sh"},
988989
Tty: true,
989990
Stdin: inputR,
990-
Stdout: &nopCloser{output},
991-
Stderr: &nopCloser{output},
991+
Stdout: &iohelper.NopWriteCloser{Writer: output},
992+
Stderr: &iohelper.NopWriteCloser{Writer: output},
992993
Env: []string{fmt.Sprintf("PS1=%s", prompt.String())},
993994
})
994995
require.NoError(t, err)
@@ -1069,8 +1070,8 @@ func testClientGatewayContainerCancelPID1Tty(t *testing.T, sb integration.Sandbo
10691070
Args: []string{"sh"},
10701071
Tty: true,
10711072
Stdin: inputR,
1072-
Stdout: &nopCloser{output},
1073-
Stderr: &nopCloser{output},
1073+
Stdout: &iohelper.NopWriteCloser{Writer: output},
1074+
Stderr: &iohelper.NopWriteCloser{Writer: output},
10741075
Env: []string{fmt.Sprintf("PS1=%s", prompt.String())},
10751076
})
10761077
require.NoError(t, err)
@@ -1201,8 +1202,8 @@ func testClientGatewayContainerExecTty(t *testing.T, sb integration.Sandbox) {
12011202
Args: []string{"sh"},
12021203
Tty: true,
12031204
Stdin: inputR,
1204-
Stdout: &nopCloser{output},
1205-
Stderr: &nopCloser{output},
1205+
Stdout: &iohelper.NopWriteCloser{Writer: output},
1206+
Stderr: &iohelper.NopWriteCloser{Writer: output},
12061207
Env: []string{fmt.Sprintf("PS1=%s", prompt.String())},
12071208
})
12081209
require.NoError(t, err)
@@ -1296,8 +1297,8 @@ func testClientGatewayContainerCancelExecTty(t *testing.T, sb integration.Sandbo
12961297
Args: []string{"sh"},
12971298
Tty: true,
12981299
Stdin: inputR,
1299-
Stdout: &nopCloser{output},
1300-
Stderr: &nopCloser{output},
1300+
Stdout: &iohelper.NopWriteCloser{Writer: output},
1301+
Stderr: &iohelper.NopWriteCloser{Writer: output},
13011302
Env: []string{fmt.Sprintf("PS1=%s", prompt.String())},
13021303
})
13031304
require.NoError(t, err)
@@ -1439,7 +1440,7 @@ func testClientGatewayContainerPlatformPATH(t *testing.T, sb integration.Sandbox
14391440
output := bytes.NewBuffer(nil)
14401441
pid1, err := ctr.Start(ctx, client.StartRequest{
14411442
Args: []string{"/bin/sh", "-c", "echo -n $PATH"},
1442-
Stdout: &nopCloser{output},
1443+
Stdout: &iohelper.NopWriteCloser{Writer: output},
14431444
})
14441445
require.NoError(t, err)
14451446

@@ -1580,8 +1581,8 @@ func testClientGatewayExecError(t *testing.T, sb integration.Sandbox) {
15801581
Args: []string{"sh"},
15811582
Tty: true,
15821583
Stdin: inputR,
1583-
Stdout: &nopCloser{pid1Output},
1584-
Stderr: &nopCloser{pid1Output},
1584+
Stdout: &iohelper.NopWriteCloser{Writer: pid1Output},
1585+
Stderr: &iohelper.NopWriteCloser{Writer: pid1Output},
15851586
Env: []string{fmt.Sprintf("PS1=%s", prompt.String())},
15861587
})
15871588
require.NoError(t, err)
@@ -1594,7 +1595,7 @@ func testClientGatewayExecError(t *testing.T, sb integration.Sandbox) {
15941595
Env: meta.Env,
15951596
User: meta.User,
15961597
Cwd: meta.Cwd,
1597-
Stdout: &nopCloser{output},
1598+
Stdout: &iohelper.NopWriteCloser{Writer: output},
15981599
SecurityMode: exec.Security,
15991600
})
16001601
require.NoError(t, err)
@@ -1693,7 +1694,7 @@ func testClientGatewaySlowCacheExecError(t *testing.T, sb integration.Sandbox) {
16931694
output := bytes.NewBuffer(nil)
16941695
proc, err := ctr.Start(ctx, client.StartRequest{
16951696
Args: []string{"cat", "/problem/found/data"},
1696-
Stdout: &nopCloser{output},
1697+
Stdout: &iohelper.NopWriteCloser{Writer: output},
16971698
})
16981699
require.NoError(t, err)
16991700

@@ -1843,7 +1844,7 @@ func testClientGatewayExecFileActionError(t *testing.T, sb integration.Sandbox)
18431844
output := bytes.NewBuffer(nil)
18441845
proc, err := ctr.Start(ctx, client.StartRequest{
18451846
Args: []string{"cat", tt.Path},
1846-
Stdout: &nopCloser{output},
1847+
Stdout: &iohelper.NopWriteCloser{Writer: output},
18471848
})
18481849
require.NoError(t, err)
18491850

@@ -1957,8 +1958,8 @@ func testClientGatewayContainerSecurityMode(t *testing.T, sb integration.Sandbox
19571958

19581959
pid, err := ctr.Start(ctx, client.StartRequest{
19591960
Args: command,
1960-
Stdout: &nopCloser{stdout},
1961-
Stderr: &nopCloser{stderr},
1961+
Stdout: &iohelper.NopWriteCloser{Writer: stdout},
1962+
Stderr: &iohelper.NopWriteCloser{Writer: stderr},
19621963
SecurityMode: mode,
19631964
})
19641965
if err != nil {
@@ -2048,8 +2049,8 @@ func testClientGatewayContainerExtraHosts(t *testing.T, sb integration.Sandbox)
20482049

20492050
pid, err := ctr.Start(ctx, client.StartRequest{
20502051
Args: []string{"grep", "169.254.11.22\tsome.host", "/etc/hosts"},
2051-
Stdout: &nopCloser{stdout},
2052-
Stderr: &nopCloser{stderr},
2052+
Stdout: &iohelper.NopWriteCloser{Writer: stdout},
2053+
Stderr: &iohelper.NopWriteCloser{Writer: stderr},
20532054
})
20542055
if err != nil {
20552056
ctr.Release(ctx)
@@ -2147,8 +2148,8 @@ func testClientGatewayContainerHostNetworking(t *testing.T, sb integration.Sandb
21472148

21482149
pid, err := ctr.Start(ctx, client.StartRequest{
21492150
Args: []string{"/bin/sh", "-c", fmt.Sprintf("nc 127.0.0.1 %s | grep foo", port)},
2150-
Stdout: &nopCloser{stdout},
2151-
Stderr: &nopCloser{stderr},
2151+
Stdout: &iohelper.NopWriteCloser{Writer: stdout},
2152+
Stderr: &iohelper.NopWriteCloser{Writer: stderr},
21522153
})
21532154
if err != nil {
21542155
ctr.Release(ctx)
@@ -2364,11 +2365,3 @@ func testClientGatewayEmptyImageExec(t *testing.T, sb integration.Sandbox) {
23642365
}, nil)
23652366
require.NoError(t, err)
23662367
}
2367-
2368-
type nopCloser struct {
2369-
io.Writer
2370-
}
2371-
2372-
func (n *nopCloser) Close() error {
2373-
return nil
2374-
}

0 commit comments

Comments
 (0)