Skip to content

Commit fd33950

Browse files
janishorstsmusaprgsipsmakzystonistiigi
authored
feat: merge tonistiigi upstream (586307a) (#2)
* Fix to respect special bit specified in the mode of copier Signed-off-by: Kotaro Inoue <inoue.kotaro@linecorp.com> * Add tests Signed-off-by: Kotaro Inoue <inoue.kotaro@linecorp.com> * Add support for always overwriting existing paths Before this, copy would always refuse to replace an existing path in the dest with something from the source of a different type. E.g. if there was a symlink at the dest, you'd get an error if copying src meant replacing the symlink w/ a directory. This is the right default behavior but there are situations in which callers may want to opt in to instead always replacing what's in dest with what's in source. This adds an option to enable that behavior. Signed-off-by: Erik Sipsma <erik@sipsma.dev> * Migrate off of gogo/protobuf gogo/protobuf has been deprecated since 2022. This change uses Google's code generator instead of gogo/protobuf. Signed-off-by: Kazuyoshi Kato <kato.kazuyoshi@gmail.com> * Fix to use internal representation for setting special bits Signed-off-by: Kotaro Inoue <k.musaino@gmail.com> * Fix cross-device copy failing on macOS Downstream issue: https://github.com/macOScontainers/rund/issues/28 Signed-off-by: Marat Radchenko <marat@slonopotamus.org> * followlinks: sanitize root path Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> * chore: fix typos in NewFilterFS docstring Signed-off-by: Justin Chadwell <me@jedevc.com> * Revert "Migrate off of gogo/protobuf" This reverts commit bea810c. Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> * chore: run once on vagrant init Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> * ci: increase vm boot time to 15m Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> * ci: switch to macos-13 runner for freebsd job Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> * ci: retry logic for freebsd test step Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> * ci: add windows to test matrix Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> * diskwriter: fix test scope Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> * fix file path separator Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> * test with coverage and send to codecov Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> * ci: align events Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> * readme badges Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> * ci: fix test step for windows Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> * ci: bump actions to latest stable Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> * chore: dependabot to keep gha up to date Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> * update to go 1.21 Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> * update golangci-lint to 1.54.2 also update config to show all issues at once and set linter setting for io/ioutil. Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> * dockerfile: update xx to 1.4.0 Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> * filter: allow SkipDir return with lazy parents When using include/exclude options in a file walk, we lazily store the parents, and only later call the target function with them when we find a file inside. This handles the case where `**/*.go` should only walk directories that contain `.go` files, and not every directory in the tree. However, when storing lazy parents, we weren't appropriately handling the `SkipDir` value that could be returned. We were making two incorrect assumptions: 1. An error value from `fn()` was always an error case - this isn't true, since we have control error values like `SkipDir`. Because of this, we need to ensure that `calledFn` is *always* set to true when calling `fn` (even in an error case). 2. We can return `SkipDir` to skip this parent directory. This isn't *quite* right, since returning `SkipDir` would return it only for the child directory - we need to make sure it's called everytime for each child directory of this parent directory, by storing it as a boolean `skipFn` field. With these changes, the new test passes, and we don't end up with duplicate parent calls, as was happening before: Error: Not equal: expected: []string{"foo"} actual : []string{"foo", "foo"} Signed-off-by: Justin Chadwell <me@jedevc.com> * filter: ensure MapResult is followed for parent directories Similar to the previous commit, we weren't properly respecting MapResult return values for parent directories. To resolve this, we just store into `skipFn` just like previously, and return `SkipDir` instead of `continue`ing on. After these changes, the new test passes, and we don't end up including entries that were in excluded directories, as was happening before: Error: Not equal: expected: "dir y\nfile y/b.txt\n" actual : "file x/a.txt\ndir y\nfile y/b.txt\n" Signed-off-by: Justin Chadwell <me@jedevc.com> * chore: codecov config Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> * ci: set codecov token Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> * ci: set workflow_dispatch event this is for manual testing from a fork Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> * send: ensure file path to unix form when sending files Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> * fix data race in progressCb Fixes a silly data race where progressCurrent is incremented (and later accessed) by 1 of 4 threads. Signed-off-by: Alex Couture-Beil <alex@earthly.dev> * receive: ensure callback errors are propagated Previously, it was possible for errors returned by an asyncronous callback function to not be propagated, and to instead return "context canceled" from `Receive`. This could happen based on this specific sequence of events: - An asyncronous callback is called from `HandleChange`, and returns an error, completing the async errorgroup context with an error state. - Another call to `HandleChange` completes, and uses the context syncronously, returning `context.Canceled`. - This in turn propagates to `doubleWalkDiff`, which returns the canceled error, instead of calling `Wait` which would contain the actual error group error. This behavior is racy, based on exactly how and when the asyncronous callback is called. The fix to this is relatively straightforward: we just need to make sure that syncronous and asyncronous function calls are kept separate, and don't reuse the same context. This means that a failure in an async callback, doesn't cause later sync ones to fail. Signed-off-by: Justin Chadwell <me@jedevc.com> * receive: translate unix-paths off the wire to native Then, inside all our validations, and our double walking, we don't have to worry about translating between different path formats. Additionally, we ensure that all received paths can be represented on the target host system. A path like `foo/bar\baz` can only be stored on linux (a dir with `foo`, containing a file `bar\baz`). On windows, this would later be interpreted to be `foo\bar\baz` (a dir with `foo`, containing a dir `bar`, containing a file `baz`). Signed-off-by: Justin Chadwell <me@jedevc.com> * chore: remove old windows todo comments Signed-off-by: Justin Chadwell <me@jedevc.com> * chore: add fsutil protocol description Signed-off-by: Justin Chadwell <me@jedevc.com> * recv: translate linkname to wire format Signed-off-by: Justin Chadwell <me@jedevc.com> * fix hardlink filter regression With the refactor to FilterFS the hardlink handling was changed so that the hardlink detection is in a separate FS instance and then FilterFS is layered on top of it. This means that the file that was the source for the hardlink could be filtered out, but the Stat pointing to that link is still sent as is. New function validates if source files are not present in FS anymore and correct the linking. It could be better if all the FS implementation did this automatically, but there is quite a lot of layering going on atm. with multiple layers of FilterFS that would all need to keep own hardlink memory, so atm. the new function is only called before send. Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com> * chore(deps): Bump docker/bake-action from 4 to 5 Bumps [docker/bake-action](https://github.com/docker/bake-action) from 4 to 5. - [Release notes](https://github.com/docker/bake-action/releases) - [Commits](docker/bake-action@v4...v5) --- updated-dependencies: - dependency-name: docker/bake-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> * Fixup fallout with new FS changed API * ci: switch to ubuntu runner for freebsd job Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> * deps: remove deprecated gogo proto This removes the deprecated gogo proto in favor of the standard implementation. Signed-off-by: Jonathan A. Sternberg <jonathan.sternberg@docker.com> * types: stat clone drops hidden proto fields The stat clone returned by protobuf returns a version of `types.Stat` that isn't compatible with some tests in buildkit. This changes clone to create a new type without cloning the hidden protobuf types. Signed-off-by: Jonathan A. Sternberg <jonathan.sternberg@docker.com> * update Go to 1.23 Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com> * update golangci-lint to 1.61.0 Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com> * update xx to v1.5.0 Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com> * add support for non-octal mode setting Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com> * protobuf: add vtproto to supplement protobuf marshaling This adds the vtproto generator to generate code that results in faster marshaling and unmarshaling. vtproto is similar to gogo but it generates additional code on top of the existing protobuf structures rather than changing the generator itself. Signed-off-by: Jonathan A. Sternberg <jonathan.sternberg@docker.com> * fix correcting timestamps for created destination dir after copy Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com> * Fixed build on OpenBSD This fixes docker/buildx#2772 * build and test openbsd Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> * bench: bump modules Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> * enable golangci-lint for supported platforms Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> * fix issues in .golangci.yml Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> * fix lint issues Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> * fixes for netbsd Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> * build and test netbsd Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> * chore(deps): Bump codecov/codecov-action from 4 to 5 Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 4 to 5. - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md) - [Commits](codecov/codecov-action@v4...v5) --- updated-dependencies: - dependency-name: codecov/codecov-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> * ci: fix deprecated input for codecov-action Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> * update xx to v1.6.1 for compatibility with alpine 3.21 and file 5.46+ This fixes compatibility with alpine 3.21 and file 5.46+ - Fix additional possible `xx-cc`/`xx-cargo` compatibility issue with Alpine 3.21 - Support for Alpine 3.21 - Fix `xx-verify` with `file` 5.46+ - Fix possible error taking lock in `xx-apk` in latest Alpine without `coreutils` full diff: tonistiigi/xx@v1.5.0...v1.6.1 Signed-off-by: Sebastiaan van Stijn <github@gone.nl> * fix error message for invalid includepatterns The patterns returned in the error message were missing the ones added via opts.FollowLinks Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com> * ci: update bake-action to v6 Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> * copy: fix custom chmod for parent directories Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com> * chore(deps): Bump nick-fields/retry from 3.0.0 to 3.0.2 Bumps [nick-fields/retry](https://github.com/nick-fields/retry) from 3.0.0 to 3.0.2. - [Release notes](https://github.com/nick-fields/retry/releases) - [Changelog](https://github.com/nick-fields/retry/blob/master/.releaserc.js) - [Commits](nick-fields/retry@7152eba...ce71cc2) --- updated-dependencies: - dependency-name: nick-fields/retry dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> * add gopls linter fixes Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com> * fix linter after merge conflict Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com> * copy: support for linux X mode Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com> * ci: install latest vagrant Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> * ci: infer go version from workflow for bsd tests Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> * ci: fix freebsd package repository Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> * Allow metadata-only receivers This optional mode allows skipping transferring the file data if remote side just hopes to analyze how the local files look like. Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com> * receive: add parent memory for metadata transfers This is needed because metadata-only parent may have a data file as a child. Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com> * stat: ignore apple extended attributes Extended attributes from `com.apple` will bust remote layer caches and shouldn't be transferred to a Linux environment. Skip loading these extended attributes as part of loading xattrs. Signed-off-by: Jonathan A. Sternberg <jonathan.sternberg@docker.com> * fix: send: use platform-specific root path Using "/" was causing a silent bug later on at `fs.go:121` that is expecting platform-specific separators. See discussion at moby/buildkit#6007 Fix this by using `\\` on Windows and `/` on unix. Signed-off-by: Anthony Nandaa <profnandaa@gmail.com> * ci: add CODEOWNERS * chore: tidy ci.yml --------- Signed-off-by: Kotaro Inoue <inoue.kotaro@linecorp.com> Signed-off-by: Erik Sipsma <erik@sipsma.dev> Signed-off-by: Kazuyoshi Kato <kato.kazuyoshi@gmail.com> Signed-off-by: Kotaro Inoue <k.musaino@gmail.com> Signed-off-by: Marat Radchenko <marat@slonopotamus.org> Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> Signed-off-by: Justin Chadwell <me@jedevc.com> Signed-off-by: Alex Couture-Beil <alex@earthly.dev> Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com> Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: Jonathan A. Sternberg <jonathan.sternberg@docker.com> Signed-off-by: Sebastiaan van Stijn <github@gone.nl> Signed-off-by: Anthony Nandaa <profnandaa@gmail.com> Co-authored-by: Kotaro Inoue <inoue.kotaro@linecorp.com> Co-authored-by: Erik Sipsma <erik@sipsma.dev> Co-authored-by: Kazuyoshi Kato <kato.kazuyoshi@gmail.com> Co-authored-by: Tõnis Tiigi <tonistiigi@gmail.com> Co-authored-by: Kotaro Inoue <k.musaino@gmail.com> Co-authored-by: Marat Radchenko <marat@slonopotamus.org> Co-authored-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> Co-authored-by: Justin Chadwell <me@jedevc.com> Co-authored-by: Alex Couture-Beil <alex@earthly.dev> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Nilesh Patra <nilesh@nileshpatra.info> Co-authored-by: Jonathan A. Sternberg <jonathan.sternberg@docker.com> Co-authored-by: Kirill A. Korinsky <kirill@korins.ky> Co-authored-by: Sebastiaan van Stijn <github@gone.nl> Co-authored-by: Anthony Nandaa <profnandaa@gmail.com>
1 parent 2ea1c94 commit fd33950

73 files changed

Lines changed: 4162 additions & 2930 deletions

Some content is hidden

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

.github/CODEOWNERS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# PRs require approval from the EarthBuild admin team
2+
* @EarthBuild/fork-admins

.github/dependabot.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "github-actions"
4+
open-pull-requests-limit: 10
5+
directory: "/"
6+
schedule:
7+
interval: "daily"
8+
labels:
9+
- "dependencies"
10+
- "bot"

.github/workflows/ci.yml

Lines changed: 107 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -5,35 +5,36 @@ concurrency:
55
cancel-in-progress: true
66

77
on:
8+
workflow_dispatch:
89
schedule:
910
- cron: '0 8 */6 * *' # every 6 days
1011
push:
1112
branches:
12-
- main
13-
- gh_test_ci
13+
- master
1414
pull_request:
15-
branches:
16-
- main
15+
16+
env:
17+
DESTDIR: ./bin
18+
GO_VERSION: "1.23"
1719

1820
jobs:
1921
validate:
2022
runs-on: ubuntu-latest
2123
strategy:
2224
matrix:
2325
target:
24-
- lint
26+
- lint-golangci-cross
27+
- lint-gopls-cross
28+
- validate-generated-files
2529
- validate-gomod
2630
- validate-shfmt
2731
steps:
28-
-
29-
name: Checkout
30-
uses: actions/checkout@v3
3132
-
3233
name: Set up Docker Buildx
33-
uses: docker/setup-buildx-action@v2
34+
uses: docker/setup-buildx-action@v3
3435
-
3536
name: Run
36-
uses: docker/bake-action@v3
37+
uses: docker/bake-action@v6
3738
with:
3839
targets: ${{ matrix.target }}
3940

@@ -45,85 +46,145 @@ jobs:
4546
- build
4647
- cross
4748
steps:
48-
-
49-
name: Checkout
50-
uses: actions/checkout@v3
5149
-
5250
name: Set up Docker Buildx
53-
uses: docker/setup-buildx-action@v2
51+
uses: docker/setup-buildx-action@v3
5452
-
5553
name: Run
56-
uses: docker/bake-action@v3
54+
uses: docker/bake-action@v6
5755
with:
5856
targets: ${{ matrix.target }}
5957

6058
test:
6159
runs-on: ubuntu-latest
6260
strategy:
6361
matrix:
64-
go_version:
65-
- "1.19"
66-
- "1.20"
62+
go:
63+
- "1.23"
64+
- "1.22"
65+
- "1.21"
66+
mode:
67+
- "root"
68+
- "noroot"
6769
env:
68-
GO_VERSION: ${{ matrix.go_version }}
70+
GO_VERSION: ${{ matrix.go }}
6971
steps:
70-
-
71-
name: Checkout
72-
uses: actions/checkout@v3
7372
-
7473
name: Set up Docker Buildx
75-
uses: docker/setup-buildx-action@v2
74+
uses: docker/setup-buildx-action@v3
7675
-
7776
name: Test
78-
uses: docker/bake-action@v3
77+
uses: docker/bake-action@v6
78+
with:
79+
targets: test-${{ matrix.mode }}
80+
-
81+
name: Upload coverage
82+
uses: codecov/codecov-action@v5
83+
# skip the step for EarthBuild
84+
if: false
7985
with:
80-
targets: test
86+
directory: ${{ env.DESTDIR }}/coverage
87+
flags: unit,${{ matrix.mode }},go-${{ matrix.go }}
88+
token: ${{ secrets.CODECOV_TOKEN }}
8189

82-
test-macos:
83-
runs-on: macos-latest
90+
test-os:
91+
runs-on: ${{ matrix.os }}
8492
strategy:
8593
fail-fast: false
8694
matrix:
95+
os:
96+
- macos-latest
97+
- windows-latest
8798
go:
88-
- "1.19"
89-
- "1.20"
99+
- "1.23"
100+
- "1.22"
101+
- "1.21"
90102
steps:
91103
-
92104
name: Checkout
93-
uses: actions/checkout@v3
105+
uses: actions/checkout@v4
94106
-
95107
name: Set up Go
96-
uses: actions/setup-go@v4
108+
uses: actions/setup-go@v5
97109
with:
98110
go-version: ${{ matrix.go }}
99111
-
100112
name: Test
101113
run: |
102-
go test ./...
114+
go test -coverprofile="coverage.txt" -covermode="atomic" ./...
115+
go tool cover -func="coverage.txt"
116+
-
117+
name: Upload coverage
118+
# skip the step for EarthBuild
119+
if: false
120+
uses: codecov/codecov-action@v5
121+
with:
122+
files: ./coverage.txt
123+
env_vars: RUNNER_OS
124+
flags: unit,go-${{ matrix.go }}
125+
token: ${{ secrets.CODECOV_TOKEN }}
103126

104-
test-freebsd-amd64:
105-
# TODO(jhorsts): macOS latest (v10.15) used to contain vagrant but not anymore.
106-
# The comment can be removed when the latest fsutil is merged into this repo.
107-
if: false
108-
runs-on: macos-latest
109-
timeout-minutes: 60
110-
env:
111-
VAGRANT_VAGRANTFILE: hack/Vagrantfile.freebsd13
127+
test-bsd-amd64:
128+
runs-on: ubuntu-22.04
129+
strategy:
130+
fail-fast: false
131+
matrix:
132+
os:
133+
- freebsd
134+
- netbsd
135+
- openbsd
112136
steps:
137+
-
138+
name: Prepare
139+
run: |
140+
echo "VAGRANT_FILE=hack/Vagrantfile.${{ matrix.os }}" >> $GITHUB_ENV
141+
142+
# Sets semver Go version to be able to download tarball during vagrant setup
143+
goVersion=$(curl --silent "https://go.dev/dl/?mode=json&include=all" | jq -r '.[].files[].version' | uniq | sed -e 's/go//' | sort -V | grep $GO_VERSION | tail -1)
144+
echo "GO_VERSION=$goVersion" >> $GITHUB_ENV
113145
-
114146
name: Checkout
115-
uses: actions/checkout@v3
147+
uses: actions/checkout@v4
116148
-
117149
name: Cache Vagrant boxes
118-
uses: actions/cache@v3
150+
uses: actions/cache@v4
119151
with:
120152
path: ~/.vagrant.d/boxes
121-
key: ${{ runner.os }}-vagrant-${{ hashFiles('hack/Vagrantfile.freebsd13') }}
153+
key: ${{ runner.os }}-vagrant-${{ matrix.os }}-${{ hashFiles(env.VAGRANT_FILE) }}
122154
restore-keys: |
123-
${{ runner.os }}-vagrant-
155+
${{ runner.os }}-vagrant-${{ matrix.os }}-
156+
-
157+
name: Install vagrant
158+
run: |
159+
set -x
160+
wget -O - https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg
161+
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list
162+
sudo apt-get update
163+
sudo apt-get install -y libvirt-dev libvirt-daemon libvirt-daemon-system vagrant vagrant-libvirt ruby-libvirt
164+
sudo systemctl enable --now libvirtd
165+
sudo chmod a+rw /var/run/libvirt/libvirt-sock
166+
vagrant plugin install vagrant-libvirt
167+
vagrant --version
124168
-
125169
name: Set up vagrant
126-
run: vagrant up
170+
run: |
171+
ln -sf ${{ env.VAGRANT_FILE }} Vagrantfile
172+
vagrant up --no-tty
127173
-
128174
name: Test
129-
run: vagrant ssh -- "cd /vagrant; go test -buildvcs=false ./..."
175+
uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3.0.2
176+
with:
177+
timeout_minutes: 20
178+
max_attempts: 5
179+
command: |
180+
vagrant ssh -- "cd /vagrant; go test -buildvcs=false -coverprofile=coverage.txt -covermode=atomic ./..."
181+
vagrant ssh -c "sudo cat /vagrant/coverage.txt" > coverage.txt
182+
-
183+
name: Upload coverage
184+
# skip the step for EarthBuild
185+
if: false
186+
uses: codecov/codecov-action@v5
187+
with:
188+
files: ./coverage.txt
189+
flags: unit,${{ matrix.os }}
190+
token: ${{ secrets.CODECOV_TOKEN }}

.gitignore

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
# if you want to ignore files created by your editor/tools, consider using a
22
# global .gitignore or .git/info/exclude see https://help.github.com/articles/ignoring-files
3-
.*
4-
!.github
5-
!.gitignore
6-
!.travis.yml
7-
*.prof
3+
bin/
84
# support running go modules in vendor mode for local development
95
vendor/

.golangci.yml

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
run:
2-
timeout: 10m
3-
skip-files:
4-
- ".*\\.pb\\.go$"
2+
timeout: 30m
53

64
linters:
75
enable:
@@ -14,3 +12,21 @@ linters:
1412
- staticcheck
1513
- typecheck
1614
disable-all: true
15+
16+
linters-settings:
17+
depguard:
18+
rules:
19+
main:
20+
deny:
21+
# The io/ioutil package has been deprecated.
22+
# https://go.dev/doc/go1.16#ioutil
23+
- pkg: "io/ioutil"
24+
desc: The io/ioutil package has been deprecated.
25+
26+
issues:
27+
exclude-files:
28+
- ".*\\.pb\\.go$"
29+
30+
# show all
31+
max-issues-per-linter: 0
32+
max-same-issues: 0

Dockerfile

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
#syntax=docker/dockerfile:1
2-
ARG GO_VERSION=1.20
1+
# syntax=docker/dockerfile:1
32

4-
FROM --platform=$BUILDPLATFORM tonistiigi/xx:1.1.0 AS xx
3+
ARG GO_VERSION=1.23
4+
ARG XX_VERSION=1.6.1
5+
6+
FROM --platform=$BUILDPLATFORM tonistiigi/xx:${XX_VERSION} AS xx
57

68
FROM --platform=$BUILDPLATFORM golang:${GO_VERSION}-alpine AS base
79
RUN apk add --no-cache git
@@ -18,13 +20,19 @@ FROM base AS test
1820
ARG TESTFLAGS
1921
RUN --mount=target=. --mount=target=/go/pkg/mod,type=cache \
2022
--mount=target=/root/.cache,type=cache \
21-
CGO_ENABLED=0 xx-go test -test.v ${TESTFLAGS} ./...
23+
CGO_ENABLED=0 xx-go test -v -coverprofile=/tmp/coverage.txt -covermode=atomic ${TESTFLAGS} ./...
2224

2325
FROM base AS test-noroot
2426
RUN mkdir /go/pkg && chmod 0777 /go/pkg
2527
USER 1000:1000
2628
RUN --mount=target=. \
2729
--mount=target=/tmp/.cache,type=cache \
28-
CGO_ENABLED=0 GOCACHE=/tmp/gocache xx-go test -test.v ./...
30+
CGO_ENABLED=0 GOCACHE=/tmp/gocache xx-go test -v -coverprofile=/tmp/coverage.txt -covermode=atomic ./...
31+
32+
FROM scratch AS test-coverage
33+
COPY --from=test /tmp/coverage.txt /coverage-root.txt
34+
35+
FROM scratch AS test-noroot-coverage
36+
COPY --from=test-noroot /tmp/coverage.txt /coverage-noroot.txt
2937

3038
FROM build

bench/diffcopy.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,11 @@ func diffCopy(proto bool, src, dest string) error {
2121
}
2222

2323
eg.Go(func() error {
24-
return fsutil.Send(ctx, s1, fsutil.NewFS(src, nil), nil, nil)
24+
fs, err := fsutil.NewFS(src)
25+
if err != nil {
26+
panic(err)
27+
}
28+
return fsutil.Send(ctx, s1, fs, nil, nil)
2529
})
2630
eg.Go(func() error {
2731
return fsutil.Receive(ctx, s2, dest, fsutil.ReceiveOpt{})

bench/go.mod

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,30 @@
11
module github.com/tonistiigi/fsutil/bench
22

3-
go 1.19
3+
go 1.21
44

55
require (
6-
github.com/containerd/continuity v0.4.1
7-
github.com/docker/docker v20.10.18+incompatible
6+
github.com/containerd/continuity v0.4.4
7+
github.com/docker/docker v27.3.1+incompatible
88
github.com/pkg/errors v0.9.1
99
github.com/tonistiigi/fsutil v0.0.0-00010101000000-000000000000
10-
golang.org/x/sync v0.1.0
10+
golang.org/x/sync v0.8.0
1111
)
1212

1313
require (
14-
github.com/Microsoft/go-winio v0.5.2 // indirect
15-
github.com/Microsoft/hcsshim v0.8.17 // indirect
16-
github.com/containerd/cgroups v1.0.1 // indirect
17-
github.com/containerd/containerd v1.5.2 // indirect
18-
github.com/docker/go-units v0.4.0 // indirect
19-
github.com/gogo/protobuf v1.3.2 // indirect
20-
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect
14+
github.com/AdaLogics/go-fuzz-headers v0.0.0-20240806141605-e8a1dd7889d6 // indirect
15+
github.com/Microsoft/go-winio v0.6.2 // indirect
16+
github.com/containerd/log v0.1.0 // indirect
17+
github.com/klauspost/compress v1.11.13 // indirect
2118
github.com/moby/patternmatcher v0.5.0 // indirect
22-
github.com/moby/sys/mount v0.2.0 // indirect
23-
github.com/moby/sys/mountinfo v0.4.1 // indirect
19+
github.com/moby/sys/sequential v0.6.0 // indirect
20+
github.com/moby/sys/user v0.3.0 // indirect
21+
github.com/moby/sys/userns v0.1.0 // indirect
2422
github.com/opencontainers/go-digest v1.0.0 // indirect
25-
github.com/opencontainers/image-spec v1.0.1 // indirect
26-
github.com/opencontainers/runc v1.0.0-rc93 // indirect
27-
github.com/sirupsen/logrus v1.8.1 // indirect
28-
go.opencensus.io v0.22.3 // indirect
29-
golang.org/x/sys v0.1.0 // indirect
30-
google.golang.org/protobuf v1.26.0 // indirect
23+
github.com/planetscale/vtprotobuf v0.6.0 // indirect
24+
github.com/sirupsen/logrus v1.9.3 // indirect
25+
golang.org/x/sys v0.26.0 // indirect
26+
google.golang.org/protobuf v1.35.1 // indirect
27+
gotest.tools/v3 v3.0.3 // indirect
3128
)
3229

3330
replace github.com/tonistiigi/fsutil => ../

0 commit comments

Comments
 (0)