Skip to content

Commit

Permalink
Updated tests in frontend/dockerfile/dockerfile_test.go to run on Win…
Browse files Browse the repository at this point in the history
…dows.

Partially addressing #4485

Signed-off-by: Billy Owire <billyowire95@gmail.com>
  • Loading branch information
crazy-max authored and billywr committed Oct 2, 2024
2 parents 1da789b + 49142c5 commit c8e79f9
Show file tree
Hide file tree
Showing 6 changed files with 134 additions and 67 deletions.
25 changes: 9 additions & 16 deletions .github/workflows/test-os.yml
Original file line number Diff line number Diff line change
Expand Up @@ -174,11 +174,10 @@ jobs:
uses: crazy-max/ghaction-dump-context@v2

test-freebsd-amd64:
runs-on: macos-13
runs-on: ubuntu-22.04
needs:
- build
env:
VAGRANT_VAGRANTFILE: hack/Vagrantfile.freebsd13
GOOS: freebsd
steps:
-
Expand All @@ -195,25 +194,23 @@ jobs:
uses: actions/cache@v4
with:
path: ~/.vagrant.d/boxes
key: ${{ runner.os }}-vagrant-${{ hashFiles('hack/Vagrantfile.freebsd13') }}
key: ${{ runner.os }}-vagrant-${{ hashFiles('hack/Vagrantfile.freebsd') }}
restore-keys: |
${{ runner.os }}-vagrant-
-
name: Install vagrant and VirtualBox
run: |
set -x
brew tap hashicorp/tap
brew install hashicorp/tap/hashicorp-vagrant
brew install --cask virtualbox
-
name: Check versions
name: Install vagrant
run: |
set -x
sudo apt-get update
sudo apt-get install -y libvirt-daemon libvirt-daemon-system vagrant vagrant-libvirt ruby-libvirt
sudo systemctl enable --now libvirtd
sudo chmod a+rw /var/run/libvirt/libvirt-sock
vagrant plugin install vagrant-libvirt
vagrant --version
VBoxManage -v
-
name: Set up vagrant
run: |
ln -sf hack/Vagrantfile.freebsd Vagrantfile
vagrant up --no-tty
-
name: Smoke test
Expand All @@ -233,7 +230,3 @@ jobs:
if: always()
run: |
vagrant ssh -- "sudo cat /vagrant/.tmp/logs/containerd"
-
name: Dump context
if: failure()
uses: crazy-max/ghaction-dump-context@v2
7 changes: 5 additions & 2 deletions cache/contenthash/checksum.go
Original file line number Diff line number Diff line change
Expand Up @@ -1034,7 +1034,7 @@ func (cc *cacheContext) scanPath(ctx context.Context, m *mount, p string, follow
scanPath = resolvedPath
}

err = filepath.Walk(scanPath, func(itemPath string, fi os.FileInfo, err error) error {
walkFunc := func(itemPath string, fi os.FileInfo, err error) error {
if scanCounterEnable {
scanCounter.Add(1)
}
Expand Down Expand Up @@ -1073,7 +1073,10 @@ func (cc *cacheContext) scanPath(ctx context.Context, m *mount, p string, follow
txn.Insert(k, cr)
}
return nil
})
}

err = cc.walk(scanPath, walkFunc)

if err != nil {
return err
}
Expand Down
10 changes: 10 additions & 0 deletions cache/contenthash/checksum_unix.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
//go:build !windows
// +build !windows

package contenthash

import "path/filepath"

func (cc *cacheContext) walk(scanPath string, walkFunc filepath.WalkFunc) error {
return filepath.Walk(scanPath, walkFunc)
}
16 changes: 16 additions & 0 deletions cache/contenthash/checksum_windows.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package contenthash

import (
"path/filepath"

"github.com/Microsoft/go-winio"
)

func (cc *cacheContext) walk(scanPath string, walkFunc filepath.WalkFunc) error {
// elevating the admin privileges to walk special files/directory
// like `System Volume Information`, etc. See similar in #4994
privileges := []string{winio.SeBackupPrivilege}
return winio.RunWithPrivileges(privileges, func() error {
return filepath.Walk(scanPath, walkFunc)
})
}
Loading

0 comments on commit c8e79f9

Please sign in to comment.