Skip to content

Commit

Permalink
Merged PR 7167661: Update ADO hcsshim from github repo
Browse files Browse the repository at this point in the history
Updating the ADO repo from github hcsshim

Last commit - f83cc58

Related work items: #1536, #1562, #1563, #1564, #1565
  • Loading branch information
kiashok committed Nov 18, 2022
2 parents 6fe31c3 + f83cc58 commit be52222
Show file tree
Hide file tree
Showing 23 changed files with 447 additions and 207 deletions.
26 changes: 13 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ jobs:
- uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
path: "go/src/github.com/Microsoft/hcsshim"
# Install protoc-gen-gogoctrd in D:\bin
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
repository: containerd/containerd
ref: v1.6.2
Expand Down Expand Up @@ -92,7 +92,7 @@ jobs:
env:
GOPROXY: "https://proxy.golang.org,direct"
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
Expand Down Expand Up @@ -127,8 +127,8 @@ jobs:
name: Go Generate
runs-on: "windows-2019"
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
- name: Validate go generate
Expand Down Expand Up @@ -156,7 +156,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Install go
uses: actions/setup-go@v3
Expand All @@ -176,7 +176,7 @@ jobs:
matrix:
os: [windows-2019, windows-2022]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
Expand All @@ -195,7 +195,7 @@ jobs:
- run: go build -mod=mod -o sample-logging-driver.exe ./cri-containerd/helpers/log.go
working-directory: test

- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
if: ${{ github.event_name == 'pull_request' }}
with:
name: test_binaries_${{ matrix.os }}
Expand Down Expand Up @@ -228,12 +228,12 @@ jobs:
echo "${{ github.workspace }}/bin" >> $GITHUB_PATH
echo "${{ github.workspace }}/src/github.com/containerd/containerd/bin" >> $GITHUB_PATH
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
path: src/github.com/containerd/containerd
repository: "containerd/containerd"

- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
path: src/github.com/Microsoft/hcsshim

Expand Down Expand Up @@ -344,7 +344,7 @@ jobs:
needs: [test-windows, test-linux]
runs-on: "windows-2019"
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
Expand All @@ -366,7 +366,7 @@ jobs:
- run: go build ./internal/tools/uvmboot
- run: go build ./internal/tools/zapdir

- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
if: ${{ github.event_name == 'pull_request' }}
with:
name: binaries
Expand All @@ -390,7 +390,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Install go
uses: actions/setup-go@v3
Expand Down
5 changes: 4 additions & 1 deletion internal/uvm/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,10 @@ func (uvm *UtilityVM) Start(ctx context.Context) (err error) {
}()
defer cancel()

// create exitCh ahead of time to prevent race conditions between writing
// initalizing the channel and waiting on it during acceptAndClose
uvm.exitCh = make(chan struct{})

// Prepare to provide entropy to the init process in the background. This
// must be done in a goroutine since, when using the internal bridge, the
// call to Start() will block until the GCS launches, and this cannot occur
Expand Down Expand Up @@ -208,7 +212,6 @@ func (uvm *UtilityVM) Start(ctx context.Context) (err error) {
}()

// Start waiting on the utility VM.
uvm.exitCh = make(chan struct{})
go func() {
err := uvm.hcsSystem.Wait()
if err == nil {
Expand Down
4 changes: 4 additions & 0 deletions test/cri-containerd/containerdrestart_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ func Test_ContainerdRestart_LCOW(t *testing.T) {

// test restarting containers and pods
func Test_Container_CRI_Restart(t *testing.T) {
requireFeatures(t, featureCRIPlugin)

client := newTestRuntimeClient(t)
pluginClient := newTestPluginClient(t)
ctx, cancel := context.WithCancel(context.Background())
Expand Down Expand Up @@ -220,6 +222,8 @@ func Test_Container_CRI_Restart_State(t *testing.T) {
testFile := "t.txt"
wcowTestFile := `C:\Users\ContainerUser\t.txt`

requireFeatures(t, featureCRIPlugin)

client := newTestRuntimeClient(t)
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
Expand Down
4 changes: 4 additions & 0 deletions test/cri-containerd/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ const (
featureTerminateOnRestart = "TerminateOnRestart"
featureLCOWIntegrity = "LCOWIntegrity"
featureLCOWCrypt = "LCOWCrypt"
featureCRIPlugin = "CRIPlugin"
)

var allFeatures = []string{
Expand All @@ -117,6 +118,9 @@ var allFeatures = []string{
featureGPU,
featureCRIUpdateContainer,
featureTerminateOnRestart,
featureLCOWIntegrity,
featureLCOWCrypt,
featureCRIPlugin,
}

func init() {
Expand Down
7 changes: 2 additions & 5 deletions test/functional/lcow_container_bench_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
package functional

import (
"context"
"testing"

ctrdoci "github.com/containerd/containerd/oci"
Expand All @@ -15,7 +14,6 @@ import (
"github.com/Microsoft/hcsshim/osversion"

"github.com/Microsoft/hcsshim/test/internal/cmd"
"github.com/Microsoft/hcsshim/test/internal/constants"
"github.com/Microsoft/hcsshim/test/internal/container"
"github.com/Microsoft/hcsshim/test/internal/layers"
"github.com/Microsoft/hcsshim/test/internal/oci"
Expand All @@ -27,9 +25,8 @@ func BenchmarkLCOW_Container(b *testing.B) {
requireFeatures(b, featureLCOW, featureContainer)
require.Build(b, osversion.RS5)

ctx, _, client := newContainerdClient(context.Background(), b)
ls := layers.FromImage(ctx, b, client, constants.ImageLinuxAlpineLatest,
constants.PlatformLinux, constants.SnapshotterLinux)
ctx := namespacedContext()
ls := linuxImageLayers(ctx, b)

// Create a new uvm per benchmark in case any left over state lingers

Expand Down
20 changes: 6 additions & 14 deletions test/functional/lcow_container_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
package functional

import (
"context"
"strings"
"testing"

Expand All @@ -13,7 +12,6 @@ import (
"github.com/Microsoft/hcsshim/osversion"

"github.com/Microsoft/hcsshim/test/internal/cmd"
"github.com/Microsoft/hcsshim/test/internal/constants"
"github.com/Microsoft/hcsshim/test/internal/container"
"github.com/Microsoft/hcsshim/test/internal/layers"
"github.com/Microsoft/hcsshim/test/internal/oci"
Expand All @@ -25,10 +23,8 @@ func TestLCOW_ContainerLifecycle(t *testing.T) {
requireFeatures(t, featureLCOW, featureContainer)
require.Build(t, osversion.RS5)

ctx, _, client := newContainerdClient(context.Background(), t)
ls := layers.FromImage(ctx, t, client, constants.ImageLinuxAlpineLatest,
constants.PlatformLinux, constants.SnapshotterLinux)

ctx := namespacedContext()
ls := linuxImageLayers(ctx, t)
opts := defaultLCOWOptions(t)
vm := uvm.CreateAndStartLCOWFromOpts(ctx, t, opts)

Expand Down Expand Up @@ -81,10 +77,8 @@ func TestLCOW_ContainerIO(t *testing.T) {
requireFeatures(t, featureLCOW, featureContainer)
require.Build(t, osversion.RS5)

ctx, _, client := newContainerdClient(context.Background(), t)
ls := layers.FromImage(ctx, t, client, constants.ImageLinuxAlpineLatest,
constants.PlatformLinux, constants.SnapshotterLinux)

ctx := namespacedContext()
ls := linuxImageLayers(ctx, t)
opts := defaultLCOWOptions(t)
cache := layers.CacheFile(ctx, t, "")
vm := uvm.CreateAndStartLCOWFromOpts(ctx, t, opts)
Expand Down Expand Up @@ -125,10 +119,8 @@ func TestLCOW_ContainerExec(t *testing.T) {
requireFeatures(t, featureLCOW, featureContainer)
require.Build(t, osversion.RS5)

ctx, _, client := newContainerdClient(context.Background(), t)
ls := layers.FromImage(ctx, t, client, constants.ImageLinuxAlpineLatest,
constants.PlatformLinux, constants.SnapshotterLinux)

ctx := namespacedContext()
ls := linuxImageLayers(ctx, t)
opts := defaultLCOWOptions(t)
vm := uvm.CreateAndStartLCOWFromOpts(ctx, t, opts)

Expand Down
8 changes: 2 additions & 6 deletions test/functional/lcow_networking_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
package functional

import (
"context"
"fmt"
"strings"
"testing"
Expand All @@ -15,7 +14,6 @@ import (
"github.com/Microsoft/hcsshim/osversion"

"github.com/Microsoft/hcsshim/test/internal/cmd"
"github.com/Microsoft/hcsshim/test/internal/constants"
"github.com/Microsoft/hcsshim/test/internal/container"
"github.com/Microsoft/hcsshim/test/internal/layers"
"github.com/Microsoft/hcsshim/test/internal/oci"
Expand Down Expand Up @@ -123,10 +121,8 @@ func TestLCOW_IPv6_Assignment(t *testing.T) {
t.Fatalf("network attachment: %v", err)
}

ctx, _, client := newContainerdClient(context.Background(), t)
ls := layers.FromImage(ctx, t, client, constants.ImageLinuxAlpineLatest,
constants.PlatformLinux, constants.SnapshotterLinux)

ctx := namespacedContext()
ls := linuxImageLayers(ctx, t)
opts := defaultLCOWOptions(t)
vm := uvm.CreateAndStartLCOWFromOpts(ctx, t, opts)

Expand Down
8 changes: 3 additions & 5 deletions test/functional/lcow_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import (

testutilities "github.com/Microsoft/hcsshim/test/internal"
testcmd "github.com/Microsoft/hcsshim/test/internal/cmd"
"github.com/Microsoft/hcsshim/test/internal/layers"
"github.com/Microsoft/hcsshim/test/internal/require"
testuvm "github.com/Microsoft/hcsshim/test/internal/uvm"
)
Expand Down Expand Up @@ -165,8 +164,7 @@ func TestLCOWSimplePodScenario(t *testing.T) {
require.Build(t, osversion.RS5)
requireFeatures(t, featureLCOW, featureContainer)

//nolint:staticcheck // SA1019: TODO: replace `LayerFolders`
alpineLayers := layers.LayerFolders(t, "alpine")
layers := linuxImageLayers(context.Background(), t)

cacheDir := t.TempDir()
cacheFile := filepath.Join(cacheDir, "cache.vhdx")
Expand Down Expand Up @@ -201,7 +199,7 @@ func TestLCOWSimplePodScenario(t *testing.T) {
t.Fatal(err)
}
c1Spec := testutilities.GetDefaultLinuxSpec(t)
c1Folders := append(alpineLayers, c1ScratchDir)
c1Folders := append(layers, c1ScratchDir)
c1Spec.Windows.LayerFolders = c1Folders
c1Spec.Process.Args = []string{"echo", "hello", "lcow", "container", "one"}
c1Opts := &hcsoci.CreateOptions{
Expand All @@ -214,7 +212,7 @@ func TestLCOWSimplePodScenario(t *testing.T) {
t.Fatal(err)
}
c2Spec := testutilities.GetDefaultLinuxSpec(t)
c2Folders := append(alpineLayers, c2ScratchDir)
c2Folders := append(layers, c2ScratchDir)
c2Spec.Windows.LayerFolders = c2Folders
c2Spec.Process.Args = []string{"echo", "hello", "lcow", "container", "two"}
c2Opts := &hcsoci.CreateOptions{
Expand Down
Loading

0 comments on commit be52222

Please sign in to comment.