mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-08-23 20:19:08 +08:00
Compare commits
6 Commits
v0.9.0-rc2
...
v0.9.0
Author | SHA1 | Date | |
---|---|---|---|
![]() |
611329fc7f | ||
![]() |
f3c135e583 | ||
![]() |
7f84582b37 | ||
![]() |
17d4369866 | ||
![]() |
fb5e1393a4 | ||
![]() |
18dbde9ed6 |
@@ -59,7 +59,7 @@ var (
|
||||
)
|
||||
|
||||
const (
|
||||
printFallbackImage = "docker/dockerfile-upstream:1.4-outline@sha256:ccd574ab34a8875c64bb6a8fb3cfae2e6d62d31b28b9f688075cc14c9b669a59"
|
||||
printFallbackImage = "docker/dockerfile-upstream:1.4-outline@sha256:627443ff4e2d0f635d429cfc1da5388bcd5a70949c38adcd3cd7c4e5df67c73c"
|
||||
)
|
||||
|
||||
type Options struct {
|
||||
|
@@ -701,7 +701,7 @@ func (w *wrapped) Unwrap() error {
|
||||
}
|
||||
|
||||
func isExperimental() bool {
|
||||
if v, ok := os.LookupEnv("BUILDKIT_EXPERIMENTAL"); ok {
|
||||
if v, ok := os.LookupEnv("BUILDX_EXPERIMENTAL"); ok {
|
||||
vv, _ := strconv.ParseBool(v)
|
||||
return vv
|
||||
}
|
||||
|
@@ -135,8 +135,8 @@ func runCreate(dockerCli command.Cli, in createOptions, args []string) error {
|
||||
}
|
||||
}
|
||||
|
||||
if driver.GetFactory(driverName, true) == nil {
|
||||
return errors.Errorf("failed to find driver %q", driverName)
|
||||
if _, err := driver.GetFactory(driverName, true); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
ngOriginal := ng
|
||||
@@ -282,7 +282,7 @@ func createCmd(dockerCli command.Cli) *cobra.Command {
|
||||
var options createOptions
|
||||
|
||||
var drivers bytes.Buffer
|
||||
for _, d := range driver.GetFactories() {
|
||||
for _, d := range driver.GetFactories(true) {
|
||||
if len(drivers.String()) > 0 {
|
||||
drivers.WriteString(", ")
|
||||
}
|
||||
|
@@ -60,8 +60,9 @@ func driversForNodeGroup(ctx context.Context, dockerCli command.Cli, ng *store.N
|
||||
|
||||
var f driver.Factory
|
||||
if ng.Driver != "" {
|
||||
f = driver.GetFactory(ng.Driver, true)
|
||||
if f == nil {
|
||||
var err error
|
||||
f, err = driver.GetFactory(ng.Driver, true)
|
||||
if err != nil {
|
||||
return nil, errors.Errorf("failed to find driver %q", f)
|
||||
}
|
||||
} else {
|
||||
|
@@ -15,7 +15,7 @@ Create a new builder instance
|
||||
| `--bootstrap` | | | Boot builder after creation |
|
||||
| [`--buildkitd-flags`](#buildkitd-flags) | `string` | | Flags for buildkitd daemon |
|
||||
| [`--config`](#config) | `string` | | BuildKit config file |
|
||||
| [`--driver`](#driver) | `string` | | Driver to use (available: `docker`, `docker-container`, `kubernetes`, `remote`) |
|
||||
| [`--driver`](#driver) | `string` | | Driver to use (available: `docker-container`, `kubernetes`, `remote`) |
|
||||
| [`--driver-opt`](#driver-opt) | `stringArray` | | Options for the driver |
|
||||
| [`--leave`](#leave) | | | Remove a node from builder instead of changing it |
|
||||
| [`--name`](#name) | `string` | | Builder instance name |
|
||||
|
@@ -92,16 +92,16 @@ func GetDefaultFactory(ctx context.Context, ep string, c dockerclient.APIClient,
|
||||
return dd[0].f, nil
|
||||
}
|
||||
|
||||
func GetFactory(name string, instanceRequired bool) Factory {
|
||||
func GetFactory(name string, instanceRequired bool) (Factory, error) {
|
||||
for _, f := range drivers {
|
||||
if instanceRequired && !f.AllowsInstances() {
|
||||
continue
|
||||
}
|
||||
if f.Name() == name {
|
||||
return f
|
||||
if instanceRequired && !f.AllowsInstances() {
|
||||
return nil, errors.Errorf("additional instances of driver %q cannot be created", name)
|
||||
}
|
||||
return f, nil
|
||||
}
|
||||
}
|
||||
return nil
|
||||
return nil, errors.Errorf("failed to find driver %q", name)
|
||||
}
|
||||
|
||||
func GetDriver(ctx context.Context, name string, f Factory, endpointAddr string, api dockerclient.APIClient, auth Auth, kcc KubeClientConfig, flags []string, files map[string][]byte, do map[string]string, platforms []specs.Platform, contextPathHash string) (Driver, error) {
|
||||
@@ -131,9 +131,12 @@ func GetDriver(ctx context.Context, name string, f Factory, endpointAddr string,
|
||||
return &cachedDriver{Driver: d}, nil
|
||||
}
|
||||
|
||||
func GetFactories() []Factory {
|
||||
func GetFactories(instanceRequired bool) []Factory {
|
||||
ds := make([]Factory, 0, len(drivers))
|
||||
for _, d := range drivers {
|
||||
if instanceRequired && !d.AllowsInstances() {
|
||||
continue
|
||||
}
|
||||
ds = append(ds, d)
|
||||
}
|
||||
sort.Slice(ds, func(i, j int) bool {
|
||||
|
2
go.mod
2
go.mod
@@ -15,7 +15,7 @@ require (
|
||||
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510
|
||||
github.com/hashicorp/go-cty-funcs v0.0.0-20200930094925-2721b1e36840
|
||||
github.com/hashicorp/hcl/v2 v2.8.2
|
||||
github.com/moby/buildkit v0.10.1-0.20220809151411-8488654e899b
|
||||
github.com/moby/buildkit v0.10.1-0.20220816171719-55ba9d14360a
|
||||
github.com/morikuni/aec v1.0.0
|
||||
github.com/opencontainers/go-digest v1.0.0
|
||||
github.com/opencontainers/image-spec v1.0.3-0.20211202183452-c5a74bcca799
|
||||
|
4
go.sum
4
go.sum
@@ -411,8 +411,8 @@ github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7/go.mod h1:ZX
|
||||
github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
|
||||
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
|
||||
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
|
||||
github.com/moby/buildkit v0.10.1-0.20220809151411-8488654e899b h1:F/f/Ixaw8REoF5EjkMLh/2RBrsP0jeCPGBlczfqy9aw=
|
||||
github.com/moby/buildkit v0.10.1-0.20220809151411-8488654e899b/go.mod h1:Wa+LkeUQ9NJTVXTAY38rhkfKVQcuCIo2fbavRSuGsbI=
|
||||
github.com/moby/buildkit v0.10.1-0.20220816171719-55ba9d14360a h1:NI01Z14Hbwo1MHq8ylu4HNkmKGnhk8UZsD6c6FVMcA8=
|
||||
github.com/moby/buildkit v0.10.1-0.20220816171719-55ba9d14360a/go.mod h1:Wa+LkeUQ9NJTVXTAY38rhkfKVQcuCIo2fbavRSuGsbI=
|
||||
github.com/moby/locker v1.0.1 h1:fOXqR41zeveg4fFODix+1Ch4mj/gT0NE1XJbp/epuBg=
|
||||
github.com/moby/locker v1.0.1/go.mod h1:S7SDdo5zpBK84bzzVlKr2V0hz+7x9hWbYC/kq7oQppc=
|
||||
github.com/moby/spdystream v0.2.0 h1:cjW1zVyyoiM0T7b6UoySUFqzXMoqRckQtXwGPiBhOM8=
|
||||
|
8
vendor/github.com/moby/buildkit/frontend/subrequests/outline/outline.go
generated
vendored
8
vendor/github.com/moby/buildkit/frontend/subrequests/outline/outline.go
generated
vendored
@@ -101,7 +101,7 @@ func PrintOutline(dt []byte, w io.Writer) error {
|
||||
fmt.Fprintf(tw, "DESCRIPTION:\t%s\n", o.Description)
|
||||
}
|
||||
tw.Flush()
|
||||
fmt.Println()
|
||||
fmt.Fprintln(tw)
|
||||
}
|
||||
|
||||
if len(o.Args) > 0 {
|
||||
@@ -111,7 +111,7 @@ func PrintOutline(dt []byte, w io.Writer) error {
|
||||
fmt.Fprintf(tw, "%s\t%s\t%s\n", a.Name, a.Value, a.Description)
|
||||
}
|
||||
tw.Flush()
|
||||
fmt.Println()
|
||||
fmt.Fprintln(tw)
|
||||
}
|
||||
|
||||
if len(o.Secrets) > 0 {
|
||||
@@ -125,7 +125,7 @@ func PrintOutline(dt []byte, w io.Writer) error {
|
||||
fmt.Fprintf(tw, "%s\t%s\n", s.Name, b)
|
||||
}
|
||||
tw.Flush()
|
||||
fmt.Println()
|
||||
fmt.Fprintln(tw)
|
||||
}
|
||||
|
||||
if len(o.SSH) > 0 {
|
||||
@@ -139,7 +139,7 @@ func PrintOutline(dt []byte, w io.Writer) error {
|
||||
fmt.Fprintf(tw, "%s\t%s\n", s.Name, b)
|
||||
}
|
||||
tw.Flush()
|
||||
fmt.Println()
|
||||
fmt.Fprintln(tw)
|
||||
}
|
||||
|
||||
return nil
|
||||
|
17
vendor/github.com/moby/buildkit/util/progress/progress.go
generated
vendored
17
vendor/github.com/moby/buildkit/util/progress/progress.go
generated
vendored
@@ -274,3 +274,20 @@ func (pw *noOpWriter) Write(_ string, _ interface{}) error {
|
||||
func (pw *noOpWriter) Close() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func OneOff(ctx context.Context, id string) func(err error) error {
|
||||
pw, _, _ := NewFromContext(ctx)
|
||||
now := time.Now()
|
||||
st := Status{
|
||||
Started: &now,
|
||||
}
|
||||
pw.Write(id, st)
|
||||
return func(err error) error {
|
||||
// TODO: set error on status
|
||||
now := time.Now()
|
||||
st.Completed = &now
|
||||
pw.Write(id, st)
|
||||
pw.Close()
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
2
vendor/modules.txt
vendored
2
vendor/modules.txt
vendored
@@ -358,7 +358,7 @@ github.com/mitchellh/go-wordwrap
|
||||
# github.com/mitchellh/mapstructure v1.5.0
|
||||
## explicit; go 1.14
|
||||
github.com/mitchellh/mapstructure
|
||||
# github.com/moby/buildkit v0.10.1-0.20220809151411-8488654e899b
|
||||
# github.com/moby/buildkit v0.10.1-0.20220816171719-55ba9d14360a
|
||||
## explicit; go 1.17
|
||||
github.com/moby/buildkit/api/services/control
|
||||
github.com/moby/buildkit/api/types
|
||||
|
Reference in New Issue
Block a user