Skip to content

Commit ff0de5d

Browse files
committed
Vendor ctrd v2.1.0 and update CIs to WS2022,WS2025
Signed-off-by: Kirtana Ashok <[email protected]>
1 parent 75059e3 commit ff0de5d

File tree

639 files changed

+37667
-15546
lines changed

Some content is hidden

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

639 files changed

+37667
-15546
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -273,12 +273,12 @@ jobs:
273273
fail-fast: false
274274
matrix:
275275
name:
276-
[windows-2022, windows-2019]
276+
[windows-2022, windows-2025]
277277
include:
278-
- name: "windows-2019"
279-
runner: [self-hosted, 1ES.Pool=containerplat-github-runner-pool-east-us-2, 1ES.ImageOverride=github-mms-ws2019-containers-enabled]
280278
- name: "windows-2022"
281279
runner: [self-hosted, 1ES.Pool=containerplat-github-runner-pool-east-us-2, 1ES.ImageOverride=github-mms-ws2022-containers-enabled]
280+
- name: "windows-2025"
281+
runner: [self-hosted, 1ES.Pool=containerplat-github-runner-pool-east-us-2, 1ES.ImageOverride=github-ws2025-containers-enabled]
282282
steps:
283283
- name: Checkout
284284
uses: actions/checkout@v4
@@ -404,7 +404,7 @@ jobs:
404404
strategy:
405405
fail-fast: false
406406
matrix:
407-
os: [windows-2019, windows-2022]
407+
os: [windows-2022, windows-2025]
408408

409409
steps:
410410
- name: Checkout hcsshim
@@ -429,7 +429,7 @@ jobs:
429429
- name: Get containerd ref
430430
shell: powershell
431431
run: |
432-
$v = go list -m -f '{{ .Version }}' 'github.com/containerd/containerd' 2>&1
432+
$v = go list -m -f '{{ .Version }}' 'github.com/containerd/containerd/v2' 2>&1
433433
if ( $LASTEXITCODE ) {
434434
Write-Output '::error::Could not retrieve containerd version.'
435435
exit $LASTEXITCODE

cmd/containerd-shim-runhcs-v1/events.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import (
77
"fmt"
88

99
"github.com/Microsoft/hcsshim/internal/oc"
10-
"github.com/containerd/containerd/namespaces"
11-
shim "github.com/containerd/containerd/runtime/v2/shim"
10+
"github.com/containerd/containerd/v2/pkg/namespaces"
11+
"github.com/containerd/containerd/v2/pkg/shim"
1212
"go.opencensus.io/trace"
1313
)
1414

cmd/containerd-shim-runhcs-v1/exec_hcs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
eventstypes "github.com/containerd/containerd/api/events"
1111
task "github.com/containerd/containerd/api/runtime/task/v2"
1212
containerd_v1_types "github.com/containerd/containerd/api/types/task"
13-
"github.com/containerd/containerd/runtime"
13+
"github.com/containerd/containerd/v2/core/runtime"
1414
"github.com/containerd/errdefs"
1515
"github.com/opencontainers/runtime-spec/specs-go"
1616
"github.com/pkg/errors"

cmd/containerd-shim-runhcs-v1/exec_wcow_podsandbox.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
eventstypes "github.com/containerd/containerd/api/events"
1212
task "github.com/containerd/containerd/api/runtime/task/v2"
1313
containerd_v1_types "github.com/containerd/containerd/api/types/task"
14-
"github.com/containerd/containerd/runtime"
14+
"github.com/containerd/containerd/v2/core/runtime"
1515
"github.com/containerd/errdefs"
1616
"github.com/pkg/errors"
1717
"github.com/sirupsen/logrus"

cmd/containerd-shim-runhcs-v1/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import (
2424
hcsversion "github.com/Microsoft/hcsshim/internal/version"
2525

2626
// register common types spec with typeurl
27-
_ "github.com/containerd/containerd/runtime"
27+
_ "github.com/containerd/containerd/v2/core/runtime"
2828
)
2929

3030
const usage = ``

cmd/containerd-shim-runhcs-v1/options/runhcs.pb.go

Lines changed: 66 additions & 136 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cmd/containerd-shim-runhcs-v1/pod.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import (
1818
"github.com/Microsoft/hcsshim/pkg/annotations"
1919
eventstypes "github.com/containerd/containerd/api/events"
2020
task "github.com/containerd/containerd/api/runtime/task/v2"
21-
"github.com/containerd/containerd/runtime"
21+
"github.com/containerd/containerd/v2/core/runtime"
2222
"github.com/containerd/errdefs"
2323
"github.com/opencontainers/runtime-spec/specs-go"
2424
"github.com/pkg/errors"

cmd/containerd-shim-runhcs-v1/service_internal.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ import (
1111

1212
task "github.com/containerd/containerd/api/runtime/task/v2"
1313
containerd_v1_types "github.com/containerd/containerd/api/types/task"
14-
"github.com/containerd/containerd/protobuf"
1514
"github.com/containerd/errdefs"
1615
typeurl "github.com/containerd/typeurl/v2"
1716
"github.com/opencontainers/runtime-spec/specs-go"
1817
"github.com/pkg/errors"
18+
"google.golang.org/protobuf/types/known/anypb"
1919
"google.golang.org/protobuf/types/known/emptypb"
2020
"google.golang.org/protobuf/types/known/timestamppb"
2121

@@ -225,13 +225,13 @@ func (s *service) pidsInternal(ctx context.Context, req *task.PidsRequest) (*tas
225225
}
226226
processes := make([]*containerd_v1_types.ProcessInfo, len(pids))
227227
for i, p := range pids {
228-
a, err := typeurl.MarshalAny(p)
228+
a, err := anypb.New(p)
229229
if err != nil {
230230
return nil, errors.Wrapf(err, "failed to marshal ProcessDetails for process: %s, task: %s", p.ExecID, req.ID)
231231
}
232232
proc := &containerd_v1_types.ProcessInfo{
233233
Pid: p.ProcessID,
234-
Info: protobuf.FromAny(a),
234+
Info: a,
235235
}
236236
processes[i] = proc
237237
}
@@ -474,11 +474,11 @@ func (s *service) statsInternal(ctx context.Context, req *task.StatsRequest) (*t
474474
if err != nil {
475475
return nil, err
476476
}
477-
any, err := typeurl.MarshalAny(stats)
477+
any, err := anypb.New(stats)
478478
if err != nil {
479479
return nil, errors.Wrapf(err, "failed to marshal Statistics for task: %s", req.ID)
480480
}
481-
return &task.StatsResponse{Stats: protobuf.FromAny(any)}, nil
481+
return &task.StatsResponse{Stats: any}, nil
482482
}
483483

484484
func (s *service) connectInternal(ctx context.Context, req *task.ConnectRequest) (*task.ConnectResponse, error) {

cmd/containerd-shim-runhcs-v1/service_internal_podshim_test.go

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,22 @@ import (
1414
"github.com/Microsoft/hcsshim/cmd/containerd-shim-runhcs-v1/options"
1515
"github.com/Microsoft/hcsshim/cmd/containerd-shim-runhcs-v1/stats"
1616
task "github.com/containerd/containerd/api/runtime/task/v2"
17-
"github.com/containerd/containerd/protobuf"
1817
"github.com/containerd/errdefs"
1918
typeurl "github.com/containerd/typeurl/v2"
2019
specs "github.com/opencontainers/runtime-spec/specs-go"
20+
"google.golang.org/protobuf/types/known/anypb"
2121
)
2222

23+
func typeURLToAnyPb(any typeurl.Any) *anypb.Any {
24+
if any == nil {
25+
return nil
26+
}
27+
return &anypb.Any{
28+
TypeUrl: any.GetTypeUrl(),
29+
Value: any.GetValue(),
30+
}
31+
}
32+
2333
func setupPodServiceWithFakes(t *testing.T) (*service, *testShimTask, *testShimTask, *testShimExec) {
2434
t.Helper()
2535
tid := strconv.Itoa(rand.Int())
@@ -607,7 +617,12 @@ func Test_PodShim_updateInternal_Success(t *testing.T) {
607617
t.Fatal(err)
608618
}
609619

610-
resp, err := s.updateInternal(context.TODO(), &task.UpdateTaskRequest{ID: t1.ID(), Resources: protobuf.FromAny(any)})
620+
resp, err := s.updateInternal(
621+
context.TODO(),
622+
&task.UpdateTaskRequest{
623+
ID: t1.ID(),
624+
Resources: typeURLToAnyPb(any),
625+
})
611626
if err != nil {
612627
t.Fatalf("should not have failed with error, got: %v", err)
613628
}
@@ -625,7 +640,13 @@ func Test_PodShim_updateInternal_Error(t *testing.T) {
625640
if err != nil {
626641
t.Fatal(err)
627642
}
628-
_, err = s.updateInternal(context.TODO(), &task.UpdateTaskRequest{ID: t1.ID(), Resources: protobuf.FromAny(any)})
643+
644+
_, err = s.updateInternal(
645+
context.TODO(),
646+
&task.UpdateTaskRequest{
647+
ID: t1.ID(),
648+
Resources: typeURLToAnyPb(any),
649+
})
629650
if err == nil {
630651
t.Fatal("expected to get an error for incorrect resource's type")
631652
}

cmd/containerd-shim-runhcs-v1/service_internal_taskshim_test.go

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import (
1818
"github.com/Microsoft/hcsshim/internal/hcsoci"
1919
"github.com/Microsoft/hcsshim/pkg/ctrdtaskapi"
2020
task "github.com/containerd/containerd/api/runtime/task/v2"
21-
"github.com/containerd/containerd/protobuf"
2221
"github.com/containerd/errdefs"
2322
typeurl "github.com/containerd/typeurl/v2"
2423
"github.com/opencontainers/runtime-spec/specs-go"
@@ -527,12 +526,18 @@ func Test_TaskShim_updateInternal_Success(t *testing.T) {
527526
},
528527
}
529528

530-
any, err := typeurl.MarshalAny(resources)
529+
resourcesTypeURL, _ := typeurl.MarshalAny(resources)
530+
any, err := typeurl.MarshalAny(resourcesTypeURL)
531531
if err != nil {
532532
t.Fatal(err)
533533
}
534534

535-
resp, err := s.updateInternal(context.TODO(), &task.UpdateTaskRequest{ID: t1.ID(), Resources: protobuf.FromAny(any)})
535+
resp, err := s.updateInternal(
536+
context.TODO(),
537+
&task.UpdateTaskRequest{
538+
ID: t1.ID(),
539+
Resources: typeURLToAnyPb(any),
540+
})
536541
if err != nil {
537542
t.Fatalf("should not have failed with error, got: %v", err)
538543
}
@@ -563,7 +568,12 @@ func Test_TaskShimWindowsMount_updateInternal_Success(t *testing.T) {
563568
t.Fatal(err)
564569
}
565570

566-
resp, err := s.updateInternal(context.TODO(), &task.UpdateTaskRequest{ID: t1.ID(), Resources: protobuf.FromAny(any)})
571+
resp, err := s.updateInternal(
572+
context.TODO(),
573+
&task.UpdateTaskRequest{
574+
ID: t1.ID(),
575+
Resources: typeURLToAnyPb(any),
576+
})
567577
if err != nil {
568578
t.Fatalf("should not have failed update mount with error, got: %v", err)
569579
}
@@ -593,7 +603,12 @@ func Test_TaskShimWindowsMount_updateInternal_Error(t *testing.T) {
593603
t.Fatal(err)
594604
}
595605

596-
resp, err := s.updateInternal(context.TODO(), &task.UpdateTaskRequest{ID: t1.ID(), Resources: protobuf.FromAny(any)})
606+
resp, err := s.updateInternal(
607+
context.TODO(),
608+
&task.UpdateTaskRequest{
609+
ID: t1.ID(),
610+
Resources: typeURLToAnyPb(any),
611+
})
597612
if err == nil {
598613
t.Fatalf("should have failed update mount with error")
599614
}
@@ -612,7 +627,10 @@ func Test_TaskShim_updateInternal_Error(t *testing.T) {
612627
t.Fatal(err)
613628
}
614629

615-
_, err = s.updateInternal(context.TODO(), &task.UpdateTaskRequest{ID: t1.ID(), Resources: protobuf.FromAny(any)})
630+
_, err = s.updateInternal(context.TODO(), &task.UpdateTaskRequest{
631+
ID: t1.ID(),
632+
Resources: typeURLToAnyPb(any),
633+
})
616634
if err == nil {
617635
t.Fatal("expected to get an error for incorrect resource's type")
618636
}

0 commit comments

Comments
 (0)