Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to latest buildkit and associated dependencies #352

Merged
merged 4 commits into from
Oct 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ jobs:
# expression language does not support ternary, so hack it via indexing boolean keys of an json object
runs-on: ${{ fromJSON('{true:"buildkitd",false:"ubuntu-latest"}')[github.repository == 'openllb/hlb'] }}
steps:
- name: Set up Go 1.19
- name: Set up Go 1.21
uses: actions/setup-go@v2
with:
go-version: ^1.19
go-version: ^1.21
id: go

- name: Check out code into the Go module directory
Expand Down
1 change: 0 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ linters:
enable-all: false
disable-all: true
enable:
- depguard
- gofmt
- goimports
- gosimple
Expand Down
22 changes: 15 additions & 7 deletions codegen/builtin_fs.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import (
"github.com/moby/buildkit/client"
"github.com/moby/buildkit/client/llb"
gateway "github.com/moby/buildkit/frontend/gateway/client"
"github.com/moby/buildkit/session/filesync"
"github.com/moby/buildkit/solver/pb"
specs "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/openllb/hlb/errdefs"
Expand Down Expand Up @@ -100,7 +99,7 @@ func (i Image) Call(ctx context.Context, cln *client.Client, val Value, opts Opt
}
)
if resolver != nil {
dgst, config, err := resolver.ResolveImageConfig(ctx, ref, resolveOpt)
_, dgst, config, err := resolver.ResolveImageConfig(ctx, ref, resolveOpt)
if err != nil {
return nil, Arg(ctx, 0).WithError(err)
}
Expand Down Expand Up @@ -258,14 +257,22 @@ func (l Local) Call(ctx context.Context, cln *client.Client, val Value, opts Opt
State: st,
Platform: DefaultPlatform(ctx),
}
fs.SessionOpts = append(fs.SessionOpts, llbutil.WithSyncedDir(localPath, filesync.SyncedDir{
Dir: localDir,

syncedDirFS, err := fsutil.NewFS(localDir)
if err != nil {
return nil, err
}
syncedDirFS, err = fsutil.NewFilterFS(syncedDirFS, &fsutil.FilterOpt{
Map: func(_ string, st *fstypes.Stat) fsutil.MapResult {
st.Uid = 0
st.Gid = 0
return fsutil.MapResultKeep
},
}))
})
if err != nil {
return nil, err
}
fs.SessionOpts = append(fs.SessionOpts, llbutil.WithSyncedDir(localPath, syncedDirFS))

return NewValue(ctx, fs)
}
Expand Down Expand Up @@ -1004,8 +1011,9 @@ func (dl DockerLoad) Call(ctx context.Context, cln *client.Client, val Value, op
}

pw := mw.WithPrefix("", false)
progress.FromReader(pw, fmt.Sprintf("importing %s to docker", ref), resp.Body)
return nil
return progress.Wrap(fmt.Sprintf("importing %s to docker", ref), pw.Write, func(l progress.SubLogger) error {
return solver.ProgressFromReader(l, resp.Body)
})
})

fs, err := val.Filesystem()
Expand Down
13 changes: 9 additions & 4 deletions codegen/resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,12 @@ type cachedImageResolver struct {
}

type imageConfig struct {
ref string
dgst digest.Digest
config []byte
}

func (r *cachedImageResolver) ResolveImageConfig(ctx context.Context, ref string, opt llb.ResolveImageConfigOpt) (dgst digest.Digest, config []byte, err error) {
func (r *cachedImageResolver) ResolveImageConfig(ctx context.Context, ref string, opt llb.ResolveImageConfigOpt) (resolvedRef string, dgst digest.Digest, config []byte, err error) {
key := cacheKey{ref: ref}
if opt.Platform != nil {
key.os = opt.Platform.OS
Expand All @@ -61,7 +62,7 @@ func (r *cachedImageResolver) ResolveImageConfig(ctx context.Context, ref string
cfg, ok := r.cache[key]
r.mu.RUnlock()
if ok {
return cfg.dgst, cfg.config, nil
return cfg.ref, cfg.dgst, cfg.config, nil
}

s, err := llbutil.NewSession(ctx)
Expand All @@ -85,7 +86,7 @@ func (r *cachedImageResolver) ResolveImageConfig(ctx context.Context, ref string
}

return solver.Build(ctx, r.cln, s, pw, func(ctx context.Context, c gateway.Client) (res *gateway.Result, err error) {
dgst, config, err = c.ResolveImageConfig(ctx, ref, opt)
resolvedRef, dgst, config, err = c.ResolveImageConfig(ctx, ref, opt)
return gateway.NewResult(), err
})
})
Expand All @@ -96,7 +97,11 @@ func (r *cachedImageResolver) ResolveImageConfig(ctx context.Context, ref string
}

r.mu.Lock()
r.cache[key] = &imageConfig{dgst, config}
r.cache[key] = &imageConfig{
ref: resolvedRef,
dgst: dgst,
config: config,
}
r.mu.Unlock()
return
}
6 changes: 3 additions & 3 deletions go.hlb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ string versionCmd() {
}

fs golang() {
image "golang:1.19-alpine"
image "golang:1.21-alpine"
}

fs build(fs src, string package, string verPackage) {
Expand All @@ -28,7 +28,7 @@ fs build(fs src, string package, string verPackage) {
pipeline crossBinaries(fs src, string package, string verPackage) {
go.buildCommonWithOptions src package option::template {
stringField "base" "docker.elastic.co/beats-dev/golang-crossbuild"
stringField "goVersion" "1.19.3"
stringField "goVersion" "1.21.3"
stringField "goBuildFlags" "-ldflags \"-X ${verPackage}.Version=$(${versionCmd})\""
} option::run {
env "CGO_ENABLED" "0"
Expand All @@ -38,7 +38,7 @@ pipeline crossBinaries(fs src, string package, string verPackage) {
fs lint(fs src) {
golang
run "apk add -U git gcc libc-dev"
run "sh /golangci/install.sh -b /usr/bin v1.50.1" with option {
run "sh /golangci/install.sh -b /usr/bin v1.55.0" with option {
mount http("https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh") "/golangci"
}
env "GO111MODULE" "on"
Expand Down
124 changes: 70 additions & 54 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,109 +6,125 @@ require (
github.com/alecthomas/participle/v2 v2.0.0-alpha7.0.20211230082035-5a357f57e525
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e
github.com/containerd/console v1.0.3
github.com/containerd/containerd v1.6.14
github.com/containerd/containerd v1.7.7
github.com/creachadair/jrpc2 v0.26.1
github.com/creack/pty v1.1.11
github.com/docker/buildx v0.10.0
github.com/docker/cli v23.0.0-rc.1+incompatible
github.com/docker/distribution v2.8.1+incompatible
github.com/docker/docker v23.0.0-rc.1+incompatible
github.com/creack/pty v1.1.18
github.com/docker/buildx v0.11.1-0.20231023141442-390eedc50ba8
github.com/docker/cli v24.0.5+incompatible
github.com/docker/distribution v2.8.2+incompatible
github.com/docker/docker v24.0.5+incompatible
github.com/google/go-dap v0.6.0
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51
github.com/lithammer/dedent v1.1.0
github.com/logrusorgru/aurora v0.0.0-20191116043053-66b7ad493a23
github.com/mattn/go-isatty v0.0.14
github.com/moby/buildkit v0.11.0
github.com/moby/buildkit v0.13.0-beta1.0.20231023220200-20847b7c8306
github.com/opencontainers/go-digest v1.0.0
github.com/opencontainers/image-spec v1.1.0-rc2
github.com/opencontainers/image-spec v1.1.0-rc5
github.com/openllb/doxygen-parser v0.0.0-20201031162929-e0b5cceb2d0c
github.com/pkg/errors v0.9.1
github.com/sourcegraph/go-lsp v0.0.0-20200117082640-b19bb38222e2
github.com/stretchr/testify v1.8.1
github.com/tonistiigi/fsutil v0.0.0-20230105215944-fb433841cbfa
github.com/stretchr/testify v1.8.4
github.com/tonistiigi/fsutil v0.0.0-20230825212630-f09800878302
github.com/urfave/cli/v2 v2.3.0
github.com/xlab/treeprint v1.0.0
golang.org/x/crypto v0.2.0
golang.org/x/sync v0.1.0
golang.org/x/sys v0.3.0
google.golang.org/grpc v1.50.1
golang.org/x/crypto v0.14.0
golang.org/x/sync v0.3.0
golang.org/x/sys v0.13.0
google.golang.org/grpc v1.53.0
)

require (
cloud.google.com/go v0.75.0 // indirect
github.com/AdaLogics/go-fuzz-headers v0.0.0-20230811130428-ced1acdcaa24 // indirect
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect
github.com/Microsoft/go-winio v0.5.2 // indirect
github.com/Microsoft/go-winio v0.6.1 // indirect
github.com/Microsoft/hcsshim v0.11.1 // indirect
github.com/alecthomas/participle v1.0.0-alpha1.0.20201031050245-4435aeea334f // indirect
github.com/aws/aws-sdk-go-v2 v1.17.6 // indirect
github.com/aws/aws-sdk-go-v2/config v1.18.16 // indirect
github.com/aws/aws-sdk-go-v2/credentials v1.13.16 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.24 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.30 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.24 // indirect
github.com/aws/aws-sdk-go-v2/internal/ini v1.3.31 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.24 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.12.5 // indirect
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.14.5 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.18.6 // indirect
github.com/aws/smithy-go v1.13.5 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/containerd/continuity v0.3.0 // indirect
github.com/containerd/ttrpc v1.1.0 // indirect
github.com/containerd/typeurl v1.0.2 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/containerd/continuity v0.4.2 // indirect
github.com/containerd/log v0.1.0 // indirect
github.com/containerd/ttrpc v1.2.2 // indirect
github.com/containerd/typeurl/v2 v2.1.1 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/distribution/reference v0.5.0 // indirect
github.com/docker/docker-credential-helpers v0.7.0 // indirect
github.com/docker/go v1.5.1-1.0.20160303222718-d30aec9fd63c // indirect
github.com/docker/go-connections v0.4.0 // indirect
github.com/docker/go-metrics v0.0.1 // indirect
github.com/docker/go-units v0.5.0 // indirect
github.com/felixge/httpsnoop v1.0.2 // indirect
github.com/felixge/httpsnoop v1.0.3 // indirect
github.com/fvbommel/sortorder v1.0.2 // indirect
github.com/go-logr/logr v1.2.3 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/gofrs/flock v0.8.1 // indirect
github.com/gofrs/uuid v4.3.1+incompatible // indirect
github.com/gogo/googleapis v1.4.1 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
github.com/gorilla/mux v1.8.0 // indirect
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect
github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/inconshreveable/mousetrap v1.0.1 // indirect
github.com/klauspost/compress v1.15.12 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.11.3 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/in-toto/in-toto-golang v0.5.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/klauspost/compress v1.17.2 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/miekg/pkcs11 v1.1.1 // indirect
github.com/moby/locker v1.0.1 // indirect
github.com/moby/patternmatcher v0.5.0 // indirect
github.com/moby/patternmatcher v0.6.0 // indirect
github.com/moby/sys/sequential v0.5.0 // indirect
github.com/moby/sys/signal v0.7.0 // indirect
github.com/moby/term v0.0.0-20221120202655-abb19827d345 // indirect
github.com/moby/term v0.5.0 // indirect
github.com/morikuni/aec v1.0.0 // indirect
github.com/pelletier/go-toml v1.9.5 // indirect
github.com/pelletier/go-toml/v2 v2.0.6 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_golang v1.14.0 // indirect
github.com/prometheus/client_model v0.3.0 // indirect
github.com/prometheus/common v0.37.0 // indirect
github.com/prometheus/procfs v0.8.0 // indirect
github.com/prometheus/common v0.42.0 // indirect
github.com/prometheus/procfs v0.9.0 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/sirupsen/logrus v1.9.0 // indirect
github.com/spf13/afero v1.9.3 // indirect
github.com/spf13/cobra v1.6.1 // indirect
github.com/secure-systems-lab/go-securesystemslib v0.4.0 // indirect
github.com/shibumi/go-pathspec v1.3.0 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/spf13/cobra v1.7.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/subosito/gotenv v1.4.2 // indirect
github.com/theupdateframework/notary v0.7.0 // indirect
github.com/tonistiigi/units v0.0.0-20180711220420-6950e57a87ea // indirect
github.com/tonistiigi/vt100 v0.0.0-20210615222946-8066bb97264f // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.29.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.29.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.29.0 // indirect
go.opentelemetry.io/otel v1.4.1 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.4.1 // indirect
go.opentelemetry.io/otel/internal/metric v0.27.0 // indirect
go.opentelemetry.io/otel/metric v0.27.0 // indirect
go.opentelemetry.io/otel/sdk v1.4.1 // indirect
go.opentelemetry.io/otel/trace v1.4.1 // indirect
go.opentelemetry.io/proto/otlp v0.12.0 // indirect
golang.org/x/net v0.4.0 // indirect
golang.org/x/term v0.3.0 // indirect
golang.org/x/text v0.5.0 // indirect
golang.org/x/time v0.1.0 // indirect
google.golang.org/genproto v0.0.0-20221024183307-1bc688fe9f3e // indirect
google.golang.org/protobuf v1.28.1 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
github.com/tonistiigi/vt100 v0.0.0-20230623042737-f9a4f7ef6531 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.40.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.40.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.40.0 // indirect
go.opentelemetry.io/otel v1.14.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.14.0 // indirect
go.opentelemetry.io/otel/metric v0.37.0 // indirect
go.opentelemetry.io/otel/sdk v1.14.0 // indirect
go.opentelemetry.io/otel/trace v1.14.0 // indirect
go.opentelemetry.io/proto/otlp v0.19.0 // indirect
golang.org/x/mod v0.11.0 // indirect
golang.org/x/net v0.17.0 // indirect
golang.org/x/term v0.13.0 // indirect
golang.org/x/text v0.13.0 // indirect
golang.org/x/time v0.3.0 // indirect
golang.org/x/tools v0.7.0 // indirect
google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4 // indirect
google.golang.org/protobuf v1.30.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
gotest.tools/v3 v3.5.1 // indirect
)

replace github.com/sourcegraph/go-lsp => github.com/radeksimko/go-lsp v0.0.0-20200223162147-9f2c54f29c9f
Expand Down
Loading
Loading