@@ -32,7 +32,6 @@ import (
3232 "github.com/GoogleContainerTools/kaniko/pkg/creds"
3333 "github.com/GoogleContainerTools/kaniko/pkg/executor"
3434 "github.com/GoogleContainerTools/kaniko/pkg/util"
35- giturls "github.com/chainguard-dev/git-urls"
3635 "github.com/coder/envbuilder/devcontainer"
3736 "github.com/coder/envbuilder/internal/ebutil"
3837 "github.com/coder/envbuilder/internal/log"
@@ -42,8 +41,6 @@ import (
4241 _ "github.com/distribution/distribution/v3/registry/storage/driver/filesystem"
4342 "github.com/docker/cli/cli/config/configfile"
4443 "github.com/fatih/color"
45- "github.com/go-git/go-billy/v5"
46- "github.com/go-git/go-billy/v5/osfs"
4744 "github.com/go-git/go-git/v5/plumbing/transport"
4845 v1 "github.com/google/go-containerregistry/pkg/v1"
4946 "github.com/google/go-containerregistry/pkg/v1/remote"
@@ -62,23 +59,8 @@ type DockerConfig configfile.ConfigFile
6259// Filesystem is the filesystem to use for all operations.
6360// Defaults to the host filesystem.
6461func Run (ctx context.Context , opts options.Options ) error {
65- // Temporarily removed these from the default settings to prevent conflicts
66- // between current and legacy environment variables that add default values.
67- // Once the legacy environment variables are phased out, this can be
68- // reinstated to the previous default values.
69- if len (opts .IgnorePaths ) == 0 {
70- opts .IgnorePaths = []string {
71- "/var/run" ,
72- // KinD adds these paths to pods, so ignore them by default.
73- "/product_uuid" , "/product_name" ,
74- }
75- }
76- if opts .InitScript == "" {
77- opts .InitScript = "sleep infinity"
78- }
79- if opts .InitCommand == "" {
80- opts .InitCommand = "/bin/sh"
81- }
62+ opts .SetDefaults ()
63+
8264 if opts .CacheRepo == "" && opts .PushImage {
8365 return fmt .Errorf ("--cache-repo must be set when using --push-image" )
8466 }
@@ -91,16 +73,6 @@ func Run(ctx context.Context, opts options.Options) error {
9173 return fmt .Errorf ("parse init args: %w" , err )
9274 }
9375 }
94- if opts .Filesystem == nil {
95- opts .Filesystem = & osfsWithChmod {osfs .New ("/" )}
96- }
97- if opts .WorkspaceFolder == "" {
98- f , err := DefaultWorkspaceFolder (opts .GitURL )
99- if err != nil {
100- return err
101- }
102- opts .WorkspaceFolder = f
103- }
10476
10577 stageNumber := 0
10678 startStage := func (format string , args ... any ) func (format string , args ... any ) {
@@ -930,25 +902,6 @@ ENTRYPOINT [%q]`, exePath, exePath, exePath)
930902 return nil
931903}
932904
933- // DefaultWorkspaceFolder returns the default workspace folder
934- // for a given repository URL.
935- func DefaultWorkspaceFolder (repoURL string ) (string , error ) {
936- if repoURL == "" {
937- return constants .EmptyWorkspaceDir , nil
938- }
939- parsed , err := giturls .Parse (repoURL )
940- if err != nil {
941- return "" , err
942- }
943- name := strings .Split (parsed .Path , "/" )
944- hasOwnerAndRepo := len (name ) >= 2
945- if ! hasOwnerAndRepo {
946- return constants .EmptyWorkspaceDir , nil
947- }
948- repo := strings .TrimSuffix (name [len (name )- 1 ], ".git" )
949- return fmt .Sprintf ("/workspaces/%s" , repo ), nil
950- }
951-
952905type userInfo struct {
953906 uid int
954907 gid int
@@ -1077,14 +1030,6 @@ func newColor(value ...color.Attribute) *color.Color {
10771030 return c
10781031}
10791032
1080- type osfsWithChmod struct {
1081- billy.Filesystem
1082- }
1083-
1084- func (fs * osfsWithChmod ) Chmod (name string , mode os.FileMode ) error {
1085- return os .Chmod (name , mode )
1086- }
1087-
10881033func findDevcontainerJSON (options options.Options ) (string , string , error ) {
10891034 // 0. Check if custom devcontainer directory or path is provided.
10901035 if options .DevcontainerDir != "" || options .DevcontainerJSONPath != "" {
0 commit comments