Commit Graph

564 Commits

Author SHA1 Message Date
Maksym Pavlenko
1e3446f24b Merge pull request #12666 from aadhar-agarwal/aadagarwal/fix-st1005
Fix ST1005 lint violations: lowercase error strings
2026-01-07 01:06:39 +00:00
Aadhar Agarwal
d6ee6f69b2 Fix ST1005 lint violations: lowercase error strings
Error strings should not be capitalized (unless beginning with proper
nouns or acronyms) or end with punctuation, per Go style guide and
staticcheck ST1005.

This change lowercases the first letter of error messages in fmt.Errorf
calls throughout the codebase, while preserving uppercase for acronyms
at the start of error strings (e.g., NRI, RDT, CDI, UID, GID, VHD, FUSE).

Also fixes typo 'faild' -> 'failed' in resolver_test.go.

Changes:
- core/metadata: target.Digest, target.Size, target.MediaType
- core/remotes/docker: fetcher.Seek, fetcherByDigest
- integration: various test error messages
- internal/cri/server: containerConfig
- plugins/snapshots: erofs

Fixes #12011

Signed-off-by: Aadhar Agarwal <aadagarwal@microsoft.com>
2026-01-07 00:26:28 +00:00
Maksym Pavlenko
253fbe756a Cleanup unit tests
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2026-01-06 10:52:49 -08:00
Henry Wang
0198b87fcf Implement parallel unpack
Signed-off-by: Henry Wang <henwang@amazon.com>
2025-10-24 17:54:26 +00:00
Fu Wei
61ddcd5372 Merge pull request #12063 from dmcgowan/mount-manager
Add mount manager
2025-10-03 14:01:38 +00:00
Derek McGowan
67f0970a54 Add mount activation integration test
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-09-29 17:08:35 -07:00
Henry Wang
5a00693e7f Fix integ-test: looking for sleep inf as longCommand
Signed-off-by: Henry Wang <henwang@amazon.com>
2025-09-29 19:44:33 +00:00
Enji Cooper
f45716efed Clean up issues cited by usetesting package with golangci
This commit makes all of the recommended changes to use the `testing`
package helper functions instead of doing the equivalent longhand
versions of the same thing.

This change was needed in order to properly detect errors, as the code
would previously skip running `tenv` stating that it had been deprecated
in favor of `usetesting`.

Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
2025-09-07 14:07:40 -07:00
Akhil Mohan
222b2d3e72 update pause image to pause:3.10.1
Signed-off-by: Akhil Mohan <akhilerm@gmail.com>
2025-07-11 11:29:02 +05:30
Derek McGowan
4d89721f23 Merge pull request #11623 from yashsingh74/update-golangci-v2
ci: bump golangci from 6.5.2 to 7.0.0
2025-07-01 18:06:14 +00:00
ningmingxiao
a79e791413 ci:fix ci TestContainerExecLargeOutputWithTTY panic
Signed-off-by: ningmingxiao <ning.mingxiao@zte.com.cn>
2025-06-21 13:16:27 +08:00
yashsingh74
4ba81d4296 fix: ST1001: should not use dot imports (staticcheck)
Signed-off-by: yashsingh74 <yashsingh1774@gmail.com>
2025-06-18 14:16:41 +05:30
yylt
9de26f3150 [e2e] add case for shim wait interface
Signed-off-by: yang yang <yang8518296@163.com>
2025-06-10 23:05:44 +08:00
Kirtana Ashok
2f1948a503 Enable CIs to run on WS2022 and WS2025
Signed-off-by: Kirtana Ashok <kiashok@microsoft.com>
2025-06-05 15:25:03 -07:00
Jin Dong
213337ce4e Fetch image with default platform only in TestExportAndImportMultiLayer
`TestExportAndImportMultiLayer` has been very flaky due to upstream
registry throttling/unavailability. E.g.,

https://github.com/containerd/containerd/actions/runs/15168768477/job/42653479864

```shell
    log_hook.go:47: time="2025-05-21T17:42:37.345336659Z" level=debug msg="fetch failed" func=docker.dockerFetcher.open file="/home/runner/work/containerd/containerd/core/remotes/docker/fetcher.go:470" digest="sha256:5178da1ca6af8a14a235f58eb31955ca5f4c72f950d35f9bb67a8bd20232d840" error="unexpected status code https://mcr.microsoft.com/v2/windows/nanoserver/blobs/sha256:5178da1ca6af8a14a235f58eb31955ca5f4c72f950d35f9bb67a8bd20232d840: 503 Service Unavailable" mediatype=application/vnd.docker.image.rootfs.foreign.diff.tar.gzip size=116254563 testcase=TestExportAndImportMultiLayer url="https://mcr.microsoft.com/v2/windows/nanoserver/blobs/sha256:5178da1ca6af8a14a235f58eb31955ca5f4c72f950d35f9bb67a8bd20232d840"
```

Notice this test fetches all platform images which is
unnecessary I think. E.g., the 503 from mcr above caused Linux test failures.
This change should reduce requests to `mcr.microsoft.com`.

Signed-off-by: Jin Dong <djdongjin95@gmail.com>
2025-05-21 16:08:39 -04:00
Danny Canter
33ee060a35 Use Go 1.19 atomic wrappers everywhere
We've long been able to use these and they have a couple
great benefits:

1. Forces you to always access them atomically. With the pointer
variants it's completely valid to access the regular ol' int64/uint32
etc. without using the atomic.* methods. These wrappers don't provide
access to the underlying value so it forces correct usage always.

2. Conveys intent much better. Seeing the type be atomic.Int32 immediately
lets the reader know that this var will be used in a concurrent context,
and we no longer need comments like "this MUST be accessed atomically"
or similar.

Signed-off-by: Danny Canter <danny@dcantah.dev>
2025-05-03 03:46:20 -07:00
Derek McGowan
ee7189d1df Add retries for flaky Windows test
Partially addressing issue #8422
This does not fix an underlying race in the output

Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-04-30 16:16:39 -07:00
Adrien Delorme
72c8c7708c only keep one setting: concurrent_layer_fetch_buffer
Signed-off-by: Adrien Delorme <azr@users.noreply.github.com>
2025-04-24 11:41:33 +02:00
Adrien Delorme
024775dab1 set dl options on resolver
Signed-off-by: Adrien Delorme <azr@users.noreply.github.com>
2025-04-24 11:41:33 +02:00
Adrien Delorme
f9af08820b perf(pull): multipart layer fetch
Signed-off-by: Adrien Delorme <azr@users.noreply.github.com>
Co-Authored-By: Corentin REGAL <143578+co42@users.noreply.github.com>
2025-04-24 11:39:42 +02:00
Tony Fang
b694be29a0 Update CRI image service to pull using transfer service
- adds a transfer service progress reporter to handle timeouts. Also other test fixes
- fallback to local image pull when configuration conflict

Signed-off-by: Tony Fang <nhfang@amazon.com>

Co-authored-by: Swagat Bora <sbora@amazon.com>
2025-04-23 18:18:27 +00:00
Akihiro Suda
d9c889568e Remove the support for Schema 1 images
Schema 1 (`application/vnd.docker.distribution.manifest.v1+prettyjws`) has been
officially deprecated since containerd v1.7 (PR 6884), and disabled since v2.0 (PR 9765).

Users who have been seeing warnings like `conversion from schema 1 images is deprecated`
now have to rebuild the image with Schema 2 or OCI.

Schema 2 was introduced in Docker 1.10 (Feb 2016), so most users should have been already
using Schema 2 or OCI.

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2025-04-11 09:03:26 +09:00
Iceber Gu
450038a28b integration/client: add tests for TaskOptions is not empty
Co-authored-by: Wei Fu <fuweid89@gmail.com>
Signed-off-by: Iceber Gu <caiwei95@hotmail.com>
2025-03-26 15:00:11 +08:00
Derek McGowan
20812afa9f Merge pull request #11512 from alingse/fix-repeat-args
fix: repeat args from sub-func call
2025-03-14 18:21:21 +00:00
ningmingxiao
531adbf065 config:fix config migrate lost timeout config
Signed-off-by: ningmingxiao <ning.mingxiao@zte.com.cn>
2025-03-12 23:34:58 +08:00
alingse
b947e05663 fix: repeat args from sub-func call
Signed-off-by: alingse <alingse@foxmail.com>
2025-03-09 14:53:44 +08:00
Phil Estes
98af40b752 Merge pull request #10722 from henry118/uidmap2
Support multiple uid/gid mappings [2/2]
2025-01-17 18:34:40 +00:00
Jin Dong
b7a117b464 Fix fuzz integration tests
Fuzz integration tests on Github Action
panics because it cannot find the containerd
PATH.

```
failed to start daemon: failed to start daemon: exec: "containerd": executable file not found in $PATH:
panic: fatal [recovered]
	panic: fatal
```

It's because in Action the `OUT` env var (/github/workspace/build-out)
is different compared to oss-fuzz.

Signed-off-by: Jin Dong <djdongjin95@gmail.com>
2025-01-11 03:12:10 +00:00
Kazuyoshi Kato
5ad6a150b6 Merge pull request #11189 from djdongjin/move-to-go-native-fuzz
Move fuzz tests to go native fuzz [part1]
2025-01-10 01:27:14 +00:00
Jin Dong
a550830078 Remove github.com/AdamKorcz/go-118-fuzz-build in go.mod
We can add the dependency in oss_fuzz_build.sh, since
it's only used for oss-fuzz

change os.MkdirTemp to t.TempDir in fuzz tests

Signed-off-by: Jin Dong <djdongjin95@gmail.com>
2024-12-25 01:25:48 +00:00
Jin Dong
2de1030299 Move fuzz tests to go native fuzz [part1]
Signed-off-by: Jin Dong <djdongjin95@gmail.com>
2024-12-24 22:48:20 +00:00
Austin Vazquez
bee64b2b93 Remove loop variable copies
Signed-off-by: Austin Vazquez <macedonv@amazon.com>
2024-12-23 23:14:49 -07:00
Henry Wang
ff0d99e028 Add multiple uid/gid mapping test cases to integration tests
Signed-off-by: Henry Wang <henwang@amazon.com>
2024-12-11 18:04:11 +00:00
Derek McGowan
ed39dfa5d6 Add integration test for custom configuration
Signed-off-by: Derek McGowan <derek@mcg.dev>
2024-11-27 16:03:04 -08:00
Derek McGowan
bddeba8250 Make TestContainerPids more resilient
ListPids may not pick up the sh subprocess yet when it is first run. To
make this test more resilient, retry fetching the processes if only a
single pid is found for a short time.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2024-11-02 23:46:55 -07:00
Henry Wang
83aaa89b61 update ctr run to support multiple uid/gid mappings
Signed-off-by: Henry Wang <henwang@amazon.com>
2024-09-10 17:06:27 +00:00
Samuel Karp
18725f010b integration: regression test for issue 10589
This issue was caused by a race between init exits and new exec process
tracking inside the shim. The test operates by controlling the time
between when the shim invokes "runc exec" and when the actual "runc
exec" is triggered. This allows validating that races for shim state
tracking between pre- and post-start of the exec process do not exist.

Relates to https://github.com/containerd/containerd/issues/10589

Signed-off-by: Samuel Karp <samuelkarp@google.com>
2024-09-05 16:17:09 -07:00
Akhil Mohan
f8e0753366 remove windows check in linux_test file
Signed-off-by: Akhil Mohan <akhilerm@gmail.com>
2024-08-14 14:22:03 +05:30
Henry Wang
243b803a19 Add pprof to runc-shim
Signed-off-by: Henry Wang <henwang@amazon.com>
2024-06-20 23:12:31 +00:00
Derek McGowan
b1a23c495a Fail integration test early when a plugin load fails
Avoid running tests when a plugin fails to load and return the init
error from the plugin. This prevents the test failing later with an
unhelpful error and attempting to find the actual error in the daemon
logs.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2024-06-05 16:58:03 -07:00
bzsuni
22f2af40c0 update pause image to 3.10
Signed-off-by: bzsuni <bingzhe.sun@daocloud.io>
2024-05-25 08:17:46 +08:00
Henry Wang
d9dc2811ae fix: delete sockets on shim exit
Signed-off-by: Henry Wang <henwang@amazon.com>
2024-05-08 21:53:39 +00:00
Derek McGowan
2ac2b9c909 Make api a Go sub-module
Allow the api to stay at the same v1 go package name and keep using a
1.x version number. This indicates the API is still at 1.x and allows
sharing proto types with containerd 1.6 and 1.7 releases.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2024-05-02 11:03:00 -07:00
Derek McGowan
e1b94c0e7d Move protobuf package under pkg
Signed-off-by: Derek McGowan <derek@mcg.dev>
2024-05-02 10:52:03 -07:00
Derek McGowan
4a45507772 Move runc options to api directory
Signed-off-by: Derek McGowan <derek@mcg.dev>
2024-05-02 10:52:00 -07:00
Kirtana Ashok
5b6ae0f796 Use different containerd sock address in tests
Signed-off-by: Kirtana Ashok <kiashok@microsoft.com>
2024-03-27 19:04:48 -07:00
Akihiro Suda
d9b9160ae1 mv internal/testutil pkg/testutil
The package is consumed by several snapshotter plugins

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2024-03-04 17:00:39 +09:00
Akihiro Suda
fcdfd923cb Merge pull request #8970 from cpuguy83/otel_off_by_default
Configure otel from env instead of config.toml
2024-02-22 04:57:50 +00:00
Brian Goff
4fbc9842d5 Changes to configuring otel from env only
These are standard environment variables described by the otel spec in
https://opentelemetry.io/docs/specs/otel/configuration/sdk-environment-variables/.

The old config options are removed

Also since otel will by default try to connect to https://localhost:4318
if no endpoint is set, this will also just disable the otlp plugin when
there is no endpoint so we don't have otel continuously trying to
connect to the default endpoint, littering the logs with connection
failure messages and collecting traces that won't go anywhere.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2024-02-20 21:59:45 +00:00
Akhil Mohan
0693b936d2 replace deprecated Prestart to CreateRuntime hook
Prestart Hook is deprecated and can be replaced with CreateRuntime hook

Signed-off-by: Akhil Mohan <akhilerm@gmail.com>
2024-02-20 21:54:47 +05:30