Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
blampe committed Feb 16, 2024
1 parent 5155f4d commit dff1663
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 9 deletions.
4 changes: 2 additions & 2 deletions examples/test-buildx/caching/ts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ const img = new docker.buildx.Image(`buildx-${config.require("name")}`, {
buildArgs: {
SLEEP_SECONDS: config.require("SLEEP_SECONDS"),
},
cacheTo: [config.require("cacheTo")],
cacheFrom: [config.require("cacheFrom")],
cacheTo: [{ raw: config.require("cacheTo") }],
cacheFrom: [{ raw: config.require("cacheFrom") }],
// Set registry auth if it was provided.
registries: config.getSecret("username").apply((a) =>
a
Expand Down
45 changes: 38 additions & 7 deletions provider/internal/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,13 @@ func (*Image) Check(
continue
}
if err = cfg.client.Auth(ctx, reg); err != nil {
failures = append(failures,
provider.CheckFailure{Property: "registries", Reason: fmt.Sprintf("unable to authenticate: %s", err.Error())})
failures = append(
failures,
provider.CheckFailure{
Property: "registries",
Reason: fmt.Sprintf("unable to authenticate: %s", err.Error()),
},
)
}
}

Expand Down Expand Up @@ -349,7 +354,10 @@ func (ia *ImageArgs) toBuildOptions(preview bool) (controllerapi.BuildOptions, e
ia.File = filepath.Join(ia.Context, "Dockerfile")
}
if _, err := os.Stat(ia.File); err != nil {
multierr = errors.Join(multierr, newCheckFailure("context", fmt.Errorf("%q: %w", ia.File, err)))
multierr = errors.Join(
multierr,
newCheckFailure("context", fmt.Errorf("%q: %w", ia.File, err)),
)
}
}

Expand All @@ -360,7 +368,13 @@ func (ia *ImageArgs) toBuildOptions(preview bool) (controllerapi.BuildOptions, e
exports := []*controllerapi.ExportEntry{}
for _, e := range filtered.Exports {
if strings.Count(e.String(), "type=") > 1 {
multierr = errors.Join(multierr, newCheckFailure("exports", errors.New("exports should only specify one export type")))
multierr = errors.Join(
multierr,
newCheckFailure(
"exports",
errors.New("exports should only specify one export type"),
),
)
continue
}
ee, err := buildflags.ParseExports([]string{e.String()})
Expand Down Expand Up @@ -404,7 +418,13 @@ func (ia *ImageArgs) toBuildOptions(preview bool) (controllerapi.BuildOptions, e
cacheFrom := []*controllerapi.CacheOptionsEntry{}
for _, c := range filtered.CacheFrom {
if strings.Count(c.String(), "type=") > 1 {
multierr = errors.Join(multierr, newCheckFailure("cacheFrom", errors.New("cacheFrom should only specify one cache type")))
multierr = errors.Join(
multierr,
newCheckFailure(
"cacheFrom",
errors.New("cacheFrom should only specify one cache type"),
),
)
continue
}
parsed, err := buildflags.ParseCacheEntry([]string{c.String()})
Expand All @@ -421,7 +441,13 @@ func (ia *ImageArgs) toBuildOptions(preview bool) (controllerapi.BuildOptions, e
cacheTo := []*controllerapi.CacheOptionsEntry{}
for _, c := range filtered.CacheTo {
if strings.Count(c.String(), "type=") > 1 {
multierr = errors.Join(multierr, newCheckFailure("cacheTo", errors.New("cacheTo should only specify one cache type")))
multierr = errors.Join(
multierr,
newCheckFailure(
"cacheTo",
errors.New("cacheTo should only specify one cache type"),
),
)
continue
}
parsed, err := buildflags.ParseCacheEntry([]string{c.String()})
Expand Down Expand Up @@ -644,7 +670,12 @@ func (*Image) Delete(

// Diff re-implements most of the default diff behavior, with the exception of
// ignoring "password" changes on registry inputs.
func (*Image) Diff(_ provider.Context, id string, olds ImageState, news ImageArgs) (provider.DiffResponse, error) {
func (*Image) Diff(
_ provider.Context,
id string,
olds ImageState,
news ImageArgs,
) (provider.DiffResponse, error) {
diff := map[string]provider.PropertyDiff{}
update := provider.PropertyDiff{Kind: provider.Update}

Expand Down

0 comments on commit dff1663

Please sign in to comment.