Navigation Menu

Skip to content

Commit

Permalink
fix: update all dependencies
Browse files Browse the repository at this point in the history
Signed-off-by: Ilya Lesikov <ilya@lesikov.com>
  • Loading branch information
ilya-lesikov committed Mar 15, 2023
1 parent 471165c commit cc19916
Show file tree
Hide file tree
Showing 11 changed files with 885 additions and 533 deletions.
2 changes: 1 addition & 1 deletion Taskfile.dist.yaml
Expand Up @@ -504,7 +504,7 @@ tasks:
deps:install:ginkgo:
desc: "Install ginkgo binary."
cmds:
- go install {{.CLI_ARGS}} github.com/onsi/ginkgo/v2/ginkgo@{{.ginkgoVersion | default "v2.1.4"}}
- go install {{.CLI_ARGS}} github.com/onsi/ginkgo/v2/ginkgo@{{.ginkgoVersion | default "v2.9.1"}}

deps:install:golangci-lint:
desc: "Install golangci-lint binary."
Expand Down
290 changes: 163 additions & 127 deletions go.mod

Large diffs are not rendered by default.

997 changes: 625 additions & 372 deletions go.sum

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pkg/build/image/dockerfile.go
Expand Up @@ -7,7 +7,7 @@ import (
"path/filepath"
"strings"

"github.com/docker/docker/builder/dockerignore"
"github.com/moby/buildkit/frontend/dockerfile/dockerignore"
"github.com/moby/buildkit/frontend/dockerfile/instructions"
"github.com/moby/buildkit/frontend/dockerfile/parser"

Expand Down
4 changes: 2 additions & 2 deletions pkg/build/stage/full_dockerfile.go
Expand Up @@ -607,7 +607,7 @@ func (s *FullDockerfileStage) dockerfileInstructionDependencies(ctx context.Cont
case *instructions.AddCommand:
dependencies = append(dependencies, c.String())

resolvedSources, err := resolveSourcesFunc(c.SourcesAndDest.Sources())
resolvedSources, err := resolveSourcesFunc(c.SourcePaths)
if err != nil {
return nil, nil, err
}
Expand All @@ -620,7 +620,7 @@ func (s *FullDockerfileStage) dockerfileInstructionDependencies(ctx context.Cont
case *instructions.CopyCommand:
dependencies = append(dependencies, c.String())
if c.From == "" {
resolvedSources, err := resolveSourcesFunc(c.SourcesAndDest.Sources())
resolvedSources, err := resolveSourcesFunc(c.SourcePaths)
if err != nil {
return nil, nil, err
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/build/stage/instruction/add.go
Expand Up @@ -26,13 +26,13 @@ func NewAdd(i *dockerfile.DockerfileStageInstruction[*instructions.AddCommand],
func (stg *Add) GetDependencies(ctx context.Context, c stage.Conveyor, cb container_backend.ContainerBackend, prevImage, prevBuiltImage *stage.StageImage, buildContextArchive container_backend.BuildContextArchiver) (string, error) {
var args []string

args = append(args, append([]string{"Sources"}, stg.instruction.Data.Sources()...)...)
args = append(args, "Dest", stg.instruction.Data.Dest())
args = append(args, append([]string{"Sources"}, stg.instruction.Data.SourcePaths...)...)
args = append(args, "Dest", stg.instruction.Data.DestPath)
args = append(args, "Chown", stg.instruction.Data.Chown)
args = append(args, "Chmod", stg.instruction.Data.Chmod)

var fileGlobSrc []string
for _, src := range stg.instruction.Data.Sources() {
for _, src := range stg.instruction.Data.SourcePaths {
if !strings.HasPrefix(src, "http://") && !strings.HasPrefix(src, "https://") {
fileGlobSrc = append(fileGlobSrc, src)
}
Expand Down
54 changes: 48 additions & 6 deletions pkg/build/stage/instruction/add_test.go
Expand Up @@ -27,7 +27,14 @@ var _ = DescribeTable("ADD digest",
Entry("ADD basic", NewTestData(
NewAdd(
dockerfile.NewDockerfileStageInstruction(
&instructions.AddCommand{SourcesAndDest: []string{"src", "/app"}, Chown: "1000:1000", Chmod: ""},
&instructions.AddCommand{
SourcesAndDest: instructions.SourcesAndDest{
DestPath: "/app",
SourcePaths: []string{"src"},
},
Chown: "1000:1000",
Chmod: "",
},
dockerfile.DockerfileStageInstructionOptions{},
),
nil, false,
Expand All @@ -48,7 +55,14 @@ var _ = DescribeTable("ADD digest",
Entry("ADD with changed chown", NewTestData(
NewAdd(
dockerfile.NewDockerfileStageInstruction(
&instructions.AddCommand{SourcesAndDest: []string{"src", "/app"}, Chown: "1000:1001", Chmod: ""},
&instructions.AddCommand{
SourcesAndDest: instructions.SourcesAndDest{
DestPath: "/app",
SourcePaths: []string{"src"},
},
Chown: "1000:1001",
Chmod: "",
},
dockerfile.DockerfileStageInstructionOptions{},
),
nil, false,
Expand All @@ -70,7 +84,14 @@ var _ = DescribeTable("ADD digest",
Entry("ADD with changed chmod", NewTestData(
NewAdd(
dockerfile.NewDockerfileStageInstruction(
&instructions.AddCommand{SourcesAndDest: []string{"src", "/app"}, Chown: "1000:1001", Chmod: "0777"},
&instructions.AddCommand{
SourcesAndDest: instructions.SourcesAndDest{
DestPath: "/app",
SourcePaths: []string{"src"},
},
Chown: "1000:1001",
Chmod: "0777",
},
dockerfile.DockerfileStageInstructionOptions{},
),
nil, false,
Expand All @@ -92,7 +113,14 @@ var _ = DescribeTable("ADD digest",
Entry("ADD with changed sources paths", NewTestData(
NewAdd(
dockerfile.NewDockerfileStageInstruction(
&instructions.AddCommand{SourcesAndDest: []string{"src", "pom.xml", "/app"}, Chown: "1000:1001", Chmod: "0777"},
&instructions.AddCommand{
SourcesAndDest: instructions.SourcesAndDest{
DestPath: "/app",
SourcePaths: []string{"src", "pom.xml"},
},
Chown: "1000:1001",
Chmod: "0777",
},
dockerfile.DockerfileStageInstructionOptions{},
),
nil, false,
Expand All @@ -114,7 +142,14 @@ var _ = DescribeTable("ADD digest",
Entry("ADD with changed source files", NewTestData(
NewAdd(
dockerfile.NewDockerfileStageInstruction(
&instructions.AddCommand{SourcesAndDest: []string{"src", "pom.xml", "/app"}, Chown: "1000:1001", Chmod: "0777"},
&instructions.AddCommand{
SourcesAndDest: instructions.SourcesAndDest{
DestPath: "/app",
SourcePaths: []string{"src", "pom.xml"},
},
Chown: "1000:1001",
Chmod: "0777",
},
dockerfile.DockerfileStageInstructionOptions{},
),
nil, false,
Expand All @@ -136,7 +171,14 @@ var _ = DescribeTable("ADD digest",
Entry("ADD with changed destination path", NewTestData(
NewAdd(
dockerfile.NewDockerfileStageInstruction(
&instructions.AddCommand{SourcesAndDest: []string{"src", "pom.xml", "/app2"}, Chown: "1000:1001", Chmod: "0777"},
&instructions.AddCommand{
SourcesAndDest: instructions.SourcesAndDest{
DestPath: "/app2",
SourcePaths: []string{"src", "pom.xml"},
},
Chown: "1000:1001",
Chmod: "0777",
},
dockerfile.DockerfileStageInstructionOptions{},
),
nil, false,
Expand Down
6 changes: 3 additions & 3 deletions pkg/build/stage/instruction/copy.go
Expand Up @@ -45,14 +45,14 @@ func (stg *Copy) GetDependencies(ctx context.Context, c stage.Conveyor, cb conta
var args []string

args = append(args, "From", stg.instruction.Data.From)
args = append(args, append([]string{"Sources"}, stg.instruction.Data.Sources()...)...)
args = append(args, "Dest", stg.instruction.Data.Dest())
args = append(args, append([]string{"Sources"}, stg.instruction.Data.SourcePaths...)...)
args = append(args, "Dest", stg.instruction.Data.DestPath)
args = append(args, "Chown", stg.instruction.Data.Chown)
args = append(args, "Chmod", stg.instruction.Data.Chmod)
args = append(args, "ExpandedFrom", stg.backendInstruction.From)

if stg.UsesBuildContext() {
if srcChecksum, err := buildContextArchive.CalculateGlobsChecksum(ctx, stg.instruction.Data.Sources(), false); err != nil {
if srcChecksum, err := buildContextArchive.CalculateGlobsChecksum(ctx, stg.instruction.Data.SourcePaths, false); err != nil {
return "", fmt.Errorf("unable to calculate build context globs checksum: %w", err)
} else {
args = append(args, "SourcesChecksum", srcChecksum)
Expand Down
49 changes: 35 additions & 14 deletions pkg/build/stage/instruction/copy_test.go
Expand Up @@ -28,7 +28,10 @@ var _ = DescribeTable("COPY digest",
NewCopy(
dockerfile.NewDockerfileStageInstruction(
&instructions.CopyCommand{
SourcesAndDest: []string{"src/", "doc/", "/app"},
SourcesAndDest: instructions.SourcesAndDest{
DestPath: "/app",
SourcePaths: []string{"src/", "doc/"},
},
},
dockerfile.DockerfileStageInstructionOptions{},
),
Expand All @@ -52,7 +55,10 @@ var _ = DescribeTable("COPY digest",
NewCopy(
dockerfile.NewDockerfileStageInstruction(
&instructions.CopyCommand{
SourcesAndDest: []string{"src/", "doc/", "/app"},
SourcesAndDest: instructions.SourcesAndDest{
DestPath: "/app",
SourcePaths: []string{"src/", "doc/"},
},
},
dockerfile.DockerfileStageInstructionOptions{},
),
Expand All @@ -76,8 +82,11 @@ var _ = DescribeTable("COPY digest",
NewCopy(
NewDockerfileStageInstructionWithDependencyStages(
&instructions.CopyCommand{
From: "base",
SourcesAndDest: []string{"src/", "doc/", "/app"},
From: "base",
SourcesAndDest: instructions.SourcesAndDest{
DestPath: "/app",
SourcePaths: []string{"src/", "doc/"},
},
},
[]string{"base"},
),
Expand All @@ -99,8 +108,11 @@ var _ = DescribeTable("COPY digest",
NewCopy(
NewDockerfileStageInstructionWithDependencyStages(
&instructions.CopyCommand{
From: "base",
SourcesAndDest: []string{"src/", "doc/", "/app"},
From: "base",
SourcesAndDest: instructions.SourcesAndDest{
DestPath: "/app",
SourcePaths: []string{"src/", "doc/"},
},
},
[]string{"base"},
),
Expand All @@ -122,8 +134,11 @@ var _ = DescribeTable("COPY digest",
NewCopy(
NewDockerfileStageInstructionWithDependencyStages(
&instructions.CopyCommand{
From: "base",
SourcesAndDest: []string{"src/", "doc/", "/app"},
From: "base",
SourcesAndDest: instructions.SourcesAndDest{
DestPath: "/app",
SourcePaths: []string{"src/", "doc/"},
},
},
[]string{"base"},
),
Expand All @@ -150,8 +165,11 @@ var _ = DescribeTable("COPY digest",
NewCopy(
NewDockerfileStageInstructionWithDependencyStages(
&instructions.CopyCommand{
From: "base",
SourcesAndDest: []string{"src/", "doc/", "/app2"},
From: "base",
SourcesAndDest: instructions.SourcesAndDest{
DestPath: "/app2",
SourcePaths: []string{"src/", "doc/"},
},
},
[]string{"base"},
),
Expand All @@ -178,10 +196,13 @@ var _ = DescribeTable("COPY digest",
NewCopy(
NewDockerfileStageInstructionWithDependencyStages(
&instructions.CopyCommand{
From: "base",
SourcesAndDest: []string{"src/", "doc/", "/app2"},
Chown: "1000:1000",
Chmod: "0777",
From: "base",
SourcesAndDest: instructions.SourcesAndDest{
DestPath: "/app2",
SourcePaths: []string{"src/", "doc/"},
},
Chown: "1000:1000",
Chmod: "0777",
},
[]string{"base"},
),
Expand Down
4 changes: 2 additions & 2 deletions pkg/container_backend/instruction/add.go
Expand Up @@ -32,13 +32,13 @@ func (i *Add) Apply(ctx context.Context, containerName string, drv buildah.Build
}
}

if err := drv.Add(ctx, containerName, i.Sources(), i.Dest(), buildah.AddOpts{
if err := drv.Add(ctx, containerName, i.SourcePaths, i.DestPath, buildah.AddOpts{
CommonOpts: drvOpts,
ContextDir: contextDir,
Chown: i.Chown,
Chmod: i.Chmod,
}); err != nil {
return fmt.Errorf("error adding %v to %s for container %s: %w", i.Sources(), i.Dest(), containerName, err)
return fmt.Errorf("error adding %v to %s for container %s: %w", i.SourcePaths, i.DestPath, containerName, err)
}

return nil
Expand Down
4 changes: 2 additions & 2 deletions pkg/container_backend/instruction/copy.go
Expand Up @@ -42,12 +42,12 @@ func (i *Copy) Apply(ctx context.Context, containerName string, drv buildah.Buil
}
}

if err := drv.Copy(ctx, containerName, contextDir, i.Sources(), i.Dest(), buildah.CopyOpts{
if err := drv.Copy(ctx, containerName, contextDir, i.SourcePaths, i.DestPath, buildah.CopyOpts{
CommonOpts: drvOpts,
Chown: i.Chown,
Chmod: i.Chmod,
}); err != nil {
return fmt.Errorf("error copying %v to %s for container %s: %w", i.Sources(), i.Dest(), containerName, err)
return fmt.Errorf("error copying %v to %s for container %s: %w", i.SourcePaths, i.DestPath, containerName, err)
}

return nil
Expand Down

0 comments on commit cc19916

Please sign in to comment.