more lint
This commit is contained in:
@@ -18,7 +18,7 @@ import (
|
||||
"github.com/pulumi/pulumi-go-provider/infer"
|
||||
)
|
||||
|
||||
var _ = (infer.Annotated)((*BuilderConfig)(nil))
|
||||
var _ infer.Annotated = (*BuilderConfig)(nil)
|
||||
|
||||
// BuilderConfig configures the builder to use for an image build.
|
||||
type BuilderConfig struct {
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
package internal
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
@@ -25,38 +26,38 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
_ = (fmt.Stringer)((*CacheFrom)(nil))
|
||||
_ = (fmt.Stringer)((*CacheFromAzureBlob)(nil))
|
||||
_ = (fmt.Stringer)((*CacheFromGitHubActions)(nil))
|
||||
_ = (fmt.Stringer)((*CacheFromLocal)(nil))
|
||||
_ = (fmt.Stringer)((*CacheFromRegistry)(nil))
|
||||
_ = (fmt.Stringer)((*CacheFromS3)(nil))
|
||||
_ = (fmt.Stringer)((*CacheTo)(nil))
|
||||
_ = (fmt.Stringer)((*CacheToAzureBlob)(nil))
|
||||
_ = (fmt.Stringer)((*CacheToGitHubActions)(nil))
|
||||
_ = (fmt.Stringer)((*CacheToInline)(nil))
|
||||
_ = (fmt.Stringer)((*CacheToLocal)(nil))
|
||||
_ = (fmt.Stringer)((*CacheToRegistry)(nil))
|
||||
_ = (fmt.Stringer)((*CacheToS3)(nil))
|
||||
_ = (fmt.Stringer)(CacheWithCompression{})
|
||||
_ = (fmt.Stringer)(CacheWithIgnoreError{})
|
||||
_ = (fmt.Stringer)(CacheWithMode{})
|
||||
_ = (fmt.Stringer)(CacheWithOCI{})
|
||||
_ = (infer.Annotated)((*CacheFrom)(nil))
|
||||
_ = (infer.Annotated)((*CacheFromAzureBlob)(nil))
|
||||
_ = (infer.Annotated)((*CacheFromGitHubActions)(nil))
|
||||
_ = (infer.Annotated)((*CacheFromLocal)(nil))
|
||||
_ = (infer.Annotated)((*CacheFromRegistry)(nil))
|
||||
_ = (infer.Annotated)((*CacheFromS3)(nil))
|
||||
_ = (infer.Annotated)((*CacheTo)(nil))
|
||||
_ = (infer.Annotated)((*CacheToInline)(nil))
|
||||
_ = (infer.Annotated)((*CacheToLocal)(nil))
|
||||
_ = (infer.Annotated)((*CacheWithCompression)(nil))
|
||||
_ = (infer.Annotated)((*CacheWithIgnoreError)(nil))
|
||||
_ = (infer.Annotated)((*CacheWithMode)(nil))
|
||||
_ = (infer.Annotated)((*CacheWithOCI)(nil))
|
||||
_ = (infer.Enum[CacheMode])((*CacheMode)(nil))
|
||||
_ = (infer.Enum[CompressionType])((*CompressionType)(nil))
|
||||
_ fmt.Stringer = (*CacheFrom)(nil)
|
||||
_ fmt.Stringer = (*CacheFromAzureBlob)(nil)
|
||||
_ fmt.Stringer = (*CacheFromGitHubActions)(nil)
|
||||
_ fmt.Stringer = (*CacheFromLocal)(nil)
|
||||
_ fmt.Stringer = (*CacheFromRegistry)(nil)
|
||||
_ fmt.Stringer = (*CacheFromS3)(nil)
|
||||
_ fmt.Stringer = (*CacheTo)(nil)
|
||||
_ fmt.Stringer = (*CacheToAzureBlob)(nil)
|
||||
_ fmt.Stringer = (*CacheToGitHubActions)(nil)
|
||||
_ fmt.Stringer = (*CacheToInline)(nil)
|
||||
_ fmt.Stringer = (*CacheToLocal)(nil)
|
||||
_ fmt.Stringer = (*CacheToRegistry)(nil)
|
||||
_ fmt.Stringer = (*CacheToS3)(nil)
|
||||
_ fmt.Stringer = CacheWithCompression{}
|
||||
_ fmt.Stringer = CacheWithIgnoreError{}
|
||||
_ fmt.Stringer = CacheWithMode{}
|
||||
_ fmt.Stringer = CacheWithOCI{}
|
||||
_ infer.Annotated = (*CacheFrom)(nil)
|
||||
_ infer.Annotated = (*CacheFromAzureBlob)(nil)
|
||||
_ infer.Annotated = (*CacheFromGitHubActions)(nil)
|
||||
_ infer.Annotated = (*CacheFromLocal)(nil)
|
||||
_ infer.Annotated = (*CacheFromRegistry)(nil)
|
||||
_ infer.Annotated = (*CacheFromS3)(nil)
|
||||
_ infer.Annotated = (*CacheTo)(nil)
|
||||
_ infer.Annotated = (*CacheToInline)(nil)
|
||||
_ infer.Annotated = (*CacheToLocal)(nil)
|
||||
_ infer.Annotated = (*CacheWithCompression)(nil)
|
||||
_ infer.Annotated = (*CacheWithIgnoreError)(nil)
|
||||
_ infer.Annotated = (*CacheWithMode)(nil)
|
||||
_ infer.Annotated = (*CacheWithOCI)(nil)
|
||||
_ infer.Enum[CacheMode] = (*CacheMode)(nil)
|
||||
_ infer.Enum[CompressionType] = (*CompressionType)(nil)
|
||||
)
|
||||
|
||||
// CacheFromLocal pulls cache manifests from a local directory.
|
||||
@@ -73,10 +74,10 @@ func (c *CacheFromLocal) String() string {
|
||||
}
|
||||
parts := []string{"type=local"}
|
||||
if c.Src != "" {
|
||||
parts = append(parts, fmt.Sprintf("src=%s", c.Src))
|
||||
parts = append(parts, "src="+c.Src)
|
||||
}
|
||||
if c.Digest != "" {
|
||||
parts = append(parts, fmt.Sprintf("digest=%s", c.Digest))
|
||||
parts = append(parts, "digest="+c.Digest)
|
||||
}
|
||||
return strings.Join(parts, ",")
|
||||
}
|
||||
@@ -103,7 +104,7 @@ func (c *CacheFromRegistry) String() string {
|
||||
if c == nil {
|
||||
return ""
|
||||
}
|
||||
return fmt.Sprintf("type=registry,ref=%s", c.Ref)
|
||||
return "type=registry,ref=" + c.Ref
|
||||
}
|
||||
|
||||
// CacheWithOCI exposes OCI media type options.
|
||||
@@ -188,13 +189,13 @@ func (c *CacheFromGitHubActions) String() string {
|
||||
}
|
||||
parts := []string{"type=gha"}
|
||||
if c.Scope != "" {
|
||||
parts = append(parts, fmt.Sprintf("scope=%s", c.Scope))
|
||||
parts = append(parts, "scope="+c.Scope)
|
||||
}
|
||||
if c.Token != "" {
|
||||
parts = append(parts, fmt.Sprintf("token=%s", c.Token))
|
||||
parts = append(parts, "token="+c.Token)
|
||||
}
|
||||
if c.URL != "" {
|
||||
parts = append(parts, fmt.Sprintf("url=%s", c.URL))
|
||||
parts = append(parts, "url="+c.URL)
|
||||
}
|
||||
return strings.Join(parts, ",")
|
||||
}
|
||||
@@ -215,13 +216,13 @@ func (c *CacheFromAzureBlob) String() string {
|
||||
}
|
||||
parts := []string{"type=azblob"}
|
||||
if c.Name != "" {
|
||||
parts = append(parts, fmt.Sprintf("name=%s", c.Name))
|
||||
parts = append(parts, "name="+c.Name)
|
||||
}
|
||||
if c.AccountURL != "" {
|
||||
parts = append(parts, fmt.Sprintf("account_url=%s", c.AccountURL))
|
||||
parts = append(parts, "account_url="+c.AccountURL)
|
||||
}
|
||||
if c.SecretAccessKey != "" {
|
||||
parts = append(parts, fmt.Sprintf("secret_access_key=%s", c.SecretAccessKey))
|
||||
parts = append(parts, "secret_access_key="+c.SecretAccessKey)
|
||||
}
|
||||
return strings.Join(parts, ",")
|
||||
}
|
||||
@@ -259,7 +260,7 @@ type CacheFromS3 struct {
|
||||
UsePathStyle *bool `pulumi:"usePathStyle,optional"`
|
||||
AccessKeyID string `pulumi:"accessKeyId,optional"`
|
||||
SecretAccessKey string `pulumi:"secretAccessKey,optional" provider:"secret"`
|
||||
SessionToken string `pulumi:"sessionToken,optional" provider:"secret"`
|
||||
SessionToken string `pulumi:"sessionToken,optional" provider:"secret"`
|
||||
}
|
||||
|
||||
// Annotate sets docstrings and defaults on CacheFromS3.
|
||||
@@ -309,31 +310,31 @@ func (c *CacheFromS3) String() string {
|
||||
}
|
||||
parts := []string{"type=s3"}
|
||||
if c.Bucket != "" {
|
||||
parts = append(parts, fmt.Sprintf("bucket=%s", c.Bucket))
|
||||
parts = append(parts, "bucket="+c.Bucket)
|
||||
}
|
||||
if c.Name != "" {
|
||||
parts = append(parts, fmt.Sprintf("name=%s", c.Name))
|
||||
parts = append(parts, "name="+c.Name)
|
||||
}
|
||||
if c.EndpointURL != "" {
|
||||
parts = append(parts, fmt.Sprintf("endpoint_url=%s", c.EndpointURL))
|
||||
parts = append(parts, "endpoint_url="+c.EndpointURL)
|
||||
}
|
||||
if c.BlobsPrefix != "" {
|
||||
parts = append(parts, fmt.Sprintf("blobs_prefix=%s", c.BlobsPrefix))
|
||||
parts = append(parts, "blobs_prefix="+c.BlobsPrefix)
|
||||
}
|
||||
if c.ManifestsPrefix != "" {
|
||||
parts = append(parts, fmt.Sprintf("manifests_prefix=%s", c.ManifestsPrefix))
|
||||
parts = append(parts, "manifests_prefix="+c.ManifestsPrefix)
|
||||
}
|
||||
if c.UsePathStyle != nil {
|
||||
parts = append(parts, fmt.Sprintf("use_path_type=%t", *c.UsePathStyle))
|
||||
}
|
||||
if c.AccessKeyID != "" {
|
||||
parts = append(parts, fmt.Sprintf("access_key_id=%s", c.AccessKeyID))
|
||||
parts = append(parts, "access_key_id="+c.AccessKeyID)
|
||||
}
|
||||
if c.SecretAccessKey != "" {
|
||||
parts = append(parts, fmt.Sprintf("secret_access_key=%s", c.SecretAccessKey))
|
||||
parts = append(parts, "secret_access_key="+c.SecretAccessKey)
|
||||
}
|
||||
if c.SessionToken != "" {
|
||||
parts = append(parts, fmt.Sprintf("session_token=%s", c.SessionToken))
|
||||
parts = append(parts, "session_token="+c.SessionToken)
|
||||
}
|
||||
|
||||
return strings.Join(parts, ",")
|
||||
@@ -460,7 +461,7 @@ func (c CacheFrom) String() string {
|
||||
|
||||
func (c CacheFrom) validate(preview bool) (*controllerapi.CacheOptionsEntry, error) {
|
||||
if strings.Count(c.String(), "type=") > 1 {
|
||||
return nil, fmt.Errorf("cacheFrom should only specify one cache type")
|
||||
return nil, errors.New("cacheFrom should only specify one cache type")
|
||||
}
|
||||
parsed, err := buildflags.ParseCacheEntry([]string{c.String()})
|
||||
if err != nil {
|
||||
@@ -517,7 +518,7 @@ func (c *CacheToLocal) String() string {
|
||||
return ""
|
||||
}
|
||||
return join(
|
||||
Raw(fmt.Sprintf("type=local,dest=%s", c.Dest)),
|
||||
Raw("type=local,dest="+c.Dest),
|
||||
c.CacheWithCompression,
|
||||
c.CacheWithIgnoreError,
|
||||
)
|
||||
@@ -669,7 +670,7 @@ func (c CacheTo) String() string {
|
||||
|
||||
func (c CacheTo) validate(preview bool) (*controllerapi.CacheOptionsEntry, error) {
|
||||
if strings.Count(c.String(), "type=") > 1 {
|
||||
return nil, fmt.Errorf("cacheTo should only specify one cache type")
|
||||
return nil, errors.New("cacheTo should only specify one cache type")
|
||||
}
|
||||
parsed, err := buildflags.ParseCacheEntry([]string{c.String()})
|
||||
if err != nil {
|
||||
|
||||
@@ -48,7 +48,7 @@ func TestCacheString(t *testing.T) {
|
||||
SessionToken: "session",
|
||||
},
|
||||
}},
|
||||
//nolint:lll
|
||||
//nolint:lll // Taken from AWS reference docs.
|
||||
want: "type=s3,bucket=bucket-foo,name=myname,endpoint_url=https://some.endpoint,blobs_prefix=blob-prefix,manifests_prefix=manifest-prefix,use_path_type=true,access_key_id=access-key-id,secret_access_key=secret-key,session_token=session",
|
||||
},
|
||||
{
|
||||
@@ -91,7 +91,9 @@ func TestCacheString(t *testing.T) {
|
||||
{
|
||||
name: "ignore-error",
|
||||
given: CacheTo{
|
||||
AZBlob: &CacheToAzureBlob{CacheWithIgnoreError: CacheWithIgnoreError{pulumi.BoolRef(true)}},
|
||||
AZBlob: &CacheToAzureBlob{
|
||||
CacheWithIgnoreError: CacheWithIgnoreError{pulumi.BoolRef(true)},
|
||||
},
|
||||
},
|
||||
want: "type=azblob,ignore-error=true",
|
||||
},
|
||||
@@ -100,7 +102,10 @@ func TestCacheString(t *testing.T) {
|
||||
given: CacheTo{
|
||||
Registry: &CacheToRegistry{
|
||||
CacheFromRegistry: CacheFromRegistry{Ref: "docker.io/foo/bar:baz"},
|
||||
CacheWithOCI: CacheWithOCI{OCI: pulumi.BoolRef(true), ImageManifest: pulumi.BoolRef(true)},
|
||||
CacheWithOCI: CacheWithOCI{
|
||||
OCI: pulumi.BoolRef(true),
|
||||
ImageManifest: pulumi.BoolRef(true),
|
||||
},
|
||||
},
|
||||
},
|
||||
want: "type=registry,ref=docker.io/foo/bar:baz,oci-mediatypes=true,image-manifest=true",
|
||||
|
||||
@@ -199,8 +199,8 @@ func (c *cli) execBuild(b Build) (*client.SolveResponse, error) {
|
||||
// directory for auth, but BUILDX_CONFIG will point to the host. There's a
|
||||
// bunch of builder state in there that we want to preserve.
|
||||
env := []string{
|
||||
fmt.Sprintf("DOCKER_CONFIG=%s", tmp),
|
||||
fmt.Sprintf("BUILDX_CONFIG=%s", filepath.Join(hostConfigDir, "buildx")),
|
||||
"DOCKER_CONFIG=" + tmp,
|
||||
"BUILDX_CONFIG=" + filepath.Join(hostConfigDir, "buildx"),
|
||||
}
|
||||
|
||||
// We need to write to this file in order to recover information about the
|
||||
@@ -338,9 +338,9 @@ func (c *cli) execBuild(b Build) (*client.SolveResponse, error) {
|
||||
|
||||
// exec invokes a Docker plugin binary. The first argument should be the name
|
||||
// of the plugin's subcommand, e.g. "buildx".
|
||||
func (c *cli) exec(args []string, extraEnv []string) error {
|
||||
func (c *cli) exec(args, extraEnv []string) error {
|
||||
if len(args) == 0 {
|
||||
return fmt.Errorf("args must be non-empty")
|
||||
return errors.New("args must be non-empty")
|
||||
}
|
||||
name := args[0]
|
||||
|
||||
@@ -371,7 +371,7 @@ func (c *cli) exec(args []string, extraEnv []string) error {
|
||||
|
||||
// attrcsv transforms key/values into a CSV: key1=value1,key2=value2,...
|
||||
func attrcsv(typ string, m map[string]string) string {
|
||||
s := []string{fmt.Sprintf("type=%s", typ)}
|
||||
s := []string{"type=" + typ}
|
||||
for k, v := range m {
|
||||
s = append(s, fmt.Sprintf("%s=%s", k, v))
|
||||
}
|
||||
|
||||
@@ -41,7 +41,8 @@ func TestAuth(t *testing.T) {
|
||||
Password: password,
|
||||
})
|
||||
|
||||
_, err := cli.Client().RegistryLogin(context.Background(), registry.AuthConfig{ServerAddress: address})
|
||||
_, err := cli.Client().
|
||||
RegistryLogin(context.Background(), registry.AuthConfig{ServerAddress: address})
|
||||
assert.NoError(t, err)
|
||||
}
|
||||
|
||||
@@ -81,7 +82,10 @@ func TestBuild(t *testing.T) {
|
||||
pctx.EXPECT().Log(gomock.Any(), gomock.Any()).AnyTimes()
|
||||
pctx.EXPECT().LogStatus(gomock.Any(), gomock.Any()).AnyTimes()
|
||||
pctx.EXPECT().Done().Return(ctx.Done()).AnyTimes()
|
||||
pctx.EXPECT().Value(gomock.Any()).DoAndReturn(func(key any) any { return ctx.Value(key) }).AnyTimes()
|
||||
pctx.EXPECT().
|
||||
Value(gomock.Any()).
|
||||
DoAndReturn(func(key any) any { return ctx.Value(key) }).
|
||||
AnyTimes()
|
||||
pctx.EXPECT().Err().Return(ctx.Err()).AnyTimes()
|
||||
pctx.EXPECT().Deadline().Return(ctx.Deadline()).AnyTimes()
|
||||
|
||||
@@ -316,7 +320,11 @@ func TestInspect(t *testing.T) {
|
||||
cli := testcli(t, false)
|
||||
descriptors, err := cli.Inspect(context.Background(), "pulumibot/myapp:buildx")
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, "application/vnd.docker.distribution.manifest.v2+json", descriptors[0].MediaType)
|
||||
assert.Equal(
|
||||
t,
|
||||
"application/vnd.docker.distribution.manifest.v2+json",
|
||||
descriptors[0].MediaType,
|
||||
)
|
||||
}
|
||||
|
||||
func TestNormalizatReference(t *testing.T) {
|
||||
|
||||
@@ -38,8 +38,8 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
_ = (infer.Annotated)((*Context)(nil))
|
||||
_ = (infer.Annotated)((*BuildContext)(nil))
|
||||
_ infer.Annotated = (*Context)(nil)
|
||||
_ infer.Annotated = (*BuildContext)(nil)
|
||||
)
|
||||
|
||||
// Context represents Docker's `PATH | URL | -` context argument. Inline
|
||||
@@ -115,7 +115,10 @@ func (c *Context) validate(preview bool, d Dockerfile) (Dockerfile, error) {
|
||||
}
|
||||
|
||||
if c.Location != "-" {
|
||||
return d, newCheckFailure(fmt.Errorf("%q: not a valid directory or URL", c.Location), "context.location")
|
||||
return d, newCheckFailure(
|
||||
fmt.Errorf("%q: not a valid directory or URL", c.Location),
|
||||
"context.location",
|
||||
)
|
||||
}
|
||||
|
||||
return d, nil
|
||||
@@ -172,7 +175,10 @@ func hashFile(
|
||||
// a symlink, the location it points to is hashed. If it is a regular file, we
|
||||
// hash the contents of the file. In order to detect file renames and mode
|
||||
// changes, we also write to the accumulator a relative name and file mode.
|
||||
func hashBuildContext(contextPath, dockerfilePath string, namedContexts map[string]string) (string, error) {
|
||||
func hashBuildContext(
|
||||
contextPath, dockerfilePath string,
|
||||
namedContexts map[string]string,
|
||||
) (string, error) {
|
||||
h := sha256.New()
|
||||
fs := afero.NewOsFs()
|
||||
|
||||
@@ -222,21 +228,25 @@ func hashBuildContext(contextPath, dockerfilePath string, namedContexts map[stri
|
||||
|
||||
// hashPath hashes all paths within the provided FS.
|
||||
func hashPath(h hash.Hash, fs fsutil.FS) (string, error) {
|
||||
err := fs.Walk(context.Background(), "/", func(filePath string, dir gofs.DirEntry, err error) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if dir.IsDir() {
|
||||
return nil
|
||||
}
|
||||
// fsutil.Walk makes filePath relative to the root, we join it back to get an absolute path to
|
||||
// the file to hash.
|
||||
fi, err := dir.Info()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return hashFile(h, fs, filePath, fi.Mode())
|
||||
})
|
||||
err := fs.Walk(
|
||||
context.Background(),
|
||||
"/",
|
||||
func(filePath string, dir gofs.DirEntry, err error) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if dir.IsDir() {
|
||||
return nil
|
||||
}
|
||||
// fsutil.Walk makes filePath relative to the root, we join it back to get an absolute path to
|
||||
// the file to hash.
|
||||
fi, err := dir.Info()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return hashFile(h, fs, filePath, fi.Mode())
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("unable to hash build context: %w", err)
|
||||
}
|
||||
@@ -286,12 +296,13 @@ func getIgnorePatterns(fs afero.Fs, dockerfilePath, contextRoot string) ([]strin
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("reading %q: %w", p, err)
|
||||
}
|
||||
defer contract.IgnoreClose(f)
|
||||
|
||||
ignorePatterns, err := ignorefile.ReadAll(f)
|
||||
if err != nil {
|
||||
contract.IgnoreClose(f)
|
||||
return nil, fmt.Errorf("unable to parse %q: %w", p, err)
|
||||
}
|
||||
contract.IgnoreClose(f)
|
||||
return ignorePatterns, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -136,18 +136,35 @@ func TestHashIgnoresFile(t *testing.T) {
|
||||
func TestHashIgnoresWildcards(t *testing.T) {
|
||||
t.Parallel()
|
||||
baselineDir := "testdata/ignores-wildcard/basedir"
|
||||
baselineResult, err := hashBuildContext(baselineDir, filepath.Join(baselineDir, _dockerfile), nil)
|
||||
baselineResult, err := hashBuildContext(
|
||||
baselineDir,
|
||||
filepath.Join(baselineDir, _dockerfile),
|
||||
nil,
|
||||
)
|
||||
require.NoError(t, err)
|
||||
|
||||
modIgnoredDir := "testdata/ignores-wildcard/basedir-modified-ignored-file"
|
||||
modIgnoredResult, err := hashBuildContext(modIgnoredDir, filepath.Join(modIgnoredDir, _dockerfile), nil)
|
||||
modIgnoredResult, err := hashBuildContext(
|
||||
modIgnoredDir,
|
||||
filepath.Join(modIgnoredDir, _dockerfile),
|
||||
nil,
|
||||
)
|
||||
require.NoError(t, err)
|
||||
|
||||
modIncludedDir := "testdata/ignores-wildcard/basedir-modified-included-file"
|
||||
modIncludedResult, err := hashBuildContext(modIncludedDir, filepath.Join(modIncludedDir, _dockerfile), nil)
|
||||
modIncludedResult, err := hashBuildContext(
|
||||
modIncludedDir,
|
||||
filepath.Join(modIncludedDir, _dockerfile),
|
||||
nil,
|
||||
)
|
||||
require.NoError(t, err)
|
||||
|
||||
assert.Equal(t, baselineResult, modIgnoredResult, "hash should not change when modifying ignored files")
|
||||
assert.Equal(
|
||||
t,
|
||||
baselineResult,
|
||||
modIgnoredResult,
|
||||
"hash should not change when modifying ignored files",
|
||||
)
|
||||
assert.NotEqual(t, baselineResult, modIncludedResult,
|
||||
"hash should change when modifying included (via wildcard ignore exclusion) files")
|
||||
}
|
||||
@@ -174,18 +191,35 @@ func TestHashIgnoresWildcardsRelative(t *testing.T) {
|
||||
}()
|
||||
|
||||
baselineDir := "../testdata/ignores-wildcard/basedir"
|
||||
baselineResult, err := hashBuildContext(baselineDir, filepath.Join(baselineDir, _dockerfile), nil)
|
||||
baselineResult, err := hashBuildContext(
|
||||
baselineDir,
|
||||
filepath.Join(baselineDir, _dockerfile),
|
||||
nil,
|
||||
)
|
||||
require.NoError(t, err)
|
||||
|
||||
modIgnoredDir := "../testdata/ignores-wildcard/basedir-modified-ignored-file"
|
||||
modIgnoredResult, err := hashBuildContext(modIgnoredDir, filepath.Join(modIgnoredDir, _dockerfile), nil)
|
||||
modIgnoredResult, err := hashBuildContext(
|
||||
modIgnoredDir,
|
||||
filepath.Join(modIgnoredDir, _dockerfile),
|
||||
nil,
|
||||
)
|
||||
require.NoError(t, err)
|
||||
|
||||
modIncludedDir := "../testdata/ignores-wildcard/basedir-modified-included-file"
|
||||
modIncludedResult, err := hashBuildContext(modIncludedDir, filepath.Join(modIncludedDir, _dockerfile), nil)
|
||||
modIncludedResult, err := hashBuildContext(
|
||||
modIncludedDir,
|
||||
filepath.Join(modIncludedDir, _dockerfile),
|
||||
nil,
|
||||
)
|
||||
require.NoError(t, err)
|
||||
|
||||
assert.Equal(t, baselineResult, modIgnoredResult, "hash should not change when modifying ignored files")
|
||||
assert.Equal(
|
||||
t,
|
||||
baselineResult,
|
||||
modIgnoredResult,
|
||||
"hash should not change when modifying ignored files",
|
||||
)
|
||||
assert.NotEqual(t, baselineResult, modIncludedResult,
|
||||
"hash should change when modifying included (via wildcard ignore exclusion) files")
|
||||
}
|
||||
@@ -193,10 +227,18 @@ func TestHashIgnoresWildcardsRelative(t *testing.T) {
|
||||
func TestHashIgnoresDockerfileOutsideDirMove(t *testing.T) {
|
||||
t.Parallel()
|
||||
appDir := "./testdata/dockerfile-location-irrelevant/app"
|
||||
baseResult, err := hashBuildContext(appDir, "./testdata/dockerfile-location-irrelevant/step1.Dockerfile", nil)
|
||||
baseResult, err := hashBuildContext(
|
||||
appDir,
|
||||
"./testdata/dockerfile-location-irrelevant/step1.Dockerfile",
|
||||
nil,
|
||||
)
|
||||
require.NoError(t, err)
|
||||
|
||||
result, err := hashBuildContext(appDir, "./testdata/dockerfile-location-irrelevant/step2.Dockerfile", nil)
|
||||
result, err := hashBuildContext(
|
||||
appDir,
|
||||
"./testdata/dockerfile-location-irrelevant/step2.Dockerfile",
|
||||
nil,
|
||||
)
|
||||
require.NoError(t, err)
|
||||
|
||||
assert.Equal(t, result, baseResult)
|
||||
@@ -362,7 +404,7 @@ func TestDockerIgnore(t *testing.T) {
|
||||
for fname, fdata := range tt.fs {
|
||||
f, err := fs.Create(fname)
|
||||
require.NoError(t, err)
|
||||
_, err = f.Write([]byte(fdata))
|
||||
_, err = f.WriteString(fdata)
|
||||
require.NoError(t, err)
|
||||
}
|
||||
actual, err := getIgnorePatterns(fs, tt.dockerfile, tt.context)
|
||||
|
||||
@@ -176,7 +176,9 @@ func (enc *ConfigEncoding) unmarshalPropertyValue(key resource.PropertyKey,
|
||||
}
|
||||
|
||||
// UnmarshalProperties is copied from plugin.UnmarshalProperties substituting plugin.UnmarshalPropertyValue.
|
||||
func (enc *ConfigEncoding) UnmarshalProperties(props *structpb.Struct) (resource.PropertyMap, error) {
|
||||
func (enc *ConfigEncoding) UnmarshalProperties(
|
||||
props *structpb.Struct,
|
||||
) (resource.PropertyMap, error) {
|
||||
opts := enc.unmarshalOpts()
|
||||
|
||||
result := make(resource.PropertyMap)
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
package internal
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"errors"
|
||||
"io"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@@ -57,7 +57,7 @@ func (d *Dockerfile) Annotate(a infer.Annotator) {
|
||||
func (d *Dockerfile) validate(preview bool, c Context) error {
|
||||
if d.Location != "" && d.Inline != "" {
|
||||
return newCheckFailure(
|
||||
fmt.Errorf(`only specify "file" or "inline", not both`),
|
||||
errors.New(`only specify "file" or "inline", not both`),
|
||||
"dockerfile",
|
||||
)
|
||||
}
|
||||
@@ -89,7 +89,7 @@ func (d *Dockerfile) validate(preview bool, c Context) error {
|
||||
}
|
||||
|
||||
if !preview && !buildx.IsRemoteURL(c.Location) {
|
||||
return newCheckFailure(fmt.Errorf("missing 'location' or 'inline'"), "dockerfile")
|
||||
return newCheckFailure(errors.New("missing 'location' or 'inline'"), "dockerfile")
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
package internal
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"slices"
|
||||
"strings"
|
||||
@@ -26,24 +27,24 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
_ = (fmt.Stringer)((*Export)(nil))
|
||||
_ = (fmt.Stringer)((*ExportDocker)(nil))
|
||||
_ = (fmt.Stringer)((*ExportImage)(nil))
|
||||
_ = (fmt.Stringer)((*ExportLocal)(nil))
|
||||
_ = (fmt.Stringer)((*ExportOCI)(nil))
|
||||
_ = (fmt.Stringer)((*ExportRegistry)(nil))
|
||||
_ = (fmt.Stringer)((*ExportTar)(nil))
|
||||
_ = (fmt.Stringer)(ExportWithAnnotations{})
|
||||
_ = (fmt.Stringer)(ExportWithCompression{})
|
||||
_ = (fmt.Stringer)(ExportWithNames{})
|
||||
_ = (fmt.Stringer)(ExportWithOCI{})
|
||||
_ = (infer.Annotated)((*Export)(nil))
|
||||
_ = (infer.Annotated)((*ExportDocker)(nil))
|
||||
_ = (infer.Annotated)((*ExportImage)(nil))
|
||||
_ = (infer.Annotated)((*ExportLocal)(nil))
|
||||
_ = (infer.Annotated)((*ExportOCI)(nil))
|
||||
_ = (infer.Annotated)((*ExportRegistry)(nil))
|
||||
_ = (infer.Annotated)((*ExportTar)(nil))
|
||||
_ fmt.Stringer = (*Export)(nil)
|
||||
_ fmt.Stringer = (*ExportDocker)(nil)
|
||||
_ fmt.Stringer = (*ExportImage)(nil)
|
||||
_ fmt.Stringer = (*ExportLocal)(nil)
|
||||
_ fmt.Stringer = (*ExportOCI)(nil)
|
||||
_ fmt.Stringer = (*ExportRegistry)(nil)
|
||||
_ fmt.Stringer = (*ExportTar)(nil)
|
||||
_ fmt.Stringer = ExportWithAnnotations{}
|
||||
_ fmt.Stringer = ExportWithCompression{}
|
||||
_ fmt.Stringer = ExportWithNames{}
|
||||
_ fmt.Stringer = ExportWithOCI{}
|
||||
_ infer.Annotated = (*Export)(nil)
|
||||
_ infer.Annotated = (*ExportDocker)(nil)
|
||||
_ infer.Annotated = (*ExportImage)(nil)
|
||||
_ infer.Annotated = (*ExportLocal)(nil)
|
||||
_ infer.Annotated = (*ExportOCI)(nil)
|
||||
_ infer.Annotated = (*ExportRegistry)(nil)
|
||||
_ infer.Annotated = (*ExportTar)(nil)
|
||||
)
|
||||
|
||||
// Export is a "union" type for all of our available `--output` options.
|
||||
@@ -124,7 +125,7 @@ func (e Export) pushed() bool {
|
||||
|
||||
func (e Export) validate(preview bool, tags []string) (*controllerapi.ExportEntry, error) {
|
||||
if strings.Count(e.String(), "type=") > 1 {
|
||||
return nil, fmt.Errorf("exports should only specify one export type")
|
||||
return nil, errors.New("exports should only specify one export type")
|
||||
}
|
||||
ee, err := buildflags.ParseExports([]string{e.String()})
|
||||
if err != nil {
|
||||
@@ -132,7 +133,9 @@ func (e Export) validate(preview bool, tags []string) (*controllerapi.ExportEntr
|
||||
}
|
||||
exp := ee[0]
|
||||
if len(tags) == 0 && isRegistryPush(exp) && exp.Attrs["name"] == "" {
|
||||
return nil, fmt.Errorf("at least one tag or export name is needed when pushing to a registry")
|
||||
return nil, errors.New(
|
||||
"at least one tag or export name is needed when pushing to a registry",
|
||||
)
|
||||
}
|
||||
if !preview {
|
||||
return exp, nil
|
||||
@@ -187,7 +190,7 @@ func (e *ExportDocker) String() string {
|
||||
}
|
||||
parts := []string{}
|
||||
if e.Dest != "" {
|
||||
parts = append(parts, fmt.Sprintf("dest=%s", e.Dest))
|
||||
parts = append(parts, "dest="+e.Dest)
|
||||
}
|
||||
if e.Tar != nil {
|
||||
parts = append(parts, fmt.Sprintf("tar=%t", *e.Tar))
|
||||
@@ -288,7 +291,7 @@ func (e *ExportImage) String() string {
|
||||
parts = append(parts, fmt.Sprintf("insecure=%t", *e.Insecure))
|
||||
}
|
||||
if e.DanglingNamePrefix != "" {
|
||||
parts = append(parts, fmt.Sprintf("dangling-name-prefix=%s", e.DanglingNamePrefix))
|
||||
parts = append(parts, "dangling-name-prefix="+e.DanglingNamePrefix)
|
||||
}
|
||||
if e.NameCanonical != nil {
|
||||
parts = append(parts, fmt.Sprintf("name-canonical=%t", *e.NameCanonical))
|
||||
@@ -342,7 +345,7 @@ func (e *ExportLocal) String() string {
|
||||
if e == nil {
|
||||
return ""
|
||||
}
|
||||
return fmt.Sprintf("type=local,dest=%s", e.Dest)
|
||||
return "type=local,dest=" + e.Dest
|
||||
}
|
||||
|
||||
// Annotate sets docstrings on ExportLocal.
|
||||
@@ -359,7 +362,7 @@ func (e *ExportTar) String() string {
|
||||
if e == nil {
|
||||
return ""
|
||||
}
|
||||
return fmt.Sprintf("type=tar,dest=%s", e.Dest)
|
||||
return "type=tar,dest=" + e.Dest
|
||||
}
|
||||
|
||||
// ExportWithOCI is an export that support OCI media types.
|
||||
@@ -428,14 +431,17 @@ type ExportWithNames struct {
|
||||
func (e ExportWithNames) String() string {
|
||||
parts := []string{}
|
||||
for _, n := range e.Names {
|
||||
parts = append(parts, fmt.Sprintf("name=%s", n))
|
||||
parts = append(parts, "name="+n)
|
||||
}
|
||||
return strings.Join(parts, ",")
|
||||
}
|
||||
|
||||
// Annotate sets docstrings on ExportWithNames.
|
||||
func (e *ExportWithNames) Annotate(a infer.Annotator) {
|
||||
a.Describe(&e.Names, "Specify images names to export. This is overridden if tags are already specified.")
|
||||
a.Describe(
|
||||
&e.Names,
|
||||
"Specify images names to export. This is overridden if tags are already specified.",
|
||||
)
|
||||
}
|
||||
|
||||
// ExportWithAnnotations is an export with configurable annotations.
|
||||
|
||||
@@ -41,7 +41,10 @@ func TestValidateExport(t *testing.T) {
|
||||
preview: true,
|
||||
e: Export{Raw: "type=registry"},
|
||||
givenTags: []string{"docker.io/foo/bar"},
|
||||
wantExp: &controllerapi.ExportEntry{Type: "image", Attrs: map[string]string{"push": "false"}},
|
||||
wantExp: &controllerapi.ExportEntry{
|
||||
Type: "image",
|
||||
Attrs: map[string]string{"push": "false"},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "raw - push requires tags",
|
||||
@@ -53,7 +56,10 @@ func TestValidateExport(t *testing.T) {
|
||||
preview: true,
|
||||
e: Export{Registry: &ExportRegistry{}},
|
||||
givenTags: []string{"docker.io/foo/bar"},
|
||||
wantExp: &controllerapi.ExportEntry{Type: "image", Attrs: map[string]string{"push": "false"}},
|
||||
wantExp: &controllerapi.ExportEntry{
|
||||
Type: "image",
|
||||
Attrs: map[string]string{"push": "false"},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "registry - push requires tags",
|
||||
@@ -136,7 +142,6 @@ func TestExportString(t *testing.T) {
|
||||
Store: pulumi.BoolRef(false),
|
||||
},
|
||||
},
|
||||
//nolint:lll
|
||||
want: "type=image,push=true,push-by-digest=true,insecure=true,dangling-name-prefix=prefix,unpack=true,store=false",
|
||||
},
|
||||
{
|
||||
@@ -192,7 +197,6 @@ func TestExportString(t *testing.T) {
|
||||
|
||||
func TestExportPushed(t *testing.T) {
|
||||
t.Parallel()
|
||||
tru, fls := true, false
|
||||
tests := []struct {
|
||||
name string
|
||||
e Export
|
||||
@@ -215,12 +219,12 @@ func TestExportPushed(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "registry with explicit push",
|
||||
e: Export{Registry: &ExportRegistry{ExportImage{Push: &fls}}},
|
||||
e: Export{Registry: &ExportRegistry{ExportImage{Push: pulumi.BoolRef(false)}}},
|
||||
want: false,
|
||||
},
|
||||
{
|
||||
name: "image with explicit push",
|
||||
e: Export{Image: &ExportImage{Push: &tru}},
|
||||
e: Export{Image: &ExportImage{Push: pulumi.BoolRef(true)}},
|
||||
want: true,
|
||||
},
|
||||
{
|
||||
|
||||
@@ -112,7 +112,8 @@ func (h *host) builderFor(build Build) (*cachedBuilder, error) {
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
for _, n := range nodes {
|
||||
for idx := range nodes {
|
||||
n := nodes[idx]
|
||||
if n.Driver == nil {
|
||||
continue nextbuilder
|
||||
}
|
||||
@@ -128,7 +129,12 @@ func (h *host) builderFor(build Build) (*cachedBuilder, error) {
|
||||
|
||||
if b.Driver == "" && opts.Builder == "" {
|
||||
// If we STILL don't have a builder, create a docker-container instance.
|
||||
b, err = builder.Create(context.Background(), txn, h.cli, builder.CreateOpts{Driver: "docker-container"})
|
||||
b, err = builder.Create(
|
||||
context.Background(),
|
||||
txn,
|
||||
h.cli,
|
||||
builder.CreateOpts{Driver: "docker-container"},
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -45,9 +45,9 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
_ infer.Annotated = (infer.Annotated)((*Image)(nil))
|
||||
_ infer.Annotated = (infer.Annotated)((*ImageArgs)(nil))
|
||||
_ infer.Annotated = (infer.Annotated)((*ImageState)(nil))
|
||||
_ infer.Annotated = (*Image)(nil)
|
||||
_ infer.Annotated = (*ImageArgs)(nil)
|
||||
_ infer.Annotated = (*ImageState)(nil)
|
||||
_ infer.CustomCheck[ImageArgs] = (*Image)(nil)
|
||||
_ infer.CustomDelete[ImageState] = (*Image)(nil)
|
||||
_ infer.CustomDiff[ImageArgs, ImageState] = (*Image)(nil)
|
||||
@@ -295,9 +295,9 @@ func (ia *ImageArgs) Annotate(a infer.Annotator) {
|
||||
type ImageState struct {
|
||||
ImageArgs
|
||||
|
||||
Digest string `pulumi:"digest" provider:"output"`
|
||||
Digest string `pulumi:"digest" provider:"output"`
|
||||
ContextHash string `pulumi:"contextHash" provider:"output"`
|
||||
Ref string `pulumi:"ref" provider:"output"`
|
||||
Ref string `pulumi:"ref" provider:"output"`
|
||||
}
|
||||
|
||||
// Annotate describes outputs of the Image resource.
|
||||
@@ -391,7 +391,9 @@ func (cf checkFailure) Error() string {
|
||||
}
|
||||
|
||||
func newCheckFailure(err error, format string, args ...any) error {
|
||||
return checkFailure{provider.CheckFailure{Property: fmt.Sprintf(format, args...), Reason: err.Error()}}
|
||||
return checkFailure{
|
||||
provider.CheckFailure{Property: fmt.Sprintf(format, args...), Reason: err.Error()},
|
||||
}
|
||||
}
|
||||
|
||||
// normalize returns a copy of ImageArgs after accounting for unknown (preview)
|
||||
@@ -510,9 +512,11 @@ func (ia ImageArgs) toBuild(
|
||||
}
|
||||
|
||||
if len(opts.Platforms) > 1 && len(opts.CacheTo) > 0 {
|
||||
ctx.Log(diag.Warning,
|
||||
ctx.Log(
|
||||
diag.Warning,
|
||||
"Caching doesn't work reliably with multi-platform builds (https://github.com/docker/buildx/discussions/1382). "+
|
||||
"Instead, perform one cached build per platform and create an Index to join them all together.")
|
||||
"Instead, perform one cached build per platform and create an Index to join them all together.",
|
||||
)
|
||||
}
|
||||
|
||||
return build{
|
||||
@@ -530,17 +534,21 @@ func (ia *ImageArgs) validate(preview bool) (controllerapi.BuildOptions, error)
|
||||
|
||||
if len(ia.Exports) > 1 {
|
||||
multierr = errors.Join(multierr,
|
||||
newCheckFailure(fmt.Errorf("multiple exports are currently unsupported"), "exports"),
|
||||
newCheckFailure(errors.New("multiple exports are currently unsupported"), "exports"),
|
||||
)
|
||||
}
|
||||
if ia.Push && ia.Load {
|
||||
multierr = errors.Join(multierr,
|
||||
newCheckFailure(fmt.Errorf("push and load may not be set together at the moment"), "push"),
|
||||
multierr = errors.Join(
|
||||
multierr,
|
||||
newCheckFailure(
|
||||
errors.New("push and load may not be set together at the moment"),
|
||||
"push",
|
||||
),
|
||||
)
|
||||
}
|
||||
if len(ia.Exports) > 0 && (ia.Push || ia.Load) {
|
||||
multierr = errors.Join(multierr,
|
||||
newCheckFailure(fmt.Errorf("exports can't be provided with push or load"), "exports"),
|
||||
newCheckFailure(errors.New("exports can't be provided with push or load"), "exports"),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -689,7 +697,7 @@ func (i *Image) Create(
|
||||
return id, state, fmt.Errorf("checking buildkit compatibility: %w", err)
|
||||
}
|
||||
if !ok {
|
||||
return id, state, fmt.Errorf("buildkit is not supported on this host")
|
||||
return id, state, errors.New("buildkit is not supported on this host")
|
||||
}
|
||||
|
||||
build, err := input.toBuild(ctx, preview)
|
||||
|
||||
@@ -75,7 +75,8 @@ func TestImageLifecycle(t *testing.T) {
|
||||
).AnyTimes()
|
||||
c.EXPECT().Delete(gomock.Any(),
|
||||
"docker.io/pulumibot/buildkit-e2e@sha256:98ea6e4f216f2fb4b69fff9b3a44842c38686ca685f3f55dc48c5d3fb1107be4",
|
||||
).Return(nil)
|
||||
).
|
||||
Return(nil)
|
||||
return c
|
||||
},
|
||||
op: func(t *testing.T) integration.Operation {
|
||||
@@ -112,7 +113,9 @@ func TestImageLifecycle(t *testing.T) {
|
||||
resource.NewObjectProperty(resource.PropertyMap{
|
||||
"address": resource.NewStringProperty("fakeaddress"),
|
||||
"username": resource.NewStringProperty("fakeuser"),
|
||||
"password": resource.MakeSecret(resource.NewStringProperty("password")),
|
||||
"password": resource.MakeSecret(
|
||||
resource.NewStringProperty("password"),
|
||||
),
|
||||
}),
|
||||
},
|
||||
),
|
||||
@@ -294,7 +297,9 @@ func TestDelete(t *testing.T) {
|
||||
t.Parallel()
|
||||
ctrl := gomock.NewController(t)
|
||||
client := NewMockClient(ctrl)
|
||||
client.EXPECT().Delete(gomock.Any(), "docker.io/pulumi/test@sha256:foo").Return(errNotFound{})
|
||||
client.EXPECT().
|
||||
Delete(gomock.Any(), "docker.io/pulumi/test@sha256:foo").
|
||||
Return(errNotFound{})
|
||||
|
||||
s := newServer(client)
|
||||
err := s.Configure(provider.ConfigureRequest{})
|
||||
|
||||
@@ -28,9 +28,9 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
_ infer.Annotated = (infer.Annotated)((*Index)(nil))
|
||||
_ infer.Annotated = (infer.Annotated)((*IndexArgs)(nil))
|
||||
_ infer.Annotated = (infer.Annotated)((*IndexState)(nil))
|
||||
_ infer.Annotated = (*Index)(nil)
|
||||
_ infer.Annotated = (*IndexArgs)(nil)
|
||||
_ infer.Annotated = (*IndexState)(nil)
|
||||
_ infer.CustomCheck[IndexArgs] = (*Index)(nil)
|
||||
_ infer.CustomResource[IndexArgs, IndexState] = (*Index)(nil)
|
||||
_ infer.CustomDelete[IndexState] = (*Index)(nil)
|
||||
@@ -299,8 +299,7 @@ func (i *Index) client(
|
||||
}
|
||||
|
||||
auths := cfg.Registries
|
||||
auths = append(auths, state.Registry)
|
||||
auths = append(auths, args.Registry)
|
||||
auths = append(auths, state.Registry, args.Registry)
|
||||
|
||||
return wrap(cfg.host, auths...)
|
||||
}
|
||||
|
||||
@@ -44,7 +44,9 @@ func TestIndexLifecycle(t *testing.T) {
|
||||
op: func(t *testing.T) integration.Operation {
|
||||
return integration.Operation{
|
||||
Inputs: resource.PropertyMap{
|
||||
"tag": resource.NewStringProperty("docker.io/pulumibot/buildkit-e2e:manifest-unit"),
|
||||
"tag": resource.NewStringProperty(
|
||||
"docker.io/pulumibot/buildkit-e2e:manifest-unit",
|
||||
),
|
||||
"sources": resource.NewArrayProperty([]resource.PropertyValue{
|
||||
resource.NewStringProperty("docker.io/pulumibot/buildkit-e2e:arm64"),
|
||||
resource.NewStringProperty("docker.io/pulumibot/buildkit-e2e:amd64"),
|
||||
@@ -61,7 +63,9 @@ func TestIndexLifecycle(t *testing.T) {
|
||||
op: func(t *testing.T) integration.Operation {
|
||||
return integration.Operation{
|
||||
Inputs: resource.PropertyMap{
|
||||
"tag": resource.NewStringProperty("docker.io/pulumibot/buildkit-e2e:manifest"),
|
||||
"tag": resource.NewStringProperty(
|
||||
"docker.io/pulumibot/buildkit-e2e:manifest",
|
||||
),
|
||||
"sources": resource.NewArrayProperty([]resource.PropertyValue{
|
||||
resource.NewStringProperty("docker.io/pulumibot/buildkit-e2e:arm64"),
|
||||
resource.NewStringProperty("docker.io/pulumibot/buildkit-e2e:amd64"),
|
||||
@@ -71,7 +75,9 @@ func TestIndexLifecycle(t *testing.T) {
|
||||
"address": resource.NewStringProperty("docker.io"),
|
||||
"username": resource.NewStringProperty("pulumibot"),
|
||||
"password": resource.NewSecretProperty(&resource.Secret{
|
||||
Element: resource.NewStringProperty(os.Getenv("DOCKER_HUB_PASSWORD")),
|
||||
Element: resource.NewStringProperty(
|
||||
os.Getenv("DOCKER_HUB_PASSWORD"),
|
||||
),
|
||||
}),
|
||||
}),
|
||||
},
|
||||
|
||||
@@ -33,8 +33,8 @@ import (
|
||||
|
||||
var (
|
||||
_ infer.CustomConfigure = (*Config)(nil)
|
||||
_ infer.Annotated = (infer.Annotated)((*Config)(nil))
|
||||
_ infer.Annotated = (infer.Annotated)((*Registry)(nil))
|
||||
_ infer.Annotated = (*Config)(nil)
|
||||
_ infer.Annotated = (*Registry)(nil)
|
||||
)
|
||||
|
||||
// Config configures the buildx provider.
|
||||
|
||||
@@ -64,9 +64,9 @@ func TestSchema(t *testing.T) {
|
||||
|
||||
type annotator struct{}
|
||||
|
||||
func (annotator) Describe(_ any, _ string) {}
|
||||
func (annotator) SetDefault(_ any, _ any, _ ...string) {}
|
||||
func (annotator) SetToken(_, _ string) {}
|
||||
func (annotator) Describe(_ any, _ string) {}
|
||||
func (annotator) SetDefault(_, _ any, _ ...string) {}
|
||||
func (annotator) SetToken(_, _ string) {}
|
||||
|
||||
func newServer(client Client) integration.Server {
|
||||
p := NewBuildxProvider()
|
||||
|
||||
Reference in New Issue
Block a user